Skip to content

Commit

Permalink
Fixes all BASHISMS
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisTitusTech committed Sep 19, 2024
1 parent fb88352 commit d0b7601
Show file tree
Hide file tree
Showing 27 changed files with 149 additions and 147 deletions.
4 changes: 2 additions & 2 deletions tabs/applications-setup/browser-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ install_chrome() {

install_thorium() {
printf "%b\n" "${YELLOW}Installing Thorium Browser...${RC}"
case $PACKAGER in
case "$PACKAGER" in
apt-get|nala)
"$ESCALATION_TOOL" rm -fv /etc/apt/sources.list.d/thorium.list
"$ESCALATION_TOOL" wget --no-hsts -P /etc/apt/sources.list.d/ http://dl.thorium.rocks/debian/dists/stable/thorium.list
Expand Down Expand Up @@ -79,7 +79,7 @@ install_firefox() {

install_librewolf() {
printf "%b\n" "${YELLOW}Installing Librewolf...${RC}"
case $PACKAGER in
case "$PACKAGER" in
apt-get|nala)
"$ESCALATION_TOOL" "$PACKAGER" update && "$ESCALATION_TOOL" "$PACKAGER" install -y wget gnupg lsb-release apt-transport-https ca-certificates
distro=`if echo " una bookworm vanessa focal jammy bullseye vera uma " | grep -q " $(lsb_release -sc) "; then lsb_release -sc; else echo focal; fi`
Expand Down
6 changes: 3 additions & 3 deletions tabs/applications-setup/dwmtitus-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ setupDWM() {
"$ESCALATION_TOOL" "$PACKAGER" install -y libX11-devel libXinerama-devel libXft-devel imlib2-devel libxcb-devel
;;
*)
printf "%b\n" "${RED}Unsupported package manager: $PACKAGER${RC}"
printf "%b\n" "${RED}Unsupported package manager: "$PACKAGER"${RC}"
exit 1
;;
esac
Expand Down Expand Up @@ -188,7 +188,7 @@ setupDisplayManager() {
"$ESCALATION_TOOL" "$PACKAGER" install -y xorg-x11-xinit xorg-x11-server-Xorg
;;
*)
printf "%b\n" "${RED}Unsupported package manager: $PACKAGER${RC}"
printf "%b\n" "${RED}Unsupported package manager: "$PACKAGER"${RC}"
exit 1
;;
esac
Expand Down Expand Up @@ -216,7 +216,7 @@ setupDisplayManager() {
"$ESCALATION_TOOL" "$PACKAGER" install -y "$DM"
;;
*)
printf "%b\n" "${RED}Unsupported package manager: $PACKAGER${RC}"
printf "%b\n" "${RED}Unsupported package manager: "$PACKAGER"${RC}"
exit 1
;;
esac
Expand Down
2 changes: 1 addition & 1 deletion tabs/applications-setup/mybash-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ installDepend() {
"$ESCALATION_TOOL" "$PACKAGER" install -y bash bash-completion tar bat tree unzip fontconfig git
;;
*)
printf "%b\n" "${RED}Unsupported package manager: $PACKAGER${RC}" # The packages above were grabbed out of the original mybash-setup-script.
printf "%b\n" "${RED}Unsupported package manager: "$PACKAGER"${RC}" # The packages above were grabbed out of the original mybash-setup-script.
exit 1
;;
esac
Expand Down
2 changes: 1 addition & 1 deletion tabs/applications-setup/neovim-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ installNeovim() {
"$ESCALATION_TOOL" "$PACKAGER" install -y neovim ripgrep fzf python3-virtualenv luarocks golang ShellCheck git
;;
*)
printf "%b\n" "${RED}Unsupported package manager: $PACKAGER${RC}" # The packages above were grabbed out of the original nvim-setup-script.
printf "%b\n" "${RED}Unsupported package manager: "$PACKAGER"${RC}" # The packages above were grabbed out of the original nvim-setup-script.
exit 1
;;
esac
Expand Down
22 changes: 11 additions & 11 deletions tabs/applications-setup/setup-flatpak.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,30 +23,30 @@ setup_flatpak() {
printf "%b\n" "${YELLOW}Installing Flatpak...${RC}"
case "$PACKAGER" in
pacman)
$ESCALATION_TOOL "$PACKAGER" -S --needed --noconfirm flatpak
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm flatpak
;;
apt-get|nala)
$ESCALATION_TOOL "$PACKAGER" install -y flatpak
"$ESCALATION_TOOL" "$PACKAGER" install -y flatpak
;;
dnf)
$ESCALATION_TOOL "$PACKAGER" install -y flatpak # Fedora should have flatpak already installed, this is just a failsafe
"$ESCALATION_TOOL" "$PACKAGER" install -y flatpak # Fedora should have flatpak already installed, this is just a failsafe
;;
zypper)
$ESCALATION_TOOL "$PACKAGER" install -y flatpak
"$ESCALATION_TOOL" "$PACKAGER" install -y flatpak
;;
yum)
$ESCALATION_TOOL "$PACKAGER" install -y flatpak
"$ESCALATION_TOOL" "$PACKAGER" install -y flatpak
;;
xbps-install)
$ESCALATION_TOOL "$PACKAGER" install -S flatpak
"$ESCALATION_TOOL" "$PACKAGER" install -S flatpak
;;
*)
printf "%b\n" "${RED}Unsupported package manager: $PACKAGER${RC}"
printf "%b\n" "${RED}Unsupported package manager: "$PACKAGER"${RC}"
exit 1
;;
esac
printf "%b\n" "Adding Flathub remote..."
$ESCALATION_TOOL flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
"$ESCALATION_TOOL" flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
else
if command -v flatpak >/dev/null 2>&1; then
if ! flatpak remotes | grep -q "flathub"; then
Expand All @@ -55,7 +55,7 @@ setup_flatpak() {
case "$add_remote" in
[Yy]*)
printf "%b\n" "Adding Flathub remote..."
$ESCALATION_TOOL flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
"$ESCALATION_TOOL" flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
;;
esac
else
Expand All @@ -73,14 +73,14 @@ setup_flatpak() {
printf "%b\n" "${YELLOW}Detected GNOME desktop environment. Would you like to install GNOME Software plugin for Flatpak? (y/n)${RC}"
read install_gnome
if [ "$install_gnome" = "y" ] || [ "$install_gnome" = "Y" ]; then
$ESCALATION_TOOL "$PACKAGER" install -y gnome-software-plugin-flatpak
"$ESCALATION_TOOL" "$PACKAGER" install -y gnome-software-plugin-flatpak
fi
# Useful for Debian KDE spin as well
elif [ "$DE" = "KDE" ]; then
printf "%b\n" "${YELLOW}Detected KDE desktop environment. Would you like to install KDE Plasma Discover backend for Flatpak? (y/n)${RC}"
read install_kde
if [ "$install_kde" = "y" ] || [ "$install_kde" = "Y" ]; then
$ESCALATION_TOOL "$PACKAGER" install -y plasma-discover-backend-flatpak
"$ESCALATION_TOOL" "$PACKAGER" install -y plasma-discover-backend-flatpak
fi
fi
fi
Expand Down
26 changes: 13 additions & 13 deletions tabs/system-setup/5-samba-ssh-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ install_package() {
if ! command_exists "$PACKAGE"; then
case "$PACKAGER" in
pacman)
$ESCALATION_TOOL "$PACKAGER" -S --noconfirm "$PACKAGE"
"$ESCALATION_TOOL" "$PACKAGER" -S --noconfirm "$PACKAGE"
;;
*)
$ESCALATION_TOOL "$PACKAGER" install -y "$PACKAGE"
"$ESCALATION_TOOL" "$PACKAGER" install -y "$PACKAGE"
;;
esac
else
Expand Down Expand Up @@ -41,8 +41,8 @@ setup_ssh() {
esac

# Enable and start the appropriate SSH service
$ESCALATION_TOOL systemctl enable "$SSH_SERVICE"
$ESCALATION_TOOL systemctl start "$SSH_SERVICE"
"$ESCALATION_TOOL" systemctl enable "$SSH_SERVICE"
"$ESCALATION_TOOL" systemctl start "$SSH_SERVICE"

# Get the local IP address
LOCAL_IP=$(ip -4 addr show | awk '/inet / {print $2}' | tail -n 1)
Expand Down Expand Up @@ -82,8 +82,8 @@ setup_samba() {
SHARED_DIR=${SHARED_DIR:-/srv/samba/share}

# Create the shared directory if it doesn't exist
$ESCALATION_TOOL mkdir -p "$SHARED_DIR"
$ESCALATION_TOOL chmod -R 0777 "$SHARED_DIR"
"$ESCALATION_TOOL" mkdir -p "$SHARED_DIR"
"$ESCALATION_TOOL" chmod -R 0777 "$SHARED_DIR"

# Add a new Samba user
printf "Enter Samba username: "
Expand All @@ -109,10 +109,10 @@ setup_samba() {
done

# Add the user and set the password
$ESCALATION_TOOL smbpasswd -a "$SAMBA_USER"
"$ESCALATION_TOOL" smbpasswd -a "$SAMBA_USER"

# Configure Samba settings
$ESCALATION_TOOL sh -c "cat > $SAMBA_CONFIG" <<EOL
"$ESCALATION_TOOL" sh -c "cat > $SAMBA_CONFIG" <<EOL
[global]
workgroup = WORKGROUP
server string = Samba Server
Expand All @@ -130,8 +130,8 @@ EOL
fi

# Enable and start Samba services
$ESCALATION_TOOL systemctl enable smb nmb
$ESCALATION_TOOL systemctl start smb nmb
"$ESCALATION_TOOL" systemctl enable smb nmb
"$ESCALATION_TOOL" systemctl start smb nmb

# Check if Samba is running
if systemctl is-active --quiet smb && systemctl is-active --quiet nmb; then
Expand All @@ -147,9 +147,9 @@ configure_firewall() {
printf "%b\n" "${BLUE}Configuring firewall...${RC}"

if command_exists ufw; then
$ESCALATION_TOOL ufw allow OpenSSH
$ESCALATION_TOOL ufw allow Samba
$ESCALATION_TOOL ufw enable
"$ESCALATION_TOOL" ufw allow OpenSSH
"$ESCALATION_TOOL" ufw allow Samba
"$ESCALATION_TOOL" ufw enable
printf "%b\n" "${GREEN}Firewall configured for SSH and Samba.${RC}"
else
printf "%b\n" "${YELLOW}UFW is not installed. Skipping firewall configuration.${RC}"
Expand Down
24 changes: 12 additions & 12 deletions tabs/system-setup/6-docker-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,19 @@ choose_installation() {

install_docker() {
printf "%b\n" "${YELLOW}Installing Docker...${RC}"
case $PACKAGER in
case "$PACKAGER" in
apt-get | yum)
curl -fsSL https://get.docker.com | sh
;;
zypper)
$ESCALATION_TOOL ${PACKAGER} --non-interactive install docker
$ESCALATION_TOOL systemctl enable docker
$ESCALATION_TOOL systemctl start docker
"$ESCALATION_TOOL" "$PACKAGER" --non-interactive install docker
"$ESCALATION_TOOL" systemctl enable docker
"$ESCALATION_TOOL" systemctl start docker
;;
pacman)
$ESCALATION_TOOL ${PACKAGER} -S --noconfirm docker
$ESCALATION_TOOL systemctl enable docker
$ESCALATION_TOOL systemctl start docker
"$ESCALATION_TOOL" "$PACKAGER" -S --noconfirm docker
"$ESCALATION_TOOL" systemctl enable docker
"$ESCALATION_TOOL" systemctl start docker
;;
*)
printf "${RED}Unsupported package manager. Please install Docker manually.${RC}\n"
Expand All @@ -45,16 +45,16 @@ install_docker() {

install_docker_compose() {
printf "%b\n" "${YELLOW}Installing Docker Compose...${RC}"
case $PACKAGER in
case "$PACKAGER" in
apt-get | yum)
$ESCALATION_TOOL ${PACKAGER} update
$ESCALATION_TOOL ${PACKAGER} install -y docker-compose-plugin
"$ESCALATION_TOOL" "$PACKAGER" update
"$ESCALATION_TOOL" "$PACKAGER" install -y docker-compose-plugin
;;
zypper)
$ESCALATION_TOOL ${PACKAGER} --non-interactive install docker-compose
"$ESCALATION_TOOL" "$PACKAGER" --non-interactive install docker-compose
;;
pacman)
$ESCALATION_TOOL ${PACKAGER} -S --noconfirm docker-compose
"$ESCALATION_TOOL" "$PACKAGER" -S --noconfirm docker-compose
;;
*)
printf "${RED}Unsupported package manager. Please install Docker Compose manually.${RC}\n"
Expand Down
10 changes: 5 additions & 5 deletions tabs/system-setup/9-auto-mount.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ create_mount_point() {
read -r mount_point
if [ ! -d "$mount_point" ]; then
printf "%b\n" "${YELLOW}Mount point doesn't exist. Creating it..${RC}."
$ESCALATION_TOOL mkdir -p "$mount_point"
"$ESCALATION_TOOL" mkdir -p "$mount_point"
else
printf "%b\n" "${RED}Mount point already exists.${RC}"
fi
Expand All @@ -51,15 +51,15 @@ create_mount_point() {
# Function to update /etc/fstab with a comment on the first line and the actual entry on the second line
update_fstab() {
printf "%b\n" "${YELLOW}Adding entry to /etc/fstab...${RC}"
$ESCALATION_TOOL cp /etc/fstab /etc/fstab.bak # Backup fstab
"$ESCALATION_TOOL" cp /etc/fstab /etc/fstab.bak # Backup fstab

# Prepare the comment and the fstab entry
comment="# Mount for /dev/$NAME"
fstab_entry="UUID=$UUID $mount_point $FSTYPE defaults 0 2"

# Append the comment and the entry to /etc/fstab
printf "%b\n" "$comment" | $ESCALATION_TOOL tee -a /etc/fstab > /dev/null
printf "%b\n" "$fstab_entry" | $ESCALATION_TOOL tee -a /etc/fstab > /dev/null
printf "%b\n" "$comment" | "$ESCALATION_TOOL" tee -a /etc/fstab > /dev/null
printf "%b\n" "$fstab_entry" | "$ESCALATION_TOOL" tee -a /etc/fstab > /dev/null
printf "%b\n" "" | "$ESCALATION_TOOL" tee -a /etc/fstab > /dev/null

printf "%b\n" "Entry added to /etc/fstab:"
Expand All @@ -71,7 +71,7 @@ update_fstab() {
# Function to mount the drive
mount_drive() {
printf "%b\n" "Mounting the drive..."
$ESCALATION_TOOL mount -a
"$ESCALATION_TOOL" mount -a
if mount | grep "$mount_point" > /dev/null; then
printf "%b\n" "${GREEN}Drive mounted successfully at $mount_point${RC}."
else
Expand Down
6 changes: 3 additions & 3 deletions tabs/system-setup/arch/paru-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ installDepend() {
pacman)
if ! command_exists paru; then
printf "%b\n" "${YELLOW}Installing paru as AUR helper...${RC}"
$ESCALATION_TOOL "$PACKAGER" -S --needed --noconfirm base-devel
cd /opt && $ESCALATION_TOOL git clone https://aur.archlinux.org/paru.git && $ESCALATION_TOOL chown -R "$USER": ./paru
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm base-devel
cd /opt && "$ESCALATION_TOOL" git clone https://aur.archlinux.org/paru.git && "$ESCALATION_TOOL" chown -R "$USER": ./paru
cd paru && makepkg --noconfirm -si
printf "%b\n" "${GREEN}Paru installed${RC}"
else
printf "%b\n" "${GREEN}Paru already installed${RC}"
fi
;;
*)
printf "%b\n" "${RED}Unsupported package manager: $PACKAGER${RC}"
printf "%b\n" "${RED}Unsupported package manager: "$PACKAGER"${RC}"
;;
esac
}
Expand Down
6 changes: 3 additions & 3 deletions tabs/system-setup/arch/yay-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ installDepend() {
pacman)
if ! command_exists yay; then
printf "%b\n" "${YELLOW}Installing yay as AUR helper...${RC}"
$ESCALATION_TOOL "$PACKAGER" -S --needed --noconfirm base-devel
cd /opt && $ESCALATION_TOOL git clone https://aur.archlinux.org/yay-bin.git && $ESCALATION_TOOL chown -R "$USER": ./yay-bin
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm base-devel
cd /opt && "$ESCALATION_TOOL" git clone https://aur.archlinux.org/yay-bin.git && "$ESCALATION_TOOL" chown -R "$USER": ./yay-bin
cd yay-bin && makepkg --noconfirm -si
printf "%b\n" "${GREEN}Yay installed${RC}"
else
printf "%b\n" "${GREEN}Aur helper already installed${RC}"
fi
;;
*)
printf "%b\n" "${RED}Unsupported package manager: $PACKAGER${RC}"
printf "%b\n" "${RED}Unsupported package manager: "$PACKAGER"${RC}"
;;
esac
}
Expand Down
10 changes: 5 additions & 5 deletions tabs/system-setup/fedora/configure-dnf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
. ../../common-script.sh

configureDNF() {
case $PACKAGER in
case "$PACKAGER" in
dnf)
printf "%b\n" "${YELLOW}Configuring DNF...${RC}"
$ESCALATION_TOOL sed -i '/^max_parallel_downloads=/c\max_parallel_downloads=10' /etc/dnf/dnf.conf || echo 'max_parallel_downloads=10' >> /etc/dnf/dnf.conf
echo "fastestmirror=True" | $ESCALATION_TOOL tee -a /etc/dnf/dnf.conf > /dev/null
echo "defaultyes=True" | $ESCALATION_TOOL tee -a /etc/dnf/dnf.conf > /dev/null
$ESCALATION_TOOL "$PACKAGER" -y install dnf-plugins-core
"$ESCALATION_TOOL" sed -i '/^max_parallel_downloads=/c\max_parallel_downloads=10' /etc/dnf/dnf.conf || echo 'max_parallel_downloads=10' >> /etc/dnf/dnf.conf
echo "fastestmirror=True" | "$ESCALATION_TOOL" tee -a /etc/dnf/dnf.conf > /dev/null
echo "defaultyes=True" | "$ESCALATION_TOOL" tee -a /etc/dnf/dnf.conf > /dev/null
"$ESCALATION_TOOL" "$PACKAGER" -y install dnf-plugins-core
printf "%b\n" "${GREEN}DNF Configured Succesfully...${RC}"
;;
*)
Expand Down
8 changes: 4 additions & 4 deletions tabs/system-setup/fedora/multimedia-codecs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
. ../../common-script.sh

multimedia() {
case $PACKAGER in
case "$PACKAGER" in
dnf)
if [ -e /etc/yum.repos.d/rpmfusion-free.repo ] && [ -e /etc/yum.repos.d/rpmfusion-nonfree.repo ]; then
printf "%b\n" "${YELLOW}Installing Multimedia Codecs...${RC}"
$ESCALATION_TOOL "$PACKAGER" swap ffmpeg-free ffmpeg --allowerasing -y
$ESCALATION_TOOL "$PACKAGER" update @multimedia --setopt="install_weak_deps=False" --exclude=PackageKit-gstreamer-plugin -y
$ESCALATION_TOOL "$PACKAGER" update @sound-and-video -y
"$ESCALATION_TOOL" "$PACKAGER" swap ffmpeg-free ffmpeg --allowerasing -y
"$ESCALATION_TOOL" "$PACKAGER" update @multimedia --setopt="install_weak_deps=False" --exclude=PackageKit-gstreamer-plugin -y
"$ESCALATION_TOOL" "$PACKAGER" update @sound-and-video -y
printf "%b\n" "${GREEN}Multimedia Codecs Installed...${RC}"
else
printf "%b\n" "${RED}RPM Fusion repositories not found. Please set up RPM Fusion first!${RC}"
Expand Down
6 changes: 3 additions & 3 deletions tabs/system-setup/fedora/nvidia-proprietary-driver-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ checkRepo() {
printf "%b\n" "${YELLOW}Nvidia non-free repository is not enabled. Enabling now...${RC}"

# Enable the repository
$ESCALATION_TOOL dnf config-manager --set-enabled "$REPO_ID"
"$ESCALATION_TOOL" dnf config-manager --set-enabled "$REPO_ID"

# Refreshing repository list
$ESCALATION_TOOL dnf makecache
"$ESCALATION_TOOL" dnf makecache

# Verify if the repository is enabled
if [ $(dnf repolist enabled 2>/dev/null | grep "$REPO_ID" | wc -l) -gt 0 ]; then
Expand Down Expand Up @@ -49,7 +49,7 @@ installDriver() {
fi

# NOTE:: Installing graphics driver.
$ESCALATION_TOOL dnf install akmod-nvidia xorg-x11-drv-nvidia-cuda -y
"$ESCALATION_TOOL" dnf install akmod-nvidia xorg-x11-drv-nvidia-cuda -y
printf "%b\n" "${YELLOW}Building the drivers may take upto 5 minutes. Please don't kill the script!\n If the build failed try running the script again, select \"Remove Nvidia Drivers\" and reboot the system, then try installing drivers again.${RC}"

for i in $(seq 1 5); do
Expand Down
4 changes: 2 additions & 2 deletions tabs/system-setup/fedora/virtualization.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

# Install virtualization tools to enable virtual machines
configureVirtualization() {
case $PACKAGER in
case "$PACKAGER" in
dnf)
printf "%b\n" ${YELLOW}"Installing virtualization tools...${RC}"
$ESCALATION_TOOL "$PACKAGER" install -y @virtualization
"$ESCALATION_TOOL" "$PACKAGER" install -y @virtualization
printf "%b\n" "${GREEN}Installed virtualization tools...${RC}"
;;
*)
Expand Down
Loading

0 comments on commit d0b7601

Please sign in to comment.