Update package managers to work properly more often

This commit is contained in:
askiiart 2023-08-28 18:01:19 -05:00
parent b0d81f4f0e
commit c76d0fcd11
No known key found for this signature in database
GPG key ID: 85505F3A2264FA01
4 changed files with 16 additions and 26 deletions

View file

@ -9,26 +9,26 @@ EMAIL="dev@askiiart.net"
# Note: This waits until enter is pressed # Note: This waits until enter is pressed
# read -p "Press Enter to continue" < /dev/tty # 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 if command_exists "apt-get"; then
PM="apt-get" apt-get install pass git -y
elif command_exists "yum"; then elif command_exists "yum"; then
PM="yum" yum install pass git -y
elif command_exists "pacman"; then elif command_exists "pacman"; then
PM="pacman" pacman -S git --noconfirm
pacman -S pass --noconfirm
elif command_exists "zypp"; then elif command_exists "zypp"; then
PM="zypp" zypper install pass git -y
elif command_exists "emerge"; then elif command_exists "emerge"; then
PM="emerge" echo Not yet supported, exiting...
elif command_exists "apk"; then elif command_exists "apk"; then
PM="apk" apk add pass
apk add git
else else
echo "Unsupported: unknown package manager" echo "Unsupported: unknown package manager"
fi fi
sudo ${PM} install pass git -y
# Check if GCM is installed # Check if GCM is installed
if [ -f "${HOME}/.git-credentials" ]; then if [ -f "${HOME}/.git-credentials" ]; then
echo "Git Credential Manager already installed, skipping..." 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 This is the exported key, copy it and put it in GitHub/Gitea/whatever
echo Gitea URL: ${GITEA_URL}/user/settings/keys echo Gitea URL: ${GITEA_URL}/user/settings/keys
echo GitHub URL: https://github.com/settings/gpg/new 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" </dev/tty
echo Doing GCM config stuff... echo Doing GCM config stuff...
git config --global credential.credentialStore gpg git config --global credential.credentialStore gpg
@ -82,4 +82,4 @@ sudo chgrp -R $(whoami) /home/$(whoami)/.gnupg
sudo chmod -R 600 /home/$(whoami)/.gnupg sudo chmod -R 600 /home/$(whoami)/.gnupg
rm dotnet-install.sh rm dotnet-install.sh
read -p "Done. Now verify your SSH and GPG keys in Git*" < /dev/tty read -p "Done. Now verify your SSH and GPG keys in Git*" </dev/tty

View file

@ -63,4 +63,4 @@ fi
# Put `>&2` at beginning or end of line to output to stderr # Put `>&2` at beginning or end of line to output to stderr
>&2 echo "This goes to stderr" >&2 echo "This goes to stderr"
echo "This goes to stdout" echo "This goes to stdout"
``` ```

View file

@ -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

View file

@ -7,7 +7,7 @@ if [ $(whoami) != "root" ]; then
exit 1 exit 1
fi fi
exit 0 exit 0
command_exists() { type "$1" &> /dev/null; } command_exists() { type "$1" &>/dev/null; }
if command_exists "apt-get"; then if command_exists "apt-get"; then
$SUDO apt-get install zsh -y $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/zsh-completions
$SUDO emerge --ask app-shells/gentoo-zsh-completions $SUDO emerge --ask app-shells/gentoo-zsh-completions
elif command_exists "apk"; then elif command_exists "apk"; then
$SUDO apk add zsh -y; $SUDO apk add zsh -y
else else
>&2 echo "Unsupported: unknown package manager" echo >&2 "Unsupported: unknown package manager"
exit 1 exit 1
fi fi
cp -r zsh-files/* ~/ cp -r zsh-files/* ~/