Change detection for default method
This commit is contained in:
20
installJRMC
20
installJRMC
@@ -115,9 +115,9 @@ print_help() {
|
|||||||
# @arg $@ User input
|
# @arg $@ User input
|
||||||
parse_input() {
|
parse_input() {
|
||||||
debug "Running: ${FUNCNAME[0]} $*"
|
debug "Running: ${FUNCNAME[0]} $*"
|
||||||
declare -gi BUILD_SWITCH=0 REPO_INSTALL_SWITCH=0 LOCAL_INSTALL_SWITCH=0 \
|
declare -gi BUILD_SWITCH REPO_INSTALL_SWITCH LOCAL_INSTALL_SWITCH \
|
||||||
CONTAINER_INSTALL_SWITCH=0 COMPAT_SWITCH=0 CREATEREPO_SWITCH=0 UNINSTALL_SWITCH=0 \
|
CONTAINER_INSTALL_SWITCH CREATEREPO_SWITCH \
|
||||||
YES_SWITCH=0 DEBUG=0
|
COMPAT_SWITCH UNINSTALL_SWITCH YES_SWITCH DEBUG=0
|
||||||
declare -g USER_MC_VERSION USER_MC_REPO MJR_FILE \
|
declare -g USER_MC_VERSION USER_MC_REPO MJR_FILE \
|
||||||
BETAPASS SERVICE_TYPE VNCPASS USER_DISPLAY BUILD_TARGET CREATEREPO_TARGET
|
BETAPASS SERVICE_TYPE VNCPASS USER_DISPLAY BUILD_TARGET CREATEREPO_TARGET
|
||||||
local long_opts short_opts input
|
local long_opts short_opts input
|
||||||
@@ -198,6 +198,14 @@ parse_input() {
|
|||||||
err "Incorrect option provided, see installJRMC --help"; exit 1
|
err "Incorrect option provided, see installJRMC --help"; exit 1
|
||||||
fi
|
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
|
# Print some warnings for unsupported argument combinations
|
||||||
if [[ -n $USER_MC_REPO ]] && ((LOCAL_INSTALL_SWITCH)); then
|
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"
|
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}"
|
USER="${SUDO_USER:-$USER}"
|
||||||
fi
|
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 "$@"
|
parse_input "$@"
|
||||||
fi
|
|
||||||
|
|
||||||
# Run the self-updater if enabled
|
# Run the self-updater if enabled
|
||||||
((UPDATE_SWITCH)) && update "$@"
|
((UPDATE_SWITCH)) && update "$@"
|
||||||
|
|||||||
Reference in New Issue
Block a user