1 Commits

Autor SHA1 Mensaje Fecha
5c534c23bc Major refactor, bump version to 0.2 2020-04-24 14:13:27 -04:00

Ver fichero

@@ -55,7 +55,7 @@ OPTIONS
--betapass PASSWORD
Enter beta team password for access to beta builds
--service, -s SERVICE
See SERVICES section below for a list of possible service to install
See SERVICES section below for a list of possible services to install
--createrepo
Build rpm, copy to webroot, and run createrepo
--createrepo-webroot PATH
@@ -71,8 +71,7 @@ OPTIONS
--help, -h
Print help dialog and exit
--uninstall, -u
Uninstall JRiver MC, cleanup service files, and remove firewall rules (does not remove
library files)
Uninstall JRiver MC, cleanup service files, and remove firewall rules (does not remove library files)
SERVICES
@@ -179,7 +178,7 @@ EOF
shift
done
else
echo "Incorrect options provided"
err "Incorrect options provided"
_printHelpAndExit 1
fi
}
@@ -191,6 +190,9 @@ EOF
}
#######################################
# Call this at the beginning of every function in order to track
#######################################
_runDebug() {
[[ -n $_debug ]] && echo "Running: " "$@"
@@ -199,8 +201,6 @@ EOF
#######################################
# Prepend this to any command that you wish to execute with sudo (i.e. when _user is NOT root)
# Arguments:
# Takes one optional argument
#######################################
_ifSudo() {
@@ -362,6 +362,9 @@ EOF
fi
done
[[ -n $_debug ]] && echo "_pkg_array:" "${_pkg_array[@]}"
[[ -n $_debug ]] && echo "_url_pkg_array:" "${_url_pkg_array[@]}"
# Install from package name (with gpg check)
if [[ ${#_pkg_array[@]} -ge 1 ]]; then
echo "Installing: " "${_pkg_array[@]}"
@@ -450,13 +453,17 @@ EOF
_installPackage wget
# Get latest version from Interact
echo -n "Scraping latest MC version number from Interact..."
echo "Scraping latest MC version number from Interact..."
if ! _mcversion=$(wget -qO- "$_boardurl" | grep -o "[0-9][0-9]\.[0-9]\.[0-9]\+" | head -n 1); then
err "MC version could not be scraped. Please specify a version manually using --mcversion or check your --boardurl"
_printHelpAndExit 1
else
echo "$_mcversion"
fi
fi
echo "Using version: $_mcversion"
# Extract major version number
_mversion="${_mcversion%%.*}"
@@ -491,8 +498,8 @@ EOF
#######################################
# Clean up nonsensical user input
# Notes:
# I try to keep this function as short as possible and jusitfy each decision in the comments
# I prefer to provide better input options and sensible defaults than workarounds
# I try to keep this function as short as possible and provide better input options and
# sensible defaults than workarounds
# Test:
# _installJRMC should run sucessfully even without running _sanityChecks()
#######################################
@@ -511,8 +518,23 @@ EOF
done
}
_checkMCInstalled() {
if [[ "${_services[*]}" =~ ^(mediacenter|mediaserver)$ ]]; then
if [[ -z $_repoinstall && -z $_rpminstall ]]; then
if [[ -x $(command -v "mediacenter$_mversion") ]]; then
err "You are attempting to install a service that relies on mediacenter$_mversion but --repo-install/--rpmbuild-install are not set and mediacenter$_mversion is not present"
_printHelpAndExit 1
fi
fi
fi
}
# Disable sanity checks for now to simplify debugging
#_checkServices
_checkServices
_checkMCInstalled
}