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