template_setup/025-Checking_and_Installing_Dependencies_via_Homebrew
deathbybandaid b179e8c165 test
2024-05-01 22:16:12 -04:00

46 lines
1.1 KiB
Bash

#!/bin/bash
## Script Location
SCRIPTDIR=$(dirname $0)
source "$SCRIPTDIR/common/colors.sh"
source "$SCRIPTDIR/common/functions.sh"
source "$SCRIPTDIR/common/load-defaults.sh"
install_dependencies() {
## Start File Loop
## For .dependency files In The dependencies Directory
DEPENDENCIESALL="$SCRIPTDIR/dependencies/homebrew/*.dep"
for f in $DEPENDENCIESALL
do
## Name Of Package
DEPENDENCYCOMMAND=$(echo "`basename $f | cut -f 1 -d '.'`")
## Actual Package
DEPENDENCYPACKAGE=`cat $f`
printf "$COL_LIGHT_BLUE" "* Checking For command $DEPENDENCYCOMMAND with package name $DEPENDENCYPACKAGE"
if is_command $DEPENDENCYCOMMAND;
then
printf "$COL_YELLOW" "** $DEPENDENCYCOMMAND Is Already Installed."
else
printf "$COL_YELLOW" "** Installing $DEPENDENCYCOMMAND"
yes | brew install $DEPENDENCYPACKAGE
if is_command $DEPENDENCYCOMMAND;
then
printf "$COL_GREEN" "** $DEPENDENCYCOMMAND Installation Success"
else
printf "$COL_RED" "** Error Installing $DEPENDENCYCOMMAND"
fi
fi
## End Of loop
done
}
install_dependencies