moved check-dependencies into check-dependencies.sh

This commit is contained in:
commie 2024-04-12 09:10:57 -04:00
parent 71d6b5f0d4
commit 2b2f4bef3b

11
bash/check-dependencies → bash/check-dependencies.sh Executable file → Normal file
View file

@ -3,23 +3,18 @@
# Abort if any command fails.
set -e
# Set up some colors for output
red=$(tput setaf 1)
green=$(tput setaf 2)
normal=$(tput sgr0)
# Check for presence of a command.
# $1 is name of dependency
# $2 is command that gets run to check for it
# eg. check "disroot.org reachable?" "ping disroot.org"
check() {
printf "%-28s" "Checking for $1..."
echo -n "Checking for $1... "
if eval $2 &> /dev/null ; then
printf "%1s\n" "${green}✔︎${normal}"
echo ✔︎
false
else
printf "%1s\n" "${red}${normal}"
echo ✗
storytime_ready=false
true
fi