diff --git a/helper-scripts/nextcloud.sh b/helper-scripts/nextcloud.sh index a1b9eb5d..a1420f40 100755 --- a/helper-scripts/nextcloud.sh +++ b/helper-scripts/nextcloud.sh @@ -1,23 +1,32 @@ #!/bin/bash -[[ -z ${1} ]] && { echo "No parameters given"; exit 1; } - for bin in curl dirmngr; do if [[ -z $(which ${bin}) ]]; then echo "Cannot find ${bin}, exiting..."; exit 1; fi done +[[ -z ${1} ]] && NC_HELP=y + while [ "$1" != '' ]; do case "${1}" in -p|--purge) NC_PURGE=y && shift;; -i|--install) NC_INSTALL=y && shift;; + -h|--help) NC_HELP=y && shift;; *) echo "Unknown parameter: ${1}" && shift;; esac done +if [[ ${NC_HELP} == "y" ]]; then + printf 'Usage:\n\n' + printf ' -p|--purge\n Purge Nextcloud\n' + printf ' -i|--install\n Install Nextcloud\n\n' + exit 0 +fi + [[ ${NC_PURGE} == "y" ]] && [[ ${NC_INSTALL} == "y" ]] && { echo "Cannot use -p and -i at the same time"; } SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -source ${SCRIPT_DIR}/../mailcow.conf +cd ${SCRIPT_DIR}/../ +source mailcow.conf if [[ ${NC_PURGE} == "y" ]]; then @@ -55,7 +64,7 @@ elif [[ ${NC_INSTALL} == "y" ]]; then ADMIN_NC_PASS=$(