Compare commits
1 Commits
ed501ee69b
...
5c534c23bc
| Author | SHA1 | Date | |
|---|---|---|---|
| 5c534c23bc |
42
installJRMC
42
installJRMC
@@ -55,7 +55,7 @@ OPTIONS
|
|||||||
--betapass PASSWORD
|
--betapass PASSWORD
|
||||||
Enter beta team password for access to beta builds
|
Enter beta team password for access to beta builds
|
||||||
--service, -s SERVICE
|
--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
|
--createrepo
|
||||||
Build rpm, copy to webroot, and run createrepo
|
Build rpm, copy to webroot, and run createrepo
|
||||||
--createrepo-webroot PATH
|
--createrepo-webroot PATH
|
||||||
@@ -71,8 +71,7 @@ OPTIONS
|
|||||||
--help, -h
|
--help, -h
|
||||||
Print help dialog and exit
|
Print help dialog and exit
|
||||||
--uninstall, -u
|
--uninstall, -u
|
||||||
Uninstall JRiver MC, cleanup service files, and remove firewall rules (does not remove
|
Uninstall JRiver MC, cleanup service files, and remove firewall rules (does not remove library files)
|
||||||
library files)
|
|
||||||
|
|
||||||
SERVICES
|
SERVICES
|
||||||
|
|
||||||
@@ -179,7 +178,7 @@ EOF
|
|||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
echo "Incorrect options provided"
|
err "Incorrect options provided"
|
||||||
_printHelpAndExit 1
|
_printHelpAndExit 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -191,6 +190,9 @@ EOF
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#######################################
|
||||||
|
# Call this at the beginning of every function in order to track
|
||||||
|
#######################################
|
||||||
_runDebug() {
|
_runDebug() {
|
||||||
|
|
||||||
[[ -n $_debug ]] && echo "Running: " "$@"
|
[[ -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)
|
# 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() {
|
_ifSudo() {
|
||||||
|
|
||||||
@@ -362,6 +362,9 @@ EOF
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
[[ -n $_debug ]] && echo "_pkg_array:" "${_pkg_array[@]}"
|
||||||
|
[[ -n $_debug ]] && echo "_url_pkg_array:" "${_url_pkg_array[@]}"
|
||||||
|
|
||||||
# Install from package name (with gpg check)
|
# Install from package name (with gpg check)
|
||||||
if [[ ${#_pkg_array[@]} -ge 1 ]]; then
|
if [[ ${#_pkg_array[@]} -ge 1 ]]; then
|
||||||
echo "Installing: " "${_pkg_array[@]}"
|
echo "Installing: " "${_pkg_array[@]}"
|
||||||
@@ -450,13 +453,17 @@ EOF
|
|||||||
_installPackage wget
|
_installPackage wget
|
||||||
|
|
||||||
# Get latest version from Interact
|
# 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
|
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"
|
err "MC version could not be scraped. Please specify a version manually using --mcversion or check your --boardurl"
|
||||||
_printHelpAndExit 1
|
_printHelpAndExit 1
|
||||||
|
else
|
||||||
|
echo "$_mcversion"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo "Using version: $_mcversion"
|
||||||
|
|
||||||
# Extract major version number
|
# Extract major version number
|
||||||
_mversion="${_mcversion%%.*}"
|
_mversion="${_mcversion%%.*}"
|
||||||
|
|
||||||
@@ -491,8 +498,8 @@ EOF
|
|||||||
#######################################
|
#######################################
|
||||||
# Clean up nonsensical user input
|
# Clean up nonsensical user input
|
||||||
# Notes:
|
# Notes:
|
||||||
# I try to keep this function as short as possible and jusitfy each decision in the comments
|
# I try to keep this function as short as possible and provide better input options and
|
||||||
# I prefer to provide better input options and sensible defaults than workarounds
|
# sensible defaults than workarounds
|
||||||
# Test:
|
# Test:
|
||||||
# _installJRMC should run sucessfully even without running _sanityChecks()
|
# _installJRMC should run sucessfully even without running _sanityChecks()
|
||||||
#######################################
|
#######################################
|
||||||
@@ -511,8 +518,23 @@ EOF
|
|||||||
done
|
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
|
# Disable sanity checks for now to simplify debugging
|
||||||
#_checkServices
|
_checkServices
|
||||||
|
_checkMCInstalled
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user