Change detection for default method
This commit is contained in:
22
installJRMC
22
installJRMC
@@ -115,9 +115,9 @@ print_help() {
|
||||
# @arg $@ User input
|
||||
parse_input() {
|
||||
debug "Running: ${FUNCNAME[0]} $*"
|
||||
declare -gi BUILD_SWITCH=0 REPO_INSTALL_SWITCH=0 LOCAL_INSTALL_SWITCH=0 \
|
||||
CONTAINER_INSTALL_SWITCH=0 COMPAT_SWITCH=0 CREATEREPO_SWITCH=0 UNINSTALL_SWITCH=0 \
|
||||
YES_SWITCH=0 DEBUG=0
|
||||
declare -gi BUILD_SWITCH REPO_INSTALL_SWITCH LOCAL_INSTALL_SWITCH \
|
||||
CONTAINER_INSTALL_SWITCH CREATEREPO_SWITCH \
|
||||
COMPAT_SWITCH UNINSTALL_SWITCH YES_SWITCH DEBUG=0
|
||||
declare -g USER_MC_VERSION USER_MC_REPO MJR_FILE \
|
||||
BETAPASS SERVICE_TYPE VNCPASS USER_DISPLAY BUILD_TARGET CREATEREPO_TARGET
|
||||
local long_opts short_opts input
|
||||
@@ -198,6 +198,14 @@ parse_input() {
|
||||
err "Incorrect option provided, see installJRMC --help"; exit 1
|
||||
fi
|
||||
|
||||
# Fallback to default install method in some scenarios
|
||||
if ! ((UNINSTALL_SWITCH + BUILD_SWITCH + CREATEREPO_SWITCH +
|
||||
LOCAL_INSTALL_SWITCH + CONTAINER_INSTALL_SWITCH)) &&
|
||||
[[ ${#SERVICES[@]} -eq 0 && ${#CONTAINERS[@]} -eq 0 ]]; then
|
||||
debug "Automatically using --install=repo"
|
||||
REPO_INSTALL_SWITCH=1
|
||||
fi
|
||||
|
||||
# Print some warnings for unsupported argument combinations
|
||||
if [[ -n $USER_MC_REPO ]] && ((LOCAL_INSTALL_SWITCH)); then
|
||||
err "--install=local is not compatible with --mcrepo as only the default ($MC_REPO) DEB is available"
|
||||
@@ -240,13 +248,7 @@ init() {
|
||||
USER="${SUDO_USER:-$USER}"
|
||||
fi
|
||||
|
||||
# Parse input commands with getopt
|
||||
if [[ $# -eq 0 || ! "$*" =~ (--install|--service|--container|--createrepo|--uninstall) ]]; then
|
||||
debug "Automatically using --install=repo"
|
||||
declare -gi REPO_INSTALL_SWITCH=1
|
||||
else
|
||||
parse_input "$@"
|
||||
fi
|
||||
parse_input "$@"
|
||||
|
||||
# Run the self-updater if enabled
|
||||
((UPDATE_SWITCH)) && update "$@"
|
||||
|
||||
Reference in New Issue
Block a user