(chore): Fix some styling

This commit is contained in:
Blake Ridgway 2024-09-16 05:59:53 -05:00
parent 251194b35c
commit b42c8addaa

View file

@ -6,19 +6,19 @@
# Function to detect the Linux distribution # Function to detect the Linux distribution
detect_linux_distro() { detect_linux_distro() {
if [ -f /etc/os-release ]; then if [ -f /etc/os-release ]; then
. /etc/os-release . /etc/os-release
echo "$ID" echo "$ID"
elif [ -f /etc/lsb-release ]; then elif [ -f /etc/lsb-release ]; then
. /etc/lsb-release . /etc/lsb-release
echo "$DISTRIBUTOR_ID" echo "$DISTRIBUTOR_ID"
elif [ -f /etc/debian_version ]; then elif [ -f /etc/debian_version ]; then
echo "debian" echo "debian"
elif [ -f /etc/redhat-release ]; then elif [ -f /etc/redhat-release ]; then
echo "redhat" echo "redhat"
else else
echo "unknown" echo "unknown"
fi fi
} }
# Detect the Linux distribution # Detect the Linux distribution
@ -26,52 +26,53 @@ DISTRO=$(detect_linux_distro)
# Determine the appropriate package manager # Determine the appropriate package manager
case "$DISTRO" in case "$DISTRO" in
fedora|rhel|centos) fedora | rhel | centos)
PACKAGE_MANAGER="dnf" PACKAGE_MANAGER="dnf"
;; ;;
debian|ubuntu|pop) debian | ubuntu | pop)
PACKAGE_MANAGER="apt" PACKAGE_MANAGER="apt"
;; ;;
*) *)
echo "Unsupported distribution: $DISTRO" echo "Unsupported distribution: $DISTRO"
exit 1 exit 1
;; ;;
esac esac
# Update system before installing packages # Update system before installing packages
if [ "$PACKAGE_MANAGER" == "dnf" ]; then if [ "$PACKAGE_MANAGER" == "dnf" ]; then
sudo dnf update && sudo dnf upgrade sudo dnf update && sudo dnf upgrade
elif [ "$PACKAGE_MANAGER" == "apt" ]; then elif [ "$PACKAGE_MANAGER" == "apt" ]; then
sudo apt update && sudo apt upgrade -y sudo apt update && sudo apt upgrade -y
fi fi
# Setup Flatpak # Setup Flatpak
flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
PACKAGE_LIST=( PACKAGE_LIST=(
btop btop
curl curl
git git
gh gh
fd-find fd-find
flatpak flatpak
libfontconfig-dev libfontconfig-dev
libssl-dev libssl-dev
neofetch neofetch
python3 python3
python3-pip python3-pip
ripgrep ripgrep
virt-manager virt-manager
zsh zsh
) )
FLATPAK_LIST=( FLATPAK_LIST=(
com.bitwarden.desktop com.bitwarden.desktop
com.github.tchx84.Flatseal com.discordapp.Discord
com.valvesoftware.Steam com.github.tchx84.Flatseal
net.davidotek.pupgui2 com.valvesoftware.Steam
net.veloren.airshipper net.davidotek.pupgui2
org.videolan.VLC net.veloren.airshipper
org.videolan.VLC
) )
echo ####################### echo #######################
@ -79,33 +80,33 @@ echo # Installing Packages #
echo ####################### echo #######################
for package_name in ${PACKAGE_LIST[@]}; do for package_name in ${PACKAGE_LIST[@]}; do
if [ "$PACKAGE_MANAGER" == "dnf" ]; then if [ "$PACKAGE_MANAGER" == "dnf" ]; then
if ! dnf list --installed | grep -q "^\<$package_name\>"; then if ! dnf list --installed | grep -q "^\<$package_name\>"; then
echo "Installing $package_name..." echo "Installing $package_name..."
sleep .5 sleep .5
sudo dnf install "$package_name" -y sudo dnf install "$package_name" -y
echo "$package_name has been installed" echo "$package_name has been installed"
else else
echo "$package_name already installed" echo "$package_name already installed"
fi
elif [ "$PACKAGE_MANAGER" == "apt" ]; then
if ! dpkg -l | grep -q "^\<ii\> $package_name"; then
echo "Installing $package_name..."
sleep .5
sudo apt install "$package_name" -y
echo "$package_name has been installed"
else
echo "$package_name already installed"
fi
fi fi
elif [ "$PACKAGE_MANAGER" == "apt" ]; then
if ! dpkg -l | grep -q "^\<ii\> $package_name"; then
echo "Installing $package_name..."
sleep .5
sudo apt install "$package_name" -y
echo "$package_name has been installed"
else
echo "$package_name already installed"
fi
fi
done done
for flatpak_name in ${FLATPAK_LIST[@]}; do for flatpak_name in ${FLATPAK_LIST[@]}; do
if ! flatpak list | grep -q $flatpak_name; then if ! flatpak list | grep -q $flatpak_name; then
flatpak install "$flatpak_name" -y flatpak install "$flatpak_name" -y
else else
echo "$flatpak_name already installed" echo "$flatpak_name already installed"
fi fi
done done
echo ################### echo ###################
@ -131,14 +132,12 @@ mkdir -p ~/.local/share/fonts && cp Hack/HackNerdFont-Regular.ttf ~/.local/share
fc-cache -f -v fc-cache -f -v
rm -rf Hack* rm -rf Hack*
echo ###################### echo ######################
echo # Installing OhMyZSH # echo # Installing OhMyZSH #
echo ###################### echo ######################
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
echo ################### echo ###################
echo # Install Rust Up # echo # Install Rust Up #
echo ################### echo ###################
@ -161,13 +160,13 @@ cp terminal/starship.toml ~/.config/starship.toml
FILES=('vimrc' 'vim' 'zshrc' 'zsh' 'agignore' 'gitconfig' 'gitignore' 'gitmessage' 'aliases') FILES=('vimrc' 'vim' 'zshrc' 'zsh' 'agignore' 'gitconfig' 'gitignore' 'gitmessage' 'aliases')
for file in ${FILES[@]}; do for file in ${FILES[@]}; do
echo "" echo ""
echo "Simlinking $file to $HOME" echo "Simlinking $file to $HOME"
ln -sf "$PWD/$file" "$HOME/.$file" ln -sf "$PWD/$file" "$HOME/.$file"
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo "$PWD/$file ~> $HOME/.$file" echo "$PWD/$file ~> $HOME/.$file"
else else
echo 'Install failed to symlink.' echo 'Install failed to symlink.'
exit 1 exit 1
fi fi
done done