From b50cfd2ea0bc2b9de5e31bf7a93028e66346f6bf Mon Sep 17 00:00:00 2001 From: nnyyxxxx Date: Tue, 17 Sep 2024 01:48:33 -0400 Subject: [PATCH 1/4] Add git as a dependency for scripts that use it --- tabs/applications-setup/dwmtitus-setup.sh | 20 +++++++-------- tabs/applications-setup/mybash-setup.sh | 30 +++++++++++------------ tabs/applications-setup/neovim-setup.sh | 28 ++++++++++----------- 3 files changed, 39 insertions(+), 39 deletions(-) diff --git a/tabs/applications-setup/dwmtitus-setup.sh b/tabs/applications-setup/dwmtitus-setup.sh index acc56c0e7..1a35a4788 100755 --- a/tabs/applications-setup/dwmtitus-setup.sh +++ b/tabs/applications-setup/dwmtitus-setup.sh @@ -2,21 +2,14 @@ . ../common-script.sh -makeDWM() { - cd "$HOME" && git clone https://github.com/ChrisTitusTech/dwm-titus.git # CD to Home directory to install dwm-titus - # This path can be changed (e.g. to linux-toolbox directory) - cd dwm-titus/ # Hardcoded path, maybe not the best. - $ESCALATION_TOOL make clean install # Run make clean install -} - setupDWM() { echo "Installing DWM-Titus if not already installed" case "$PACKAGER" in # Install pre-Requisites pacman) - $ESCALATION_TOOL "$PACKAGER" -S --needed --noconfirm base-devel libx11 libxinerama libxft imlib2 libxcb + $ESCALATION_TOOL "$PACKAGER" -S --needed --noconfirm base-devel libx11 libxinerama libxft imlib2 libxcb git ;; apt-get|nala) - $ESCALATION_TOOL "$PACKAGER" install -y build-essential libx11-dev libxinerama-dev libxft-dev libimlib2-dev libx11-xcb-dev libfontconfig1 libx11-6 libxft2 libxinerama1 libxcb-res0-dev + $ESCALATION_TOOL "$PACKAGER" install -y build-essential libx11-dev libxinerama-dev libxft-dev libimlib2-dev libx11-xcb-dev libfontconfig1 libx11-6 libxft2 libxinerama1 libxcb-res0-dev git ;; dnf) $ESCALATION_TOOL "$PACKAGER" groupinstall -y "Development Tools" @@ -29,6 +22,13 @@ setupDWM() { esac } +makeDWM() { + cd "$HOME" && git clone https://github.com/ChrisTitusTech/dwm-titus.git # CD to Home directory to install dwm-titus + # This path can be changed (e.g. to linux-toolbox directory) + cd dwm-titus/ # Hardcoded path, maybe not the best. + $ESCALATION_TOOL make clean install # Run make clean install +} + install_nerd_font() { FONT_DIR="$HOME/.local/share/fonts" FONT_ZIP="$FONT_DIR/Meslo.zip" @@ -292,4 +292,4 @@ makeDWM install_slstatus install_nerd_font clone_config_folders -configure_backgrounds +configure_backgrounds \ No newline at end of file diff --git a/tabs/applications-setup/mybash-setup.sh b/tabs/applications-setup/mybash-setup.sh index 7bca14e2c..67529c33e 100644 --- a/tabs/applications-setup/mybash-setup.sh +++ b/tabs/applications-setup/mybash-setup.sh @@ -4,29 +4,20 @@ gitpath="$HOME/.local/share/mybash" -cloneMyBash() { - # Check if the dir exists before attempting to clone into it. - if [ -d "$gitpath" ]; then - rm -rf "$gitpath" - fi - mkdir -p "$HOME/.local/share" # Only create the dir if it doesn't exist. - cd "$HOME" && git clone https://github.com/ChrisTitusTech/mybash.git "$gitpath" -} - installDepend() { echo "Install mybash if not already installed" case "$PACKAGER" in pacman) - $ESCALATION_TOOL "$PACKAGER" -S --needed --noconfirm bash bash-completion tar bat tree unzip fontconfig + $ESCALATION_TOOL "$PACKAGER" -S --needed --noconfirm bash bash-completion tar bat tree unzip fontconfig git ;; - apt) - $ESCALATION_TOOL "$PACKAGER" install -y bash bash-completion tar bat tree unzip fontconfig + apt|nala) + $ESCALATION_TOOL "$PACKAGER" install -y bash bash-completion tar bat tree unzip fontconfig git ;; dnf) - $ESCALATION_TOOL "$PACKAGER" install -y bash bash-completion tar bat tree unzip fontconfig + $ESCALATION_TOOL "$PACKAGER" install -y bash bash-completion tar bat tree unzip fontconfig git ;; zypper) - $ESCALATION_TOOL "$PACKAGER" install -y bash bash-completion tar bat tree unzip fontconfig + $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. @@ -35,6 +26,15 @@ installDepend() { esac } +cloneMyBash() { + # Check if the dir exists before attempting to clone into it. + if [ -d "$gitpath" ]; then + rm -rf "$gitpath" + fi + mkdir -p "$HOME/.local/share" # Only create the dir if it doesn't exist. + cd "$HOME" && git clone https://github.com/ChrisTitusTech/mybash.git "$gitpath" +} + installFont() { # Check to see if the MesloLGS Nerd Font is installed (Change this to whatever font you would like) FONT_NAME="MesloLGS Nerd Font Mono" @@ -110,8 +110,8 @@ linkConfig() { checkEnv checkEscalationTool -cloneMyBash installDepend +cloneMyBash installFont installStarshipAndFzf installZoxide diff --git a/tabs/applications-setup/neovim-setup.sh b/tabs/applications-setup/neovim-setup.sh index 0d3a2578d..ac97b0bf5 100755 --- a/tabs/applications-setup/neovim-setup.sh +++ b/tabs/applications-setup/neovim-setup.sh @@ -4,29 +4,20 @@ gitpath="$HOME/.local/share/neovim" -cloneNeovim() { - # Check if the dir exists before attempting to clone into it. - if [ -d "$gitpath" ]; then - rm -rf "$gitpath" - fi - mkdir -p "$HOME/.local/share" # Only create the dir if it doesn't exist. - cd "$HOME" && git clone https://github.com/ChrisTitusTech/neovim.git "$HOME/.local/share/neovim" -} - setupNeovim() { echo "Install Neovim if not already installed" case "$PACKAGER" in pacman) - $ESCALATION_TOOL "$PACKAGER" -S --needed --noconfirm neovim ripgrep fzf python-virtualenv luarocks go shellcheck + $ESCALATION_TOOL "$PACKAGER" -S --needed --noconfirm neovim ripgrep fzf python-virtualenv luarocks go shellcheck git ;; apt) - $ESCALATION_TOOL "$PACKAGER" install -y neovim ripgrep fd-find python3-venv luarocks golang-go shellcheck + $ESCALATION_TOOL "$PACKAGER" install -y neovim ripgrep fd-find python3-venv luarocks golang-go shellcheck git ;; dnf) - $ESCALATION_TOOL "$PACKAGER" install -y neovim ripgrep fzf python3-virtualenv luarocks golang ShellCheck + $ESCALATION_TOOL "$PACKAGER" install -y neovim ripgrep fzf python3-virtualenv luarocks golang ShellCheck git ;; zypper) - $ESCALATION_TOOL "$PACKAGER" install -y neovim ripgrep fzf python3-virtualenv luarocks golang ShellCheck + $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. @@ -35,6 +26,15 @@ setupNeovim() { esac } +cloneNeovim() { + # Check if the dir exists before attempting to clone into it. + if [ -d "$gitpath" ]; then + rm -rf "$gitpath" + fi + mkdir -p "$HOME/.local/share" # Only create the dir if it doesn't exist. + cd "$HOME" && git clone https://github.com/ChrisTitusTech/neovim.git "$HOME/.local/share/neovim" +} + backupNeovimConfig() { if [ -d "$HOME/.config/nvim" ] && [ ! -d "$HOME/.config/nvim-backup" ]; then cp -r "$HOME/.config/nvim" "$HOME/.config/nvim-backup" @@ -49,7 +49,7 @@ linkNeovimConfig() { checkEnv checkEscalationTool -cloneNeovim setupNeovim +cloneNeovim backupNeovimConfig linkNeovimConfig \ No newline at end of file From 9c16c81d4498415e4c4eab2c185027230f6c8b6c Mon Sep 17 00:00:00 2001 From: nnyyxxxx Date: Tue, 17 Sep 2024 01:54:02 -0400 Subject: [PATCH 2/4] apt -> apt|nala --- tabs/applications-setup/neovim-setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tabs/applications-setup/neovim-setup.sh b/tabs/applications-setup/neovim-setup.sh index ac97b0bf5..a196f3c6f 100755 --- a/tabs/applications-setup/neovim-setup.sh +++ b/tabs/applications-setup/neovim-setup.sh @@ -10,7 +10,7 @@ setupNeovim() { pacman) $ESCALATION_TOOL "$PACKAGER" -S --needed --noconfirm neovim ripgrep fzf python-virtualenv luarocks go shellcheck git ;; - apt) + apt|nala) $ESCALATION_TOOL "$PACKAGER" install -y neovim ripgrep fd-find python3-venv luarocks golang-go shellcheck git ;; dnf) From b243cf0e09e7fbe089c2af09664aad2690212c72 Mon Sep 17 00:00:00 2001 From: nnyyxxxx Date: Tue, 17 Sep 2024 01:56:45 -0400 Subject: [PATCH 3/4] Refactor the remaining apt-gets and add nala to them --- tabs/system-setup/1-compile-setup.sh | 2 +- tabs/system-setup/4-remove-snaps.sh | 2 +- tabs/system-setup/system-update.sh | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tabs/system-setup/1-compile-setup.sh b/tabs/system-setup/1-compile-setup.sh index a9d21890d..738d9fe1a 100755 --- a/tabs/system-setup/1-compile-setup.sh +++ b/tabs/system-setup/1-compile-setup.sh @@ -17,7 +17,7 @@ installDepend() { fi $AUR_HELPER -S --needed --noconfirm "$DEPENDENCIES" ;; - apt-get|nala) + apt|nala) COMPILEDEPS='build-essential' $ESCALATION_TOOL "$PACKAGER" update $ESCALATION_TOOL dpkg --add-architecture i386 diff --git a/tabs/system-setup/4-remove-snaps.sh b/tabs/system-setup/4-remove-snaps.sh index f804aa5b8..926f0d8ac 100644 --- a/tabs/system-setup/4-remove-snaps.sh +++ b/tabs/system-setup/4-remove-snaps.sh @@ -7,7 +7,7 @@ removeSnaps() { pacman) $ESCALATION_TOOL ${PACKAGER} -Rns snapd ;; - apt-get|nala) + apt|nala) $ESCALATION_TOOL ${PACKAGER} autoremove --purge snapd if [ "$ID" = ubuntu ]; then $ESCALATION_TOOL apt-mark hold snapd diff --git a/tabs/system-setup/system-update.sh b/tabs/system-setup/system-update.sh index e6b32af6d..cc284bf9a 100755 --- a/tabs/system-setup/system-update.sh +++ b/tabs/system-setup/system-update.sh @@ -25,7 +25,7 @@ fastUpdate() { fi ;; - apt-get|nala) + apt|nala) $ESCALATION_TOOL apt-get update if ! command_exists nala; then $ESCALATION_TOOL apt-get install -y nala || { printf "%b\n" "${YELLOW}Falling back to apt-get${RC}"; PACKAGER="apt-get"; } @@ -63,7 +63,7 @@ fastUpdate() { updateSystem() { printf "%b\n" "${GREEN}Updating system${RC}" case ${PACKAGER} in - nala|apt-get) + apt|nala) $ESCALATION_TOOL "${PACKAGER}" update -y $ESCALATION_TOOL "${PACKAGER}" upgrade -y ;; From 09282c9f0b33b27f628b9d75751b1c6036ae9bd6 Mon Sep 17 00:00:00 2001 From: nnyyxxxx Date: Tue, 17 Sep 2024 06:22:04 -0400 Subject: [PATCH 4/4] Remove refactored apts from this PR --- tabs/applications-setup/mybash-setup.sh | 2 +- tabs/applications-setup/neovim-setup.sh | 2 +- tabs/system-setup/1-compile-setup.sh | 2 +- tabs/system-setup/4-remove-snaps.sh | 2 +- tabs/system-setup/system-update.sh | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tabs/applications-setup/mybash-setup.sh b/tabs/applications-setup/mybash-setup.sh index 67529c33e..553e20392 100644 --- a/tabs/applications-setup/mybash-setup.sh +++ b/tabs/applications-setup/mybash-setup.sh @@ -10,7 +10,7 @@ installDepend() { pacman) $ESCALATION_TOOL "$PACKAGER" -S --needed --noconfirm bash bash-completion tar bat tree unzip fontconfig git ;; - apt|nala) + apt) $ESCALATION_TOOL "$PACKAGER" install -y bash bash-completion tar bat tree unzip fontconfig git ;; dnf) diff --git a/tabs/applications-setup/neovim-setup.sh b/tabs/applications-setup/neovim-setup.sh index a196f3c6f..ac97b0bf5 100755 --- a/tabs/applications-setup/neovim-setup.sh +++ b/tabs/applications-setup/neovim-setup.sh @@ -10,7 +10,7 @@ setupNeovim() { pacman) $ESCALATION_TOOL "$PACKAGER" -S --needed --noconfirm neovim ripgrep fzf python-virtualenv luarocks go shellcheck git ;; - apt|nala) + apt) $ESCALATION_TOOL "$PACKAGER" install -y neovim ripgrep fd-find python3-venv luarocks golang-go shellcheck git ;; dnf) diff --git a/tabs/system-setup/1-compile-setup.sh b/tabs/system-setup/1-compile-setup.sh index 738d9fe1a..a9d21890d 100755 --- a/tabs/system-setup/1-compile-setup.sh +++ b/tabs/system-setup/1-compile-setup.sh @@ -17,7 +17,7 @@ installDepend() { fi $AUR_HELPER -S --needed --noconfirm "$DEPENDENCIES" ;; - apt|nala) + apt-get|nala) COMPILEDEPS='build-essential' $ESCALATION_TOOL "$PACKAGER" update $ESCALATION_TOOL dpkg --add-architecture i386 diff --git a/tabs/system-setup/4-remove-snaps.sh b/tabs/system-setup/4-remove-snaps.sh index 926f0d8ac..f804aa5b8 100644 --- a/tabs/system-setup/4-remove-snaps.sh +++ b/tabs/system-setup/4-remove-snaps.sh @@ -7,7 +7,7 @@ removeSnaps() { pacman) $ESCALATION_TOOL ${PACKAGER} -Rns snapd ;; - apt|nala) + apt-get|nala) $ESCALATION_TOOL ${PACKAGER} autoremove --purge snapd if [ "$ID" = ubuntu ]; then $ESCALATION_TOOL apt-mark hold snapd diff --git a/tabs/system-setup/system-update.sh b/tabs/system-setup/system-update.sh index cc284bf9a..e6b32af6d 100755 --- a/tabs/system-setup/system-update.sh +++ b/tabs/system-setup/system-update.sh @@ -25,7 +25,7 @@ fastUpdate() { fi ;; - apt|nala) + apt-get|nala) $ESCALATION_TOOL apt-get update if ! command_exists nala; then $ESCALATION_TOOL apt-get install -y nala || { printf "%b\n" "${YELLOW}Falling back to apt-get${RC}"; PACKAGER="apt-get"; } @@ -63,7 +63,7 @@ fastUpdate() { updateSystem() { printf "%b\n" "${GREEN}Updating system${RC}" case ${PACKAGER} in - apt|nala) + nala|apt-get) $ESCALATION_TOOL "${PACKAGER}" update -y $ESCALATION_TOOL "${PACKAGER}" upgrade -y ;;