|
@@ -6,21 +6,22 @@
|
|
# https://www.apache.org/licenses/LICENSE-2.0
|
|
# https://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
#
|
|
# Use installJRMC --help to see available options or
|
|
# Use installJRMC --help to see available options or
|
|
-# read printHelpAndExit() below.
|
|
|
|
|
|
+# read printHelp() below.
|
|
#
|
|
#
|
|
# TODO:
|
|
# TODO:
|
|
# 1. Raspberry Pi OS support
|
|
# 1. Raspberry Pi OS support
|
|
# 2. Interactive installation (ncurses?)
|
|
# 2. Interactive installation (ncurses?)
|
|
|
|
+# 3. Additional containerization
|
|
|
|
|
|
shopt -s extglob
|
|
shopt -s extglob
|
|
|
|
|
|
-_scriptversion="28.0a1"
|
|
|
|
|
|
+_scriptversion="1.1.0"
|
|
_boardurl="https://yabb.jriver.com/interact/index.php/board,71.0.html" # Media Center 28
|
|
_boardurl="https://yabb.jriver.com/interact/index.php/board,71.0.html" # Media Center 28
|
|
_outputdir="$PWD/output"
|
|
_outputdir="$PWD/output"
|
|
_createrepo_webroot="/srv/jriver"
|
|
_createrepo_webroot="/srv/jriver"
|
|
_exec_user="$(whoami)"
|
|
_exec_user="$(whoami)"
|
|
|
|
|
|
-printHelpAndExit() {
|
|
|
|
|
|
+printHelp() {
|
|
debug "Running: ${FUNCNAME[0]}"
|
|
debug "Running: ${FUNCNAME[0]}"
|
|
|
|
|
|
cat <<- 'EOF'
|
|
cat <<- 'EOF'
|
|
@@ -88,14 +89,10 @@ printHelpAndExit() {
|
|
mediacenter-xvnc
|
|
mediacenter-xvnc
|
|
createrepo
|
|
createrepo
|
|
EOF
|
|
EOF
|
|
-
|
|
|
|
- # Exit using passed exit code
|
|
|
|
- [[ ! -v 1 ]] && exit 0 || exit "$1"
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
init() {
|
|
init() {
|
|
-
|
|
|
|
debug "Running: ${FUNCNAME[0]}"
|
|
debug "Running: ${FUNCNAME[0]}"
|
|
|
|
|
|
getOS
|
|
getOS
|
|
@@ -158,7 +155,13 @@ init() {
|
|
}
|
|
}
|
|
|
|
|
|
# HELPERS
|
|
# HELPERS
|
|
-err() { echo "Error: $*" >&2; }
|
|
|
|
|
|
+askOk() {
|
|
|
|
+ local _response
|
|
|
|
+ read -r -p "$* [y/N]" _response
|
|
|
|
+ _response=${_response,,}
|
|
|
|
+ [[ ! "$_response" =~ ^(yes|y)$ ]] && return 1
|
|
|
|
+ return 0
|
|
|
|
+}
|
|
debug() {
|
|
debug() {
|
|
if [[ -v _debug ]]; then
|
|
if [[ -v _debug ]]; then
|
|
if [[ $# -gt 0 ]]; then
|
|
if [[ $# -gt 0 ]]; then
|
|
@@ -168,6 +171,20 @@ debug() {
|
|
return 1
|
|
return 1
|
|
fi
|
|
fi
|
|
}
|
|
}
|
|
|
|
+err() { echo "Error: $*" >&2; }
|
|
|
|
+getOS() {
|
|
|
|
+ debug "Running: ${FUNCNAME[0]}"
|
|
|
|
+
|
|
|
|
+ if [[ -e "/etc/os-release" ]]; then
|
|
|
|
+ source "/etc/os-release"
|
|
|
|
+ else
|
|
|
|
+ err "/etc/os-release not found"
|
|
|
|
+ err "Your OS is unsupported"
|
|
|
|
+ printHelp && exit 1
|
|
|
|
+ fi
|
|
|
|
+
|
|
|
|
+ debug "Platform: $ID $VERSION_ID"
|
|
|
|
+}
|
|
ifSudo() {
|
|
ifSudo() {
|
|
if [[ "$_exec_user" != "root" ]]; then
|
|
if [[ "$_exec_user" != "root" ]]; then
|
|
sudo "$@"
|
|
sudo "$@"
|
|
@@ -175,13 +192,6 @@ ifSudo() {
|
|
"$@"
|
|
"$@"
|
|
fi
|
|
fi
|
|
}
|
|
}
|
|
-askOk() {
|
|
|
|
- local _response
|
|
|
|
- read -r -p "$* [y/N]" _response
|
|
|
|
- _response=${_response,,}
|
|
|
|
- [[ ! "$_response" =~ ^(yes|y)$ ]] && return 1
|
|
|
|
- return 0
|
|
|
|
-}
|
|
|
|
|
|
|
|
|
|
|
|
#######################################
|
|
#######################################
|
|
@@ -205,7 +215,7 @@ parseInput() {
|
|
if [[ "$_install" == "rpm" ]]; then
|
|
if [[ "$_install" == "rpm" ]]; then
|
|
if [[ ! "$ID" =~ ^(fedora|centos)$ ]]; then
|
|
if [[ ! "$ID" =~ ^(fedora|centos)$ ]]; then
|
|
err "RPM install method not available on $ID"
|
|
err "RPM install method not available on $ID"
|
|
- printHelpAndExit 1
|
|
|
|
|
|
+ printHelp && exit 1
|
|
fi
|
|
fi
|
|
_build=true
|
|
_build=true
|
|
fi
|
|
fi
|
|
@@ -260,7 +270,7 @@ parseInput() {
|
|
_debug="true"
|
|
_debug="true"
|
|
;;
|
|
;;
|
|
--help|-h)
|
|
--help|-h)
|
|
- printHelpAndExit 0
|
|
|
|
|
|
+ printHelp && exit $?
|
|
;;
|
|
;;
|
|
--uninstall|-u)
|
|
--uninstall|-u)
|
|
_uninstall=true
|
|
_uninstall=true
|
|
@@ -274,29 +284,14 @@ parseInput() {
|
|
done
|
|
done
|
|
else
|
|
else
|
|
err "Incorrect options provided"
|
|
err "Incorrect options provided"
|
|
- printHelpAndExit 1
|
|
|
|
|
|
+ printHelp && exit 1
|
|
fi
|
|
fi
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
-getOS() {
|
|
|
|
- debug "Running: ${FUNCNAME[0]}"
|
|
|
|
-
|
|
|
|
- if [[ -e "/etc/os-release" ]]; then
|
|
|
|
- source "/etc/os-release"
|
|
|
|
- else
|
|
|
|
- err "/etc/os-release not found"
|
|
|
|
- err "Your OS is unsupported"
|
|
|
|
- printHelpAndExit 1
|
|
|
|
- fi
|
|
|
|
-
|
|
|
|
- debug "Platform: $ID $VERSION_ID"
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-
|
|
|
|
#######################################
|
|
#######################################
|
|
# If no MC version is provided, find the latest
|
|
# If no MC version is provided, find the latest
|
|
-# Requires:
|
|
|
|
|
|
+# Optional (only required if container method fails):
|
|
# _boardurl
|
|
# _boardurl
|
|
#######################################
|
|
#######################################
|
|
getLatestVersion() {
|
|
getLatestVersion() {
|
|
@@ -420,7 +415,7 @@ addRepo() {
|
|
elif [[ "$ID" =~ ^(debian|ubuntu|linuxmint)$ ]]; then
|
|
elif [[ "$ID" =~ ^(debian|ubuntu|linuxmint)$ ]]; then
|
|
installPackage wget
|
|
installPackage wget
|
|
wget -q "http://dist.jriver.com/mediacenter@jriver.com.gpg.key" -O- | ifSudo apt-key add - > /dev/null 2>&1
|
|
wget -q "http://dist.jriver.com/mediacenter@jriver.com.gpg.key" -O- | ifSudo apt-key add - > /dev/null 2>&1
|
|
- ifSudo wget "http://dist.jriver.com/latest/mediacenter/mediacenter$_mversion.list" -O "/etc/apt/sources.list.d/mediacenter$_mversion.list"
|
|
|
|
|
|
+ ifSudo wget "http://dist.jriver.com/latest/mediacenter/mediacenter$_mversion.list" -O "/etc/apt/sources.list.d/mediacenter$_mversion.list" > /dev/null 2>&1
|
|
fi
|
|
fi
|
|
}
|
|
}
|
|
|
|
|
|
@@ -743,7 +738,7 @@ restoreLicense() {
|
|
|
|
|
|
local _mjr
|
|
local _mjr
|
|
|
|
|
|
- # Allow user to drop an mjr file next to installJRMC
|
|
|
|
|
|
+ # Allow user to put the mjr file next to installJRMC
|
|
if [[ ! -v _restorefile ]]; then
|
|
if [[ ! -v _restorefile ]]; then
|
|
for _mjr in "$PWD"/*.mjr; do
|
|
for _mjr in "$PWD"/*.mjr; do
|
|
[[ $_mjr -nt $_restorefile ]] && _restorefile="$_mjr"
|
|
[[ $_mjr -nt $_restorefile ]] && _restorefile="$_mjr"
|
|
@@ -1245,8 +1240,15 @@ uninstall() {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
-main() {
|
|
|
|
|
|
+tests() {
|
|
|
|
+
|
|
|
|
+ # To test on Mint: sudo apt-get install -y spice-vdagent ca-certificates git
|
|
|
|
+ :
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
|
|
|
|
+main() {
|
|
debug "Running: ${FUNCNAME[0]}"
|
|
debug "Running: ${FUNCNAME[0]}"
|
|
|
|
|
|
init "$@"
|
|
init "$@"
|