-
Notifications
You must be signed in to change notification settings - Fork 0
/
rice.sh
executable file
·51 lines (40 loc) · 1.1 KB
/
rice.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/env sh
# install all the programs in programs.csv
set -x # echo commands
set -e # exit on failure
name="zach"
git_install() {
program_name="$(basename $1 '.git')"
target_directory=~/workspace/"$program_name"
./clone_or_pull "$1" "$target_directory"
cd "$target_directory"
sudo make clean install
cd -
}
pacman_install() {
pacman -Q "$1" 2>/dev/null || \
pacman --noconfirm --needed --sync "$1"
}
aur_install() {
pacman -Q "$1" 2>/dev/null || \
sudo -u "$name" yay -S --noconfirm "$1"
}
pip_install() {
pip install "$1"
}
pipx_install() {
pipx install "$1"
}
tempfile="${HOME}/.cache/programs.csv"
# ignore the first line (headers)
# https://stackoverflow.com/questions/339483/how-can-i-remove-the-first-line-of-a-text-file-using-bash-sed-script
tail -n +2 programs.csv | sed '/^#/d' > "${tempfile}"
while IFS="," read -r tag program comment; do
case "$tag" in
"G") git_install "$program";;
"P") pip_install "$program";;
"PX") pipx_install "$program";;
"A") aur_install "$program";;
*) aur_install "$program";;
esac
done < "${tempfile}"