✨ Refactored seo and fixed typo in dependencycheck
This commit is contained in:
parent
abb964488f
commit
eee4b7ba43
2 changed files with 85 additions and 14 deletions
|
|
@ -5,33 +5,33 @@ set -e
|
|||
|
||||
# For styling/colorizing output
|
||||
txtbld=$(tput bold)
|
||||
# txtblue=${txtbld}$(tput setaf 4)
|
||||
# txtgreen=${txtbld}$(tput setaf 2)
|
||||
txtred=${txtbld}$(tput setaf 1)
|
||||
# txtyellow=${txtbld}$(tput setaf 3)
|
||||
txtgreen=${txtbld}$(tput setaf 2)
|
||||
txtwhite=${txtbld}$(tput setaf 7)
|
||||
|
||||
|
||||
# Dependency check
|
||||
function dependencycheck()
|
||||
{
|
||||
numdependencies="$#"
|
||||
dependencies=("$@")
|
||||
missingdependencies=0
|
||||
for ((i = 0; i < numdependencies; i++)) ;
|
||||
do
|
||||
|
||||
for ((i = 0; i < numdependencies; i++)) ; do
|
||||
if ! command -v "${dependencies[$i]}" &> /dev/null
|
||||
then
|
||||
echo "${txtred}dependency not met: ${dependencies[$i]}${txtwhite}"
|
||||
missingdependencies=$((missingdependencies+1))
|
||||
fi
|
||||
done
|
||||
|
||||
if [ $missingdependencies -gt 0 ] ; then
|
||||
echo "${txtred}Please install needed dependencies${txtwhite}"
|
||||
exit 1
|
||||
#comment out if sourced
|
||||
else
|
||||
echo "${txtgreen}All dependencies are met!${txtwhite}"
|
||||
fi
|
||||
}
|
||||
|
||||
#invoke function
|
||||
# invoke function comment out if sourced
|
||||
dependencycheck "$@"
|
||||
|
||||
if [ $missingdependencies -gt 0 ] ; then
|
||||
echo "${txtred}Please install needed dependencies${txtwhite}"
|
||||
exit 1
|
||||
fi
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue