Skip to content

Commit

Permalink
Check for required dependencies on start
Browse files Browse the repository at this point in the history
  • Loading branch information
mrrfv committed Sep 29, 2023
1 parent 5e3175a commit 29e3fcb
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion backup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,24 @@ else
}
else
# Neither whiptail nor dialog are installed
echo "Error: Neither whiptail nor dialog are installed. Exiting."
echo "Neither whiptail nor dialog are installed, can't continue. Please refer to the README for usage instructions."
exit 1
fi
fi

# Check if other dependencies are installed: adb, tar, pv, 7z
# srm is optional so we don't check for it
commands=("tar" "pv" "7z" "adb")
for cmd in "${commands[@]}"
do
# adb is a function in WSL so we're using type instead of command -v
if ! type "$cmd" &> /dev/null
then
echo "$cmd is not available, can't continue. Please refer to the README for usage instructions."
exit 1
fi
done


SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
Expand Down

0 comments on commit 29e3fcb

Please sign in to comment.