From b369efe148a0ac9d045772745f9e7481a9b68c8f Mon Sep 17 00:00:00 2001 From: Carter Canedy Date: Thu, 3 Oct 2024 13:46:45 -0700 Subject: [PATCH 1/2] correct dependency checks for bash prompt install --- core/tabs/applications-setup/mybash-setup.sh | 38 +++++++++++++------- 1 file changed, 26 insertions(+), 12 deletions(-) diff --git a/core/tabs/applications-setup/mybash-setup.sh b/core/tabs/applications-setup/mybash-setup.sh index 7cda99428..1a1f1540d 100644 --- a/core/tabs/applications-setup/mybash-setup.sh +++ b/core/tabs/applications-setup/mybash-setup.sh @@ -4,17 +4,31 @@ 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) - "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm bash bash-completion tar bat tree unzip fontconfig git - ;; - *) - "$ESCALATION_TOOL" "$PACKAGER" install -y bash bash-completion tar bat tree unzip fontconfig git - ;; - esac +installDeps() { + DEPS="bash bash-completion tar bat tree unzip fontconfig git" + depsNeeded="" + + for dep in $DEPS; do + if ! command_exists "${dep}"; then + depsNeeded="${depsNeeded} ${dep}" + fi + done + + if [ "$depsNeeded" != "" ]; then + printf "%b\n" "${RED}Some dependencies weren't installed\nInstalling${depsNeeded}" + + case "$PACKAGER" in + pacman) + # disable globbing/word-splitting warning, need word splitting + # shellcheck disable=SC2086 + "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm $depsNeeded + ;; + *) + # disable globbing/word-splitting warning, need word splitting + # shellcheck disable=SC2086 + "$ESCALATION_TOOL" "$PACKAGER" install -y $depsNeeded + ;; + esac fi } @@ -102,7 +116,7 @@ linkConfig() { checkEnv checkEscalationTool -installDepend +installDeps cloneMyBash installFont installStarshipAndFzf From f16e959842dc2a8f00c02341f40381c0909ac529 Mon Sep 17 00:00:00 2001 From: Carter Canedy Date: Thu, 3 Oct 2024 14:04:32 -0700 Subject: [PATCH 2/2] fix dependency test exe names --- core/tabs/applications-setup/mybash-setup.sh | 41 ++++++++++---------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/core/tabs/applications-setup/mybash-setup.sh b/core/tabs/applications-setup/mybash-setup.sh index 1a1f1540d..8368f37d8 100644 --- a/core/tabs/applications-setup/mybash-setup.sh +++ b/core/tabs/applications-setup/mybash-setup.sh @@ -6,30 +6,31 @@ gitpath="$HOME/.local/share/mybash" installDeps() { DEPS="bash bash-completion tar bat tree unzip fontconfig git" - depsNeeded="" - for dep in $DEPS; do + # no way to reliably test for bash-completion for all I know + # fontconfig isn't an executable, so use fc-cache to test for installation + DEP_TESTS="bash tar bat tree unzip fc-cache git" + + for dep in $DEP_TESTS; do if ! command_exists "${dep}"; then - depsNeeded="${depsNeeded} ${dep}" + printf "%b\n" "${RED}Some dependencies weren't installed\n${GREEN}Installing${RC} [$(echo "${DEPS}" | sed 's/ /, /g')]" + + case "$PACKAGER" in + pacman) + # disable globbing/word-splitting warning, need word splitting + # shellcheck disable=SC2086 + "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm $DEPS + ;; + *) + # disable globbing/word-splitting warning, need word splitting + # shellcheck disable=SC2086 + "$ESCALATION_TOOL" "$PACKAGER" install -y $DEPS + ;; + esac + + break fi done - - if [ "$depsNeeded" != "" ]; then - printf "%b\n" "${RED}Some dependencies weren't installed\nInstalling${depsNeeded}" - - case "$PACKAGER" in - pacman) - # disable globbing/word-splitting warning, need word splitting - # shellcheck disable=SC2086 - "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm $depsNeeded - ;; - *) - # disable globbing/word-splitting warning, need word splitting - # shellcheck disable=SC2086 - "$ESCALATION_TOOL" "$PACKAGER" install -y $depsNeeded - ;; - esac - fi } cloneMyBash() {