From 2662aa03c4f9e5fd4306e8bade6c270c6961a96f Mon Sep 17 00:00:00 2001 From: Nyx <144965845+nnyyxxxx@users.noreply.github.com> Date: Fri, 20 Sep 2024 10:27:31 -0400 Subject: [PATCH] small refactor (#563) * small refactor * Fix formatting --------- Co-authored-by: nnyyxxxx --- core/tabs/applications-setup/alacritty-setup.sh | 4 ++-- core/tabs/applications-setup/bottles-setup.sh | 17 ++++++++++++----- core/tabs/applications-setup/fastfetch-setup.sh | 2 +- core/tabs/applications-setup/kitty-setup.sh | 2 +- core/tabs/applications-setup/mybash-setup.sh | 2 ++ core/tabs/applications-setup/neovim-setup.sh | 2 ++ core/tabs/applications-setup/rofi-setup.sh | 2 +- core/tabs/applications-setup/zsh-setup.sh | 2 +- core/tabs/security/firewall-baselines.sh | 2 +- 9 files changed, 23 insertions(+), 12 deletions(-) mode change 100644 => 100755 core/tabs/applications-setup/bottles-setup.sh diff --git a/core/tabs/applications-setup/alacritty-setup.sh b/core/tabs/applications-setup/alacritty-setup.sh index 83eeb986b..25558fed0 100755 --- a/core/tabs/applications-setup/alacritty-setup.sh +++ b/core/tabs/applications-setup/alacritty-setup.sh @@ -3,8 +3,8 @@ . ../common-script.sh installAlacritty() { - printf "%b\n" "${YELLOW}Installing Alacritty...${RC}" if ! command_exists alacritty; then + printf "%b\n" "${YELLOW}Installing Alacritty...${RC}" case "$PACKAGER" in pacman) "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm alacritty @@ -19,7 +19,7 @@ installAlacritty() { } setupAlacrittyConfig() { - printf "%b\n" "${YELLOW}Copy alacritty config files${RC}" + printf "%b\n" "${YELLOW}Copying alacritty config files...${RC}" if [ -d "${HOME}/.config/alacritty" ] && [ ! -d "${HOME}/.config/alacritty-bak" ]; then cp -r "${HOME}/.config/alacritty" "${HOME}/.config/alacritty-bak" fi diff --git a/core/tabs/applications-setup/bottles-setup.sh b/core/tabs/applications-setup/bottles-setup.sh old mode 100644 new mode 100755 index e7e792efa..02fef60bb --- a/core/tabs/applications-setup/bottles-setup.sh +++ b/core/tabs/applications-setup/bottles-setup.sh @@ -2,13 +2,20 @@ . ../common-script.sh -install_bottles() { +installBottles() { + if ! command_exists flatpak; then printf "%b\n" "${YELLOW}Installing Bottles...${RC}" - . ./setup-flatpak.sh - flatpak install -y flathub com.usebottles.bottles - printf "%b\n" "${GREEN}Bottles installed successfully. Restart the system to apply changes...${RC}" + case "$PACKAGER" in + *) + . ./setup-flatpak.sh + flatpak install -y flathub com.usebottles.bottles + ;; + esac + else + printf "%b\n" "${GREEN}Bottles is already installed.${RC}" + fi } checkEnv checkEscalationTool -install_bottles \ No newline at end of file +installBottles \ No newline at end of file diff --git a/core/tabs/applications-setup/fastfetch-setup.sh b/core/tabs/applications-setup/fastfetch-setup.sh index dd6ca483a..4eca3abd8 100644 --- a/core/tabs/applications-setup/fastfetch-setup.sh +++ b/core/tabs/applications-setup/fastfetch-setup.sh @@ -3,8 +3,8 @@ . ../common-script.sh installFastfetch() { - printf "%b\n" "${YELLOW}Installing Fastfetch...${RC}" if ! command_exists fastfetch; then + printf "%b\n" "${YELLOW}Installing Fastfetch...${RC}" case "$PACKAGER" in pacman) "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm fastfetch diff --git a/core/tabs/applications-setup/kitty-setup.sh b/core/tabs/applications-setup/kitty-setup.sh index 0131b4bb4..85ef129b6 100755 --- a/core/tabs/applications-setup/kitty-setup.sh +++ b/core/tabs/applications-setup/kitty-setup.sh @@ -3,8 +3,8 @@ . ../common-script.sh installKitty() { - printf "%b\n" "${YELLOW}Install Kitty if not already installed...${RC}" if ! command_exists kitty; then + printf "%b\n" "${YELLOW}Installing Kitty...${RC}" case "$PACKAGER" in pacman) "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm kitty diff --git a/core/tabs/applications-setup/mybash-setup.sh b/core/tabs/applications-setup/mybash-setup.sh index 805e3ffe8..3360affcd 100644 --- a/core/tabs/applications-setup/mybash-setup.sh +++ b/core/tabs/applications-setup/mybash-setup.sh @@ -5,6 +5,7 @@ gitpath="$HOME/.local/share/mybash" installDepend() { + if ! command_exists bash bash-completion tar bat tree unzip fontconfig git; then printf "%b\n" "${YELLOW}Installing Bash...${RC}" case "$PACKAGER" in pacman) @@ -24,6 +25,7 @@ installDepend() { exit 1 ;; esac + fi } cloneMyBash() { diff --git a/core/tabs/applications-setup/neovim-setup.sh b/core/tabs/applications-setup/neovim-setup.sh index e578f67d5..4f8706fd6 100755 --- a/core/tabs/applications-setup/neovim-setup.sh +++ b/core/tabs/applications-setup/neovim-setup.sh @@ -14,6 +14,7 @@ cloneNeovim() { } installNeovim() { + if ! command_exists neovim ripgrep git fzf; then printf "%b\n" "${YELLOW}Installing Neovim...${RC}" case "$PACKAGER" in pacman) @@ -33,6 +34,7 @@ installNeovim() { exit 1 ;; esac + fi } backupNeovimConfig() { diff --git a/core/tabs/applications-setup/rofi-setup.sh b/core/tabs/applications-setup/rofi-setup.sh index e779066ac..24ce1a67d 100755 --- a/core/tabs/applications-setup/rofi-setup.sh +++ b/core/tabs/applications-setup/rofi-setup.sh @@ -3,8 +3,8 @@ . ../common-script.sh installRofi() { - printf "%b\n" "${YELLOW}Installing Rofi...${RC}" if ! command_exists rofi; then + printf "%b\n" "${YELLOW}Installing Rofi...${RC}" case "$PACKAGER" in pacman) "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm rofi diff --git a/core/tabs/applications-setup/zsh-setup.sh b/core/tabs/applications-setup/zsh-setup.sh index c3577e5e8..9162afd6d 100644 --- a/core/tabs/applications-setup/zsh-setup.sh +++ b/core/tabs/applications-setup/zsh-setup.sh @@ -4,8 +4,8 @@ # Function to install zsh installZsh() { - printf "%b\n" "${YELLOW}Installing Zsh...${RC}" if ! command_exists zsh; then + printf "%b\n" "${YELLOW}Installing Zsh...${RC}" case "$PACKAGER" in pacman) "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm zsh diff --git a/core/tabs/security/firewall-baselines.sh b/core/tabs/security/firewall-baselines.sh index 2f7a2529c..7ddfeeeb8 100644 --- a/core/tabs/security/firewall-baselines.sh +++ b/core/tabs/security/firewall-baselines.sh @@ -3,8 +3,8 @@ . ../common-script.sh installPkg() { - printf "%b\n" "${YELLOW}Installing UFW...${RC}" if ! command_exists ufw; then + printf "%b\n" "${YELLOW}Installing UFW...${RC}" case "$PACKAGER" in pacman) "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm ufw