From c76d0fcd11aca4a0cbb736b2ce0a3f64539d8df6 Mon Sep 17 00:00:00 2001 From: askiiart Date: Mon, 28 Aug 2023 18:01:19 -0500 Subject: [PATCH] Update package managers to work properly more often --- daily-use-pcs/fedora/setup-git.bash | 22 +++++++++++----------- random-bash.md | 2 +- test.bash | 10 ---------- zsh/zsh-setup.bash | 8 ++++---- 4 files changed, 16 insertions(+), 26 deletions(-) delete mode 100755 test.bash diff --git a/daily-use-pcs/fedora/setup-git.bash b/daily-use-pcs/fedora/setup-git.bash index 8c5e8cb..c723b6a 100755 --- a/daily-use-pcs/fedora/setup-git.bash +++ b/daily-use-pcs/fedora/setup-git.bash @@ -9,26 +9,26 @@ EMAIL="dev@askiiart.net" # Note: This waits until enter is pressed # read -p "Press Enter to continue" < /dev/tty -command_exists() { type "$1" &> /dev/null; } +command_exists() { type "$1" &>/dev/null; } if command_exists "apt-get"; then - PM="apt-get" + apt-get install pass git -y elif command_exists "yum"; then - PM="yum" + yum install pass git -y elif command_exists "pacman"; then - PM="pacman" + pacman -S git --noconfirm + pacman -S pass --noconfirm elif command_exists "zypp"; then - PM="zypp" + zypper install pass git -y elif command_exists "emerge"; then - PM="emerge" + echo Not yet supported, exiting... elif command_exists "apk"; then - PM="apk" + apk add pass + apk add git else echo "Unsupported: unknown package manager" fi -sudo ${PM} install pass git -y - # Check if GCM is installed if [ -f "${HOME}/.git-credentials" ]; then echo "Git Credential Manager already installed, skipping..." @@ -54,7 +54,7 @@ gpg --armor --export $KEY_ID echo This is the exported key, copy it and put it in GitHub/Gitea/whatever echo Gitea URL: ${GITEA_URL}/user/settings/keys echo GitHub URL: https://github.com/settings/gpg/new -read -p "Press enter when you're done" < /dev/tty +read -p "Press enter when you're done" &2` at beginning or end of line to output to stderr >&2 echo "This goes to stderr" echo "This goes to stdout" -``` \ No newline at end of file +``` diff --git a/test.bash b/test.bash deleted file mode 100755 index 88aa31f..0000000 --- a/test.bash +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env bash -type "$1" &> /dev/null; } - -if command_exists "apt-get"; then - PM="apt-get" -elif command_exists "yum"; then - PM="yum" -fi - -echo $PM \ No newline at end of file diff --git a/zsh/zsh-setup.bash b/zsh/zsh-setup.bash index ad26625..183ee83 100755 --- a/zsh/zsh-setup.bash +++ b/zsh/zsh-setup.bash @@ -7,7 +7,7 @@ if [ $(whoami) != "root" ]; then exit 1 fi exit 0 -command_exists() { type "$1" &> /dev/null; } +command_exists() { type "$1" &>/dev/null; } if command_exists "apt-get"; then $SUDO apt-get install zsh -y @@ -22,10 +22,10 @@ elif command_exists "emerge"; then $SUDO emerge --ask app-shells/zsh-completions $SUDO emerge --ask app-shells/gentoo-zsh-completions elif command_exists "apk"; then - $SUDO apk add zsh -y; + $SUDO apk add zsh -y else - >&2 echo "Unsupported: unknown package manager" + echo >&2 "Unsupported: unknown package manager" exit 1 fi -cp -r zsh-files/* ~/ \ No newline at end of file +cp -r zsh-files/* ~/