Fixes all BASHISMS

This commit is contained in:
Chris Titus 2024-09-19 13:05:36 -05:00
parent fb883522aa
commit d0b76012df
27 changed files with 149 additions and 147 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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
@ -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)
@ -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: "
@ -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
@ -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
@ -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}"

View File

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

View File

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

View File

@ -7,8 +7,8 @@ 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
@ -16,7 +16,7 @@ installDepend() {
fi
;;
*)
printf "%b\n" "${RED}Unsupported package manager: $PACKAGER${RC}"
printf "%b\n" "${RED}Unsupported package manager: "$PACKAGER"${RC}"
;;
esac
}

View File

@ -7,8 +7,8 @@ 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
@ -16,7 +16,7 @@ installDepend() {
fi
;;
*)
printf "%b\n" "${RED}Unsupported package manager: $PACKAGER${RC}"
printf "%b\n" "${RED}Unsupported package manager: "$PACKAGER"${RC}"
;;
esac
}

View File

@ -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}"
;;
*)

View File

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

View File

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

View File

@ -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}"
;;
*)

View File

@ -26,7 +26,7 @@ cleanup_system() {
"$ESCALATION_TOOL" "$PACKAGER" -Rns "$(pacman -Qtdq)" --noconfirm
;;
*)
printf "%b\n" "${RED}Unsupported package manager: $PACKAGER${RC}"
printf "%b\n" "${RED}Unsupported package manager: "$PACKAGER"${RC}"
return 1
;;
esac

View File

@ -56,7 +56,7 @@ fastUpdate() {
"$ESCALATION_TOOL" "$PACKAGER" -Syu-
;;
*)
printf "%b\n" "${RED}Unsupported package manager: $PACKAGER${RC}"
printf "%b\n" "${RED}Unsupported package manager: "$PACKAGER"${RC}"
exit 1
;;
esac
@ -85,7 +85,7 @@ updateSystem() {
"$ESCALATION_TOOL" "$PACKAGER" -Syu
;;
*)
printf "%b\n" "${RED}Unsupported package manager: ${PACKAGER}${RC}"
printf "%b\n" "${RED}Unsupported package manager: "$PACKAGER"${RC}"
exit 1
;;
esac

View File

@ -44,9 +44,9 @@ configure_lightdm() {
printf "Enter username for LightDM autologin: "
read -r user
$ESCALATION_TOOL "printf '[Seat:*]' > /etc/lightdm/lightdm.conf.d/50-autologin.conf"
$ESCALATION_TOOL "printf 'autologin-user=$user' >> /etc/lightdm/lightdm.conf.d/50-autologin.conf"
$ESCALATION_TOOL "printf 'autologin-user-timeout=0' >> /etc/lightdm/lightdm.conf.d/50-autologin.conf"
"$ESCALATION_TOOL" "printf '[Seat:*]' > /etc/lightdm/lightdm.conf.d/50-autologin.conf"
"$ESCALATION_TOOL" "printf 'autologin-user=$user' >> /etc/lightdm/lightdm.conf.d/50-autologin.conf"
"$ESCALATION_TOOL" "printf 'autologin-user-timeout=0' >> /etc/lightdm/lightdm.conf.d/50-autologin.conf"
printf "LightDM has been configured for autologin.\n"
}
@ -54,7 +54,7 @@ configure_lightdm() {
# Function to remove LightDM autologin
remove_lightdm_autologin() {
printf "Removing LightDM autologin configuration...\n"
$ESCALATION_TOOL rm -f /etc/lightdm/lightdm.conf.d/50-autologin.conf
"$ESCALATION_TOOL" rm -f /etc/lightdm/lightdm.conf.d/50-autologin.conf
printf "LightDM autologin configuration has been removed.\n"
}
@ -65,9 +65,9 @@ configure_gdm() {
printf "Enter username for GDM autologin: "
read -r user
$ESCALATION_TOOL "printf '[daemon]' > /etc/gdm/custom.conf"
$ESCALATION_TOOL "printf 'AutomaticLoginEnable = true' >> /etc/gdm/custom.conf"
$ESCALATION_TOOL "printf 'AutomaticLogin = $user' >> /etc/gdm/custom.conf"
"$ESCALATION_TOOL" "printf '[daemon]' > /etc/gdm/custom.conf"
"$ESCALATION_TOOL" "printf 'AutomaticLoginEnable = true' >> /etc/gdm/custom.conf"
"$ESCALATION_TOOL" "printf 'AutomaticLogin = $user' >> /etc/gdm/custom.conf"
printf "GDM has been configured for autologin.\n"
}
@ -75,8 +75,8 @@ configure_gdm() {
# Function to remove GDM autologin
remove_gdm_autologin() {
printf "Removing GDM autologin configuration...\n"
$ESCALATION_TOOL sed -i '/AutomaticLoginEnable/d' /etc/gdm/custom.conf
$ESCALATION_TOOL sed -i '/AutomaticLogin/d' /etc/gdm/custom.conf
"$ESCALATION_TOOL" sed -i '/AutomaticLoginEnable/d' /etc/gdm/custom.conf
"$ESCALATION_TOOL" sed -i '/AutomaticLogin/d' /etc/gdm/custom.conf
printf "GDM autologin configuration has been removed.\n"
}
@ -88,9 +88,9 @@ configure_sddm() {
read -r user
list_sessions # Show session options
$ESCALATION_TOOL "printf '[Autologin]' > /etc/sddm.conf"
$ESCALATION_TOOL "printf 'User=$user' >> /etc/sddm.conf"
$ESCALATION_TOOL "printf 'Session=$session' >> /etc/sddm.conf"
"$ESCALATION_TOOL" "printf '[Autologin]' > /etc/sddm.conf"
"$ESCALATION_TOOL" "printf 'User=$user' >> /etc/sddm.conf"
"$ESCALATION_TOOL" "printf 'Session=$session' >> /etc/sddm.conf"
printf "SDDM has been configured for autologin.\n"
}
@ -98,7 +98,7 @@ configure_sddm() {
# Function to remove SDDM autologin
remove_sddm_autologin() {
printf "Removing SDDM autologin configuration...\n"
$ESCALATION_TOOL sed -i '/\[Autologin\]/,+2d' /etc/sddm.conf
"$ESCALATION_TOOL" sed -i '/\[Autologin\]/,+2d' /etc/sddm.conf
printf "SDDM autologin configuration has been removed.\n"
}
@ -110,8 +110,8 @@ configure_lxdm() {
read -r user
list_sessions # Show session options
$ESCALATION_TOOL sed -i "s/^#.*autologin=.*$/autologin=${user}/" /etc/lxdm/lxdm.conf
$ESCALATION_TOOL sed -i "s|^#.*session=.*$|session=/usr/bin/${session}|; s|^session=.*$|session=/usr/bin/${session}|" /etc/lxdm/lxdm.conf
"$ESCALATION_TOOL" sed -i "s/^#.*autologin=.*$/autologin=${user}/" /etc/lxdm/lxdm.conf
"$ESCALATION_TOOL" sed -i "s|^#.*session=.*$|session=/usr/bin/${session}|; s|^session=.*$|session=/usr/bin/${session}|" /etc/lxdm/lxdm.conf
printf "LXDM has been configured for autologin.\n"
}
@ -119,8 +119,8 @@ configure_lxdm() {
# Function to remove LXDM autologin
remove_lxdm_autologin() {
printf "Removing LXDM autologin configuration...\n"
$ESCALATION_TOOL sed -i "s/^autologin=.*$/#autologin=/" /etc/lxdm/lxdm.conf
$ESCALATION_TOOL sed -i "s/^session=.*$/#session=/" /etc/lxdm/lxdm.conf
"$ESCALATION_TOOL" sed -i "s/^autologin=.*$/#autologin=/" /etc/lxdm/lxdm.conf
"$ESCALATION_TOOL" sed -i "s/^session=.*$/#session=/" /etc/lxdm/lxdm.conf
printf "LXDM autologin configuration has been removed.\n"
}

View File

@ -13,7 +13,7 @@ usage() {
list_devices() {
printf "%b\n" "${YELLOW} Available devices and partitions: ${RC}"
printf "\n"
$ESCALATION_TOOL lsblk -o NAME,FSTYPE,SIZE,MOUNTPOINT,LABEL
"$ESCALATION_TOOL" lsblk -o NAME,FSTYPE,SIZE,MOUNTPOINT,LABEL
printf "\n"
}
@ -164,13 +164,13 @@ write_iso(){
# Display progress and create the bootable USB drive
printf "%b\n" "${YELLOW}Creating bootable USB drive...${RC}"
if ! $ESCALATION_TOOL dd if="$ISO_PATH" of="$USB_DEVICE" bs=4M status=progress oflag=sync; then
if ! "$ESCALATION_TOOL" dd if="$ISO_PATH" of="$USB_DEVICE" bs=4M status=progress oflag=sync; then
printf "%b\n" "${RED}Failed to create bootable USB drive${RC}"
exit 1
fi
# Sync to ensure all data is written
if ! $ESCALATION_TOOL sync; then
if ! "$ESCALATION_TOOL" sync; then
printf "%b\n" "${RED}Failed to sync data${RC}"
exit 1
fi
@ -179,10 +179,10 @@ write_iso(){
# Eject the USB device
printf "%b\n" "${YELLOW}Ejecting ${USB_DEVICE}...${RC}"
if ! $ESCALATION_TOOL umount "${USB_DEVICE}"* 2>/dev/null; then
if ! "$ESCALATION_TOOL" umount "${USB_DEVICE}"* 2>/dev/null; then
printf "%b\n" "${RED}Failed to unmount ${USB_DEVICE}${RC}"
fi
if ! $ESCALATION_TOOL eject "$USB_DEVICE"; then
if ! "$ESCALATION_TOOL" eject "$USB_DEVICE"; then
printf "%b\n" "${RED}Failed to eject ${USB_DEVICE}${RC}"
fi

View File

@ -6,18 +6,18 @@ printf "%b\n" "${YELLOW}Ensuring OpenSSL is installed...${RC}"
# Install OpenSSL
if ! command_exists openssl; then
case $PACKAGER in
case "$PACKAGER" in
pacman)
$ESCALATION_TOOL ${PACKAGER} -Syu --noconfirm openssl
"$ESCALATION_TOOL" "$PACKAGER" -Syu --noconfirm openssl
;;
apt-get)
$ESCALATION_TOOL ${PACKAGER} update && $ESCALATION_TOOL ${PACKAGER} install -y openssl
"$ESCALATION_TOOL" "$PACKAGER" update && "$ESCALATION_TOOL" "$PACKAGER" install -y openssl
;;
dnf)
$ESCALATION_TOOL ${PACKAGER} install -y openssl
"$ESCALATION_TOOL" "$PACKAGER" install -y openssl
;;
zypper)
$ESCALATION_TOOL ${PACKAGER} install openssl
"$ESCALATION_TOOL" "$PACKAGER" install openssl
;;
*)
printf "%b\n" "${RED}Your Linux distribution is not supported by this script.${RC}"

View File

@ -15,12 +15,12 @@ installAutoCpufreq() {
# Install git if not already installed
if ! command_exists git; then
printf "%b\n" "${YELLOW}git not found. Installing git...${RC}"
case ${PACKAGER} in
case "$PACKAGER" in
pacman)
$ESCALATION_TOOL ${PACKAGER} -S --needed --noconfirm git
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm git
;;
*)
$ESCALATION_TOOL ${PACKAGER} install -y git
"$ESCALATION_TOOL" "$PACKAGER" install -y git
;;
esac
fi
@ -31,11 +31,11 @@ installAutoCpufreq() {
git clone https://github.com/AdnanHodzic/auto-cpufreq.git
fi
case ${PACKAGER} in
case "$PACKAGER" in
*)
cd auto-cpufreq
printf "%b\n" "${YELLOW}Running auto-cpufreq installer...${RC}"
$ESCALATION_TOOL ./auto-cpufreq-installer
"$ESCALATION_TOOL" ./auto-cpufreq-installer
;;
esac
cd ..
@ -49,10 +49,10 @@ configureAutoCpufreq() {
# Check if the system has a battery to determine if it's a laptop
if [ -d /sys/class/power_supply/BAT0 ]; then
printf "%b\n" "${GREEN}System detected as laptop. Updating auto-cpufreq for laptop...${RC}"
$ESCALATION_TOOL auto-cpufreq --force powersave
"$ESCALATION_TOOL" auto-cpufreq --force powersave
else
printf "%b\n" "${GREEN}System detected as desktop. Updating auto-cpufreq for desktop...${RC}"
$ESCALATION_TOOL auto-cpufreq --force performance
"$ESCALATION_TOOL" auto-cpufreq --force performance
fi
else
printf "%b\n" "${RED}auto-cpufreq is not installed, skipping configuration.${RC}"
@ -64,7 +64,7 @@ removeAutoCpufreqTweak() {
if command_exists auto-cpufreq; then
printf "%b\n" "${YELLOW}Resetting auto-cpufreq configuration...${RC}"
$ESCALATION_TOOL auto-cpufreq --force reset
"$ESCALATION_TOOL" auto-cpufreq --force reset
else
printf "%b\n" "${RED}auto-cpufreq is not installed, skipping removal.${RC}"
fi

View File

@ -92,11 +92,11 @@ add_service() {
printf "\n"
printf "[Install]\n"
printf "WantedBy=multi-user.target\n"
} | $ESCALATION_TOOL tee "$SERVICE_FILE" > /dev/null
} | "$ESCALATION_TOOL" tee "$SERVICE_FILE" > /dev/null
# Set permissions and reload systemd
$ESCALATION_TOOL chmod 644 "$SERVICE_FILE"
$ESCALATION_TOOL systemctl daemon-reload
"$ESCALATION_TOOL" chmod 644 "$SERVICE_FILE"
"$ESCALATION_TOOL" systemctl daemon-reload
printf "Service $SERVICE_NAME has been created and is ready to be started.\n"
# Optionally, enable and start the service
@ -121,12 +121,12 @@ remove_service() {
if [ -f "$SERVICE_FILE" ]; then
printf "Stopping and disabling the service...\n"
$ESCALATION_TOOL systemctl stop "$SERVICE_NAME"
$ESCALATION_TOOL systemctl disable "$SERVICE_NAME"
"$ESCALATION_TOOL" systemctl stop "$SERVICE_NAME"
"$ESCALATION_TOOL" systemctl disable "$SERVICE_NAME"
printf "Removing the service file...\n"
$ESCALATION_TOOL rm -f "$SERVICE_FILE"
$ESCALATION_TOOL systemctl daemon-reload
"$ESCALATION_TOOL" rm -f "$SERVICE_FILE"
"$ESCALATION_TOOL" systemctl daemon-reload
printf "Service $SERVICE_NAME has been removed.\n"
else
printf "Service $SERVICE_NAME does not exist.\n"
@ -139,7 +139,7 @@ start_service() {
printf "Enter the name of the service to start (e.g., my_service):\n"
read -r SERVICE_NAME
if $ESCALATION_TOOL systemctl start "$SERVICE_NAME"; then
if "$ESCALATION_TOOL" systemctl start "$SERVICE_NAME"; then
printf "Service $SERVICE_NAME has been started.\n"
else
printf "Failed to start service: $SERVICE_NAME.\n"
@ -152,7 +152,7 @@ stop_service() {
printf "Enter the name of the service to stop (e.g., my_service):\n"
read -r SERVICE_NAME
if $ESCALATION_TOOL systemctl stop "$SERVICE_NAME"; then
if "$ESCALATION_TOOL" systemctl stop "$SERVICE_NAME"; then
printf "Service $SERVICE_NAME has been stopped.\n"
else
printf "Failed to stop service: $SERVICE_NAME.\n"
@ -165,7 +165,7 @@ enable_service() {
printf "Enter the name of the service to enable (e.g., my_service):\n"
read -r SERVICE_NAME
if $ESCALATION_TOOL systemctl enable "$SERVICE_NAME"; then
if "$ESCALATION_TOOL" systemctl enable "$SERVICE_NAME"; then
printf "Service $SERVICE_NAME has been enabled.\n"
else
printf "Failed to enable service: $SERVICE_NAME.\n"
@ -178,7 +178,7 @@ disable_service() {
printf "Enter the name of the service to disable (e.g., my_service):\n"
read -r SERVICE_NAME
if $ESCALATION_TOOL systemctl disable "$SERVICE_NAME"; then
if "$ESCALATION_TOOL" systemctl disable "$SERVICE_NAME"; then
printf "Service $SERVICE_NAME has been enabled.\n"
else
printf "Failed to enable service: $SERVICE_NAME.\n"
@ -228,8 +228,8 @@ create_service_from_external() {
"$ESCALATION_TOOL" cp "$SERVICE_FILE" "$SYSTEMD_SERVICE_FILE"
# Set permissions and reload systemd
$ESCALATION_TOOL chmod 644 "$SYSTEMD_SERVICE_FILE"
$ESCALATION_TOOL systemctl daemon-reload
"$ESCALATION_TOOL" chmod 644 "$SYSTEMD_SERVICE_FILE"
"$ESCALATION_TOOL" systemctl daemon-reload
printf "Service $SERVICE_NAME has been created and is ready to be started.\n"
# Optionally, enable and start the service
@ -237,8 +237,8 @@ create_service_from_external() {
read -r START_ENABLE
if [ "$START_ENABLE" = "y" ]; then
$ESCALATION_TOOL systemctl start "$SERVICE_NAME"
$ESCALATION_TOOL systemctl enable "$SERVICE_NAME"
"$ESCALATION_TOOL" systemctl start "$SERVICE_NAME"
"$ESCALATION_TOOL" systemctl enable "$SERVICE_NAME"
printf "Service $SERVICE_NAME has been started and enabled.\n"
else
printf "Service $SERVICE_NAME has been created but not started.\n"

View File

@ -59,11 +59,11 @@ disable_password_auth() {
read -r host_alias
printf "%b\n"
ssh $host_alias "
$ESCALATION_TOOL -S sed -i 's/^#PasswordAuthentication yes/PasswordAuthentication no/' /etc/ssh/sshd_config &&
$ESCALATION_TOOL -S sed -i 's/^PasswordAuthentication yes/PasswordAuthentication no/' /etc/ssh/sshd_config &&
$ESCALATION_TOOL -S sed -i 's/^#PubkeyAuthentication no/PubkeyAuthentication yes/' /etc/ssh/sshd_config &&
$ESCALATION_TOOL -S sed -i 's/^PubkeyAuthentication no/PubkeyAuthentication yes/' /etc/ssh/sshd_config &&
$ESCALATION_TOOL -S systemctl restart sshd
"$ESCALATION_TOOL" -S sed -i 's/^#PasswordAuthentication yes/PasswordAuthentication no/' /etc/ssh/sshd_config &&
"$ESCALATION_TOOL" -S sed -i 's/^PasswordAuthentication yes/PasswordAuthentication no/' /etc/ssh/sshd_config &&
"$ESCALATION_TOOL" -S sed -i 's/^#PubkeyAuthentication no/PubkeyAuthentication yes/' /etc/ssh/sshd_config &&
"$ESCALATION_TOOL" -S sed -i 's/^PubkeyAuthentication no/PubkeyAuthentication yes/' /etc/ssh/sshd_config &&
"$ESCALATION_TOOL" -S systemctl restart sshd
"
printf "%b\n" "PasswordAuthentication set to no and PubkeyAuthentication set to yes."
}
@ -74,11 +74,11 @@ enable_password_auth() {
read -r host_alias
printf "\n"
ssh $host_alias "
$ESCALATION_TOOL -S sed -i 's/^#PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config &&
$ESCALATION_TOOL -S sed -i 's/^PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config &&
$ESCALATION_TOOL -S sed -i 's/^#PubkeyAuthentication yes/PubkeyAuthentication no/' /etc/ssh/sshd_config &&
$ESCALATION_TOOL -S sed -i 's/^PubkeyAuthentication yes/PubkeyAuthentication no/' /etc/ssh/sshd_config &&
$ESCALATION_TOOL -S systemctl restart sshd
"$ESCALATION_TOOL" -S sed -i 's/^#PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config &&
"$ESCALATION_TOOL" -S sed -i 's/^PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config &&
"$ESCALATION_TOOL" -S sed -i 's/^#PubkeyAuthentication yes/PubkeyAuthentication no/' /etc/ssh/sshd_config &&
"$ESCALATION_TOOL" -S sed -i 's/^PubkeyAuthentication yes/PubkeyAuthentication no/' /etc/ssh/sshd_config &&
"$ESCALATION_TOOL" -S systemctl restart sshd
"
printf "%b\n" "PasswordAuthentication set to yes and PubkeyAuthentication set to no."
}

View File

@ -8,12 +8,12 @@ install_timeshift() {
printf "%b\n" "${YELLOW}Checking if Timeshift is installed...${RC}"
if ! command_exists timeshift; then
case ${PACKAGER} in
case "$PACKAGER" in
pacman)
$ESCALATION_TOOL "${PACKAGER}" -S --noconfirm timeshift
"$ESCALATION_TOOL" "${PACKAGER}" -S --noconfirm timeshift
;;
*)
$ESCALATION_TOOL "${PACKAGER}" install -y timeshift
"$ESCALATION_TOOL" "${PACKAGER}" install -y timeshift
;;
esac
else
@ -37,13 +37,13 @@ display_menu() {
# Function to list snapshots
list_snapshots() {
printf "%b\n" "${CYAN}Listing snapshots...${RC}"
$ESCALATION_TOOL timeshift --list-snapshots
"$ESCALATION_TOOL" timeshift --list-snapshots
}
# Function to list devices
list_devices() {
printf "%b\n" "${CYAN}Listing available devices...${RC}"
$ESCALATION_TOOL timeshift --list-devices
"$ESCALATION_TOOL" timeshift --list-devices
}
# Function to create a new snapshot
@ -55,13 +55,13 @@ create_snapshot() {
if [ -z "$COMMENT" ] && [ -z "$TAG" ]; then
printf "%b\n" "${CYAN}Creating snapshot with no comment or tag...${RC}"
$ESCALATION_TOOL timeshift --create
"$ESCALATION_TOOL" timeshift --create
elif [ -z "$TAG" ]; then
printf "%b\n" "${CYAN}Creating snapshot with no tag...${RC}"
$ESCALATION_TOOL timeshift --create --comments "$COMMENT"
"$ESCALATION_TOOL" timeshift --create --comments "$COMMENT"
else
printf "%b\n" "${CYAN}Creating snapshot with tag: $TAG...${RC}"
$ESCALATION_TOOL timeshift --create --comments "$COMMENT" --tags "$TAG"
"$ESCALATION_TOOL" timeshift --create --comments "$COMMENT" --tags "$TAG"
fi
if [ $? -eq 0 ]; then
@ -83,11 +83,11 @@ restore_snapshot() {
read -r SKIP_GRUB
if [ "$SKIP_GRUB" = "yes" ]; then
$ESCALATION_TOOL timeshift --restore --snapshot "$SNAPSHOT" --target-device "$TARGET_DEVICE" --skip-grub --yes
"$ESCALATION_TOOL" timeshift --restore --snapshot "$SNAPSHOT" --target-device "$TARGET_DEVICE" --skip-grub --yes
else
printf "%b\n" "${CYAN}Enter GRUB device (e.g., /dev/sda): ${RC}"
read -r GRUB_DEVICE
$ESCALATION_TOOL timeshift --restore --snapshot "$SNAPSHOT" --target-device "$TARGET_DEVICE" --grub-device "$GRUB_DEVICE" --yes
"$ESCALATION_TOOL" timeshift --restore --snapshot "$SNAPSHOT" --target-device "$TARGET_DEVICE" --grub-device "$GRUB_DEVICE" --yes
fi
if [ $? -eq 0 ]; then
@ -105,7 +105,7 @@ delete_snapshot() {
read -r SNAPSHOT
printf "%b\n" "${YELLOW}Deleting snapshot $SNAPSHOT...${RC}"
$ESCALATION_TOOL timeshift --delete --snapshot "$SNAPSHOT" --yes
"$ESCALATION_TOOL" timeshift --delete --snapshot "$SNAPSHOT" --yes
if [ $? -eq 0 ]; then
printf "%b\n" "${GREEN}Snapshot deleted successfully.${RC}"
@ -122,7 +122,7 @@ delete_all_snapshots() {
if [ "$CONFIRMATION" = "yes" ]; then
printf "%b\n" "${CYAN}Deleting all snapshots...${RC}"
$ESCALATION_TOOL timeshift --delete-all --yes
"$ESCALATION_TOOL" timeshift --delete-all --yes
if [ $? -eq 0 ]; then
printf "%b\n" "${GREEN}All snapshots deleted successfully.${RC}"
else

View File

@ -18,7 +18,8 @@ available_groups=$(cut -d: -f1 /etc/group | sort | tr '\n' ' ')
printf "%b\n" "${YELLOW}Available groups:${RC} $available_groups"
printf "%b\n" "${YELLOW}=================${RC}"
read -p "Enter the groups you want to add user $username to (space-separated): " groups
printf "%b\n" "${YELLOW}Enter the groups you want to add user $username to (space-separated):${RC} "
read -r groups
checkEmpty "$groups" || exit 1
checkGroupAvailabe "$groups" "$available_groups" || exit 1

View File

@ -18,7 +18,7 @@ fi
password=$(promptPassword) || exit 1
$ESCALATION_TOOL useradd -m "$username" -g users -s /bin/bash
echo "$username:$password" | $ESCALATION_TOOL chpasswd
echo "$username:$password" | "$ESCALATION_TOOL" chpasswd
printf "%b\n" "${GREEN}User $username created successfully${RC}"
printf "%b\n" "${GREEN}To add additional groups use Add User To Groups${RC}"

View File

@ -14,7 +14,7 @@ printf "Are you sure you want to change password for $username? [Y/N]: "
read -r confirm
confirmAction || exit 1
echo "$username:$password" | $ESCALATION_TOOL chpasswd
echo "$username:$password" | "$ESCALATION_TOOL" chpasswd
printf "%b\n" "${GREEN}Password changed successfully${RC}"
checkEnv

View File

@ -13,7 +13,8 @@ user_groups=$(groups "$username" | cut -d: -f2 | sort | tr '\n' ' ')
printf "%b\n" "${YELLOW}Groups user $username is in:${RC} $user_groups"
printf "%b\n" "${YELLOW}=================${RC}"
read -p "Enter the groups you want to remove user from $username (space-separated): " groups
printf "%b\n" "${YELLOW}Enter the groups you want to remove user $username from (space-separated):${RC} "
read -r groups
checkEmpty "$groups" || exit 1
checkGroupAvailabe "$groups" "$user_groups" || exit 1