Skip to content

Commit

Permalink
Refactor remaining variables
Browse files Browse the repository at this point in the history
  • Loading branch information
jeevithakannan2 committed Sep 17, 2024
1 parent 6237d1e commit 100fc58
Show file tree
Hide file tree
Showing 16 changed files with 61 additions and 59 deletions.
6 changes: 3 additions & 3 deletions tabs/applications-setup/alacritty-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
setupAlacritty() {
echo "Install Alacritty if not already installed..."
if ! command_exists alacritty; then
case ${PACKAGER} in
case "$PACKAGER" in
pacman)
$ESCALATION_TOOL ${PACKAGER} -S --needed --noconfirm alacritty
$ESCALATION_TOOL "$PACKAGER" -S --needed --noconfirm alacritty
;;
*)
$ESCALATION_TOOL ${PACKAGER} install -y alacritty
$ESCALATION_TOOL "$PACKAGER" install -y alacritty
;;
esac
else
Expand Down
6 changes: 3 additions & 3 deletions tabs/applications-setup/fastfetch-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
setupFastfetch() {
echo "Installing Fastfetch if not already installed..."
if ! command_exists fastfetch; then
case ${PACKAGER} in
case "$PACKAGER" in
pacman)
$ESCALATION_TOOL "${PACKAGER}" -S --needed --noconfirm fastfetch
$ESCALATION_TOOL "$PACKAGER" -S --needed --noconfirm fastfetch
;;
*)
$ESCALATION_TOOL "${PACKAGER}" install -y fastfetch
$ESCALATION_TOOL "$PACKAGER" install -y fastfetch
;;
esac
else
Expand Down
6 changes: 3 additions & 3 deletions tabs/applications-setup/kitty-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
setupKitty() {
echo "Install Kitty if not already installed..."
if ! command_exists kitty; then
case ${PACKAGER} in
case "$PACKAGER" in
pacman)
$ESCALATION_TOOL "${PACKAGER}" -S --needed --noconfirm kitty
$ESCALATION_TOOL "$PACKAGER" -S --needed --noconfirm kitty
;;
*)
$ESCALATION_TOOL "${PACKAGER}" install -y kitty
$ESCALATION_TOOL "$PACKAGER" install -y kitty
;;
esac
else
Expand Down
2 changes: 1 addition & 1 deletion tabs/common-script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ checkPackageManager() {
fi
done

if [ -z "${PACKAGER}" ]; then
if [ -z "$PACKAGER" ]; then
printf "%b\n" "${RED}Can't find a supported package manager${RC}"
exit 1
fi
Expand Down
6 changes: 3 additions & 3 deletions tabs/security/firewall-baselines.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
installPkg() {
echo "Install UFW if not already installed..."
if ! command_exists ufw; then
case ${PACKAGER} in
case "$PACKAGER" in
pacman)
$ESCALATION_TOOL "${PACKAGER}" -S --needed --noconfirm ufw
$ESCALATION_TOOL "$PACKAGER" -S --needed --noconfirm ufw
;;
*)
$ESCALATION_TOOL "${PACKAGER}" install -y ufw
$ESCALATION_TOOL "$PACKAGER" install -y ufw
;;
esac
else
Expand Down
2 changes: 1 addition & 1 deletion tabs/system-setup/1-compile-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ installDepend() {
## Check for dependencies.
DEPENDENCIES='tar tree multitail tldr trash-cli unzip cmake make jq'
printf "%b\n" "${YELLOW}Installing dependencies...${RC}"
case $PACKAGER in
case "$PACKAGER" in
pacman)
if ! grep -q "^\s*\[multilib\]" /etc/pacman.conf; then
echo "[multilib]" | $ESCALATION_TOOL tee -a /etc/pacman.conf
Expand Down
16 changes: 8 additions & 8 deletions tabs/system-setup/3-global-theme.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@

install_theme_tools() {
printf "%b\n" "${YELLOW}Installing theme tools (qt6ct and kvantum)...${RC}\n"
case $PACKAGER in
case "$PACKAGER" in
apt-get|nala)
$ESCALATION_TOOL "${PACKAGER}" update
$ESCALATION_TOOL "${PACKAGER}" install -y qt6ct kvantum
$ESCALATION_TOOL "$PACKAGER" update
$ESCALATION_TOOL "$PACKAGER" install -y qt6ct kvantum
;;
zypper)
$ESCALATION_TOOL "${PACKAGER}" refresh
$ESCALATION_TOOL "${PACKAGER}" --non-interactive install qt6ct kvantum
$ESCALATION_TOOL "$PACKAGER" refresh
$ESCALATION_TOOL "$PACKAGER" --non-interactive install qt6ct kvantum
;;
dnf)
$ESCALATION_TOOL "${PACKAGER}" update
$ESCALATION_TOOL "${PACKAGER}" install -y qt6ct kvantum
$ESCALATION_TOOL "$PACKAGER" update
$ESCALATION_TOOL "$PACKAGER" install -y qt6ct kvantum
;;
pacman)
$ESCALATION_TOOL "${PACKAGER}" -S --needed --noconfirm qt6ct kvantum
$ESCALATION_TOOL "$PACKAGER" -S --needed --noconfirm qt6ct kvantum
;;
*)
printf "%b\n" "${RED}Unsupported package manager. Please install qt6ct and kvantum manually.${RC}\n"
Expand Down
10 changes: 5 additions & 5 deletions tabs/system-setup/4-remove-snaps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@
. ../common-script.sh

removeSnaps() {
case $PACKAGER in
case "$PACKAGER" in
pacman)
$ESCALATION_TOOL ${PACKAGER} -Rns snapd
$ESCALATION_TOOL "$PACKAGER" -Rns snapd
;;
apt-get|nala)
$ESCALATION_TOOL ${PACKAGER} autoremove --purge snapd
$ESCALATION_TOOL "$PACKAGER" autoremove --purge snapd
if [ "$ID" = ubuntu ]; then
$ESCALATION_TOOL apt-mark hold snapd
fi
;;
dnf)
$ESCALATION_TOOL ${PACKAGER} remove snapd
$ESCALATION_TOOL "$PACKAGER" remove snapd
;;
zypper)
$ESCALATION_TOOL ${PACKAGER} remove snapd
$ESCALATION_TOOL "$PACKAGER" remove snapd
;;
*)
echo "Removing snapd not implemented for this package manager"
Expand Down
2 changes: 1 addition & 1 deletion tabs/system-setup/arch/paru-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
. ../../common-script.sh

installDepend() {
case $PACKAGER in
case "$PACKAGER" in
pacman)
if ! command_exists paru; then
echo "Installing paru as AUR helper..."
Expand Down
2 changes: 1 addition & 1 deletion tabs/system-setup/arch/yay-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
. ../../common-script.sh

installDepend() {
case $PACKAGER in
case "$PACKAGER" in
pacman)
if ! command_exists yay; then
echo "Installing yay as AUR helper..."
Expand Down
2 changes: 1 addition & 1 deletion tabs/system-setup/fedora/rpm-fusion-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# https://rpmfusion.org/Configuration

installRPMFusion() {
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
echo "Installing RPM Fusion..."
Expand Down
36 changes: 18 additions & 18 deletions tabs/system-setup/system-update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,27 +31,27 @@ fastUpdate() {
$ESCALATION_TOOL apt-get install -y nala || { printf "%b\n" "${YELLOW}Falling back to apt-get${RC}"; PACKAGER="apt-get"; }
fi

if [ "${PACKAGER}" = "nala" ]; then
if [ "$PACKAGER" = "nala" ]; then
$ESCALATION_TOOL cp /etc/apt/sources.list /etc/apt/sources.list.bak
$ESCALATION_TOOL nala update
PACKAGER="nala"
fi

$ESCALATION_TOOL ${PACKAGER} upgrade -y
$ESCALATION_TOOL "$PACKAGER" upgrade -y
;;
dnf)
$ESCALATION_TOOL ${PACKAGER} update -y
$ESCALATION_TOOL "$PACKAGER" update -y
;;
zypper)
$ESCALATION_TOOL ${PACKAGER} ref
$ESCALATION_TOOL ${PACKAGER} --non-interactive dup
$ESCALATION_TOOL "$PACKAGER" ref
$ESCALATION_TOOL "$PACKAGER" --non-interactive dup
;;
yum)
$ESCALATION_TOOL ${PACKAGER} update -y
$ESCALATION_TOOL ${PACKAGER} upgrade -y
$ESCALATION_TOOL "$PACKAGER" update -y
$ESCALATION_TOOL "$PACKAGER" upgrade -y
;;
xbps-install)
$ESCALATION_TOOL ${PACKAGER} -Syu
$ESCALATION_TOOL "$PACKAGER" -Syu
;;
*)
printf "%b\n" "${RED}Unsupported package manager: $PACKAGER${RC}"
Expand All @@ -62,25 +62,25 @@ fastUpdate() {

updateSystem() {
printf "%b\n" "${GREEN}Updating system${RC}"
case ${PACKAGER} in
case "$PACKAGER" in
nala|apt-get)
$ESCALATION_TOOL "${PACKAGER}" update -y
$ESCALATION_TOOL "${PACKAGER}" upgrade -y
$ESCALATION_TOOL "$PACKAGER" update -y
$ESCALATION_TOOL "$PACKAGER" upgrade -y
;;
yum|dnf)
$ESCALATION_TOOL "${PACKAGER}" update -y
$ESCALATION_TOOL "${PACKAGER}" upgrade -y
$ESCALATION_TOOL "$PACKAGER" update -y
$ESCALATION_TOOL "$PACKAGER" upgrade -y
;;
pacman)
$ESCALATION_TOOL "${PACKAGER}" -Sy --noconfirm --needed archlinux-keyring
$ESCALATION_TOOL "${PACKAGER}" -Su --noconfirm
$ESCALATION_TOOL "$PACKAGER" -Sy --noconfirm --needed archlinux-keyring
$ESCALATION_TOOL "$PACKAGER" -Su --noconfirm
;;
zypper)
$ESCALATION_TOOL ${PACKAGER} ref
$ESCALATION_TOOL ${PACKAGER} --non-interactive dup
$ESCALATION_TOOL "$PACKAGER" ref
$ESCALATION_TOOL "$PACKAGER" --non-interactive dup
;;
xbps-install)
$ESCALATION_TOOL ${PACKAGER} -Syu
$ESCALATION_TOOL "$PACKAGER" -Syu
;;
*)
printf "%b\n" "${RED}Unsupported package manager: ${PACKAGER}${RC}"
Expand Down
6 changes: 3 additions & 3 deletions tabs/utils/bluetooth-control.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
setupBluetooth() {
printf "%b\n" "${YELLOW}Installing Bluez...${RC}"
if ! command_exists bluetoothctl; then
case ${PACKAGER} in
case "$PACKAGER" in
pacman)
$ESCALATION_TOOL "${PACKAGER}" -S --noconfirm bluez-utils
$ESCALATION_TOOL "$PACKAGER" -S --noconfirm bluez-utils
;;
*)
$ESCALATION_TOOL "${PACKAGER}" install -y bluez
$ESCALATION_TOOL "$PACKAGER" install -y bluez
;;
esac
else
Expand Down
8 changes: 4 additions & 4 deletions tabs/utils/monitor-control/utility_functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
setup_xrandr() {
echo "Install xrandr if not already installed..."
if ! command_exists xrandr; then
case ${PACKAGER} in
case "$PACKAGER" in
pacman)
$ESCALATION_TOOL "${PACKAGER}" -S --noconfirm xorg-xrandr
$ESCALATION_TOOL "$PACKAGER" -S --noconfirm xorg-xrandr
;;
apt-get|nala)
$ESCALATION_TOOL "${PACKAGER}" install -y x11-xserver-utils
$ESCALATION_TOOL "$PACKAGER" install -y x11-xserver-utils
;;
*)
$ESCALATION_TOOL "${PACKAGER}" install -y xorg-x11-server-utils
$ESCALATION_TOOL "$PACKAGER" install -y xorg-x11-server-utils
;;
esac
else
Expand Down
1 change: 1 addition & 0 deletions tabs/utils/numlock.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,6 @@ numlockSetup() {
fi
}

checkEnv
checkEscalationTool
numlockSetup
9 changes: 5 additions & 4 deletions tabs/utils/wifi-control.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
setupNetworkManager() {
printf "%b\n" "${YELLOW}Installing NetworkManager...${RC}"
if ! command_exists nmcli; then
case ${PACKAGER} in
case "$PACKAGER" in
pacman)
$ESCALATION_TOOL "${PACKAGER}" -S --noconfirm networkmanager
$ESCALATION_TOOL "$PACKAGER" -S --noconfirm networkmanager
;;
dnf)
$ESCALATION_TOOL "${PACKAGER}" install -y NetworkManager-1
$ESCALATION_TOOL "$PACKAGER" install -y NetworkManager-1
;;
*)
$ESCALATION_TOOL "${PACKAGER}" install -y network-manager
$ESCALATION_TOOL "$PACKAGER" install -y network-manager
;;
esac
else
Expand Down Expand Up @@ -186,5 +186,6 @@ remove_network() {

# Initialize
checkEnv
checkEscalationTool
setupNetworkManager
main_menu

0 comments on commit 100fc58

Please sign in to comment.