Skip to content

Commit 29e3fcb

Browse files
committed
Check for required dependencies on start
#80
1 parent 5e3175a commit 29e3fcb

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

backup.sh

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,24 @@ else
2424
}
2525
else
2626
# Neither whiptail nor dialog are installed
27-
echo "Error: Neither whiptail nor dialog are installed. Exiting."
27+
echo "Neither whiptail nor dialog are installed, can't continue. Please refer to the README for usage instructions."
2828
exit 1
2929
fi
3030
fi
3131

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

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

0 commit comments

Comments
 (0)