summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid T. Sadler <davidtsadler@googlemail.com>2023-12-29 22:06:06 +0000
committerDavid T. Sadler <davidtsadler@googlemail.com>2023-12-29 22:06:06 +0000
commitbaffc6cd7f2d373c0fc0a4bb0c2b771d959a2acb (patch)
treed9fb36c35567742a3e2378a82120524b88bf8ee4
parent61462e188fd92f7fa17b83458c67860bbfa4bc05 (diff)
Install packages
-rwxr-xr-xgohan.sh37
1 files changed, 37 insertions, 0 deletions
diff --git a/gohan.sh b/gohan.sh
index f7d4ebf..8c82308 100755
--- a/gohan.sh
+++ b/gohan.sh
@@ -122,6 +122,41 @@ install_yay() {
);
}
+install_packages() {
+ curl -Ls https://git.davidtsadler.com/gohan/plain/packages.csv?h=version-1.0.0 > /tmp/packages.csv
+ total=$(wc -l < /tmp/packages.csv)
+ while IFS=, read -r tag program comment; do
+ n=$((n+1))
+ echo "$comment" | grep "^\".*\"$" >/dev/null 2>&1 && comment="$(echo "$comment" | sed "s/\(^\"\|\"$\)//g")"
+ case "$tag" in
+ "A") install_from_aur "$program" "$comment" ;;
+ "G") install_from_github "$program" "$comment" ;;
+ *) install_package "$program" "$comment" ;;
+ esac
+ done < /tmp/packages.csv
+ rm /tmp/packages.csv
+}
+
+install_package() {
+ printf "Installing \`$1\` ($n of $total). $1 $2\n"
+ install_from_pacman "$1"
+}
+
+install_from_aur() {
+ printf "Installing \`$1\` ($n of $total) from the AUR. $1 $2\n"
+ sudo -u "$name" yay -S --noconfirm "$1" >/dev/null 2>&1
+}
+
+install_from_github() {
+ progname="$(basename "$1" .git)"
+ repodir="/home/$name/.local/src"
+ dir="$repodir/$progname"
+ printf "Installing \`$progname\` ($n of $total) via \`git\` and \`make\`. $(basename "$1") $2\n"
+ sudo -u "$name" git clone --depth 1 "$1" "$dir" >/dev/null 2>&1
+ cd "$dir" || exit
+ sudo -u "$name" make clean install >/dev/null 2>&1
+}
+
### THE ACTUAL SCRIPT ###
install_dependancies
@@ -133,3 +168,5 @@ configure_sudo
setup_user_home_directory
install_yay
+
+install_packages