mirror of
https://github.com/joglomedia/LEMPer.git
synced 2026-04-11 23:48:19 +00:00
Add pre check required packages
This commit is contained in:
@@ -100,13 +100,19 @@ if [ "$(id -u)" -ne 0 ]; then
|
||||
fi
|
||||
|
||||
# Check pre-requisite packages.
|
||||
if [[ ! -f $(command -v unzip) || ! -f $(command -v git) || ! -f $(command -v rsync) ]]; then
|
||||
error "${APP_NAME^} requires git, rsync, unzip, wget, please install it first!"
|
||||
echo "help: sudo apt install git rsync unzip wget"
|
||||
REQUIRED_PACKAGES=("curl" "git" "rsync" "unzip" "wget")
|
||||
for CMD in "${REQUIRED_PACKAGES[@]}"; do
|
||||
if ! [[ -x "$(command -v "${CMD}")" ]]; then
|
||||
NO_PACKAGES+=("${CMD}")
|
||||
fi
|
||||
done
|
||||
if [[ ${#NO_PACKAGES[@]} -gt 0 ]]; then
|
||||
printf -v NO_PACKAGES_STR '%s, ' "${NO_PACKAGES[@]}"
|
||||
error "${APP_NAME^} requires: ${NO_PACKAGES_STR%, }, please install it first!"
|
||||
echo "help: run 'sudo apt-get install ${NO_PACKAGES[*]}'"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
##
|
||||
# Main Functions
|
||||
#
|
||||
|
||||
Reference in New Issue
Block a user