Add require function to copy.sh

Add requirements for jq and gron - used by mirror.sh
This commit is contained in:
Sage Vaillancourt 2024-08-29 14:26:28 -04:00
parent 48ebb1ea44
commit b32cf97e95
1 changed files with 14 additions and 8 deletions

20
copy.sh
View File

@ -6,15 +6,21 @@ SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
FAKE_HOME="$SCRIPT_DIR/fake_home" FAKE_HOME="$SCRIPT_DIR/fake_home"
export f="$FAKE_HOME" export f="$FAKE_HOME"
if ! command -v wget &> /dev/null; then function require {
echo "wget must be installed!" local success=true
for comm in "$@"; do
if ! command -v "$comm" &> /dev/null; then
echo "$comm must be installed!"
success=false
fi
done
if ! $success; then
echo "Missing copy.sh dependencies! Exiting!"
exit 1 exit 1
fi fi
}
if ! command -v curl &> /dev/null; then require git wget curl find jq gron
echo "curl must be installed!"
exit 1
fi
mkdir -p "$HOME/.tmp" || exit 1 mkdir -p "$HOME/.tmp" || exit 1