1 Commit-ok

Szerző SHA1 Üzenet Dátum
9c1ffac186 debug version, do not use 2020-04-26 16:26:09 -04:00

Fájl megtekintése

@@ -31,7 +31,7 @@ installJRMC() {
_printHelpAndExit() {
debug "Running: ${FUNCNAME[0]}"
_runDebug "${FUNCNAME[0]}"
cat <<-'EOF'
USAGE:
@@ -70,6 +70,8 @@ OPTIONS
Print this script version and exit
--debug, -d
Print debug output
--force, -f
Force reinstallation and ignore/overwrite previous output
--help, -h
Print help dialog and exit
--uninstall, -u
@@ -106,7 +108,7 @@ EOF
_parseInput() {
debug "Running: ${FUNCNAME[0]}"
_runDebug "${FUNCNAME[0]}"
# set default behavior
if [[ $# == 0 ]]; then
@@ -114,7 +116,7 @@ EOF
return 1
fi
if _input=$(getopt -o +vdhus:c: -l install-repo,install-rpmbuild,rpmbuild,outputdir:,mcversion:,restorefile:,betapass:,service-user:,service:,version,debug,help,uninstall,createrepo,createrepo-webroot:,createrepo-user:,vncpass:,display:,container: -- "$@"); then
if _input=$(getopt -o +vdhus:c: -l install-repo,install-rpmbuild,rpmbuild,outputdir:,mcversion:,restorefile:,betapass:,service-user:,service:,version,debug,force,help,uninstall,createrepo,createrepo-webroot:,createrepo-user:,vncpass:,display:,container: -- "$@"); then
eval set -- "$_input"
while true; do
case "$1" in
@@ -157,6 +159,9 @@ EOF
echo "Debugging on"
_debug="true"
;;
--force|-f)
_force="true"
;;
--help|-h)
_printHelpAndExit 0
;;
@@ -195,16 +200,16 @@ EOF
err() {
echo "Error: $*" >&2
echo "[$(date +'%Y-%m-%dT%H:%M:%S%z')]: $*" >&2
}
#######################################
# Call this at the beginning of every function in order to track
#######################################
debug() {
_runDebug() {
[[ -n $_debug ]] && echo "Debug: $*"
[[ -n $_debug ]] && echo "Running: " "$@"
}
@@ -229,7 +234,7 @@ EOF
#######################################
_getOS() {
debug "Running: ${FUNCNAME[0]}"
_runDebug "${FUNCNAME[0]}"
if [[ -e "/etc/os-release" ]]; then
source "/etc/os-release"
@@ -273,7 +278,7 @@ EOF
# Detect OS
_getOS
debug "Running: ${FUNCNAME[0]}"
_runDebug "${FUNCNAME[0]}"
# Agnostic commands
_bash_cmd(){ _ifSudo bash -c "$@"; }
@@ -359,7 +364,7 @@ EOF
#######################################
_installPackage() {
debug "Running: ${FUNCNAME[0]}" "$@"
_runDebug "${FUNCNAME[0]}" "$@"
if _input=$(getopt -o +n -l noquery -- "$@"); then
eval set -- "$_input"
@@ -440,7 +445,7 @@ EOF
#######################################
_packageQuirks() {
debug "Running: ${FUNCNAME[0]}" "$@"
_runDebug "${FUNCNAME[0]}" "$@"
unset _url_pkg
@@ -481,7 +486,7 @@ EOF
#######################################
_setVersion() {
debug "Running: ${FUNCNAME[0]}"
_runDebug "${FUNCNAME[0]}"
if [[ -z "$_mcversion" ]]; then
@@ -538,13 +543,13 @@ EOF
#######################################
_sanityChecks() {
debug "Running: ${FUNCNAME[0]}"
_runDebug "${FUNCNAME[0]}"
# Check for bad service name
#
_checkServices() {
debug "Running: ${FUNCNAME[0]}"
_runDebug "${FUNCNAME[0]}"
for _service in "${_services[@]}"; do
if ! _inArray "$_service" "${_available_services[@]}"; then
@@ -557,7 +562,7 @@ EOF
_checkMCInstalled() {
debug "Running: ${FUNCNAME[0]}"
_runDebug "${FUNCNAME[0]}"
if [[ "${_services[*]}" =~ ^(mediacenter|mediaserver|mediacenter-vncserver)$ ]]; then
if [[ -z $_repoinstall && -z $_rpminstall ]]; then
@@ -573,7 +578,7 @@ EOF
_checkUser() {
debug "Running: ${FUNCNAME[0]}"
_runDebug "${FUNCNAME[0]}"
if [[ "$_exec_user" == "root" && -z "$_service_user" && "${_services[*]}" ]]; then
err "Attempting to install services as the root user"
@@ -586,7 +591,7 @@ EOF
# Enable/disable sanity checks
if _checkServices && _checkMCInstalled && _checkUser; then
debug "Sanity checks passed!"
[[ -n $_debug ]] && echo "Sanity checks passed!"
return 0
else
err "Sanity checks failed!"
@@ -602,7 +607,7 @@ EOF
#######################################
_installMCFromRepo() {
debug "Running: ${FUNCNAME[0]}"
_runDebug "${FUNCNAME[0]}"
echo "Installing latest JRiver Media Center from repo..."
@@ -652,7 +657,7 @@ EOF'
#######################################
_acquireDeb() {
debug "Running: ${FUNCNAME[0]}"
_runDebug "${FUNCNAME[0]}"
local _debfilename="$_outputdir/SOURCES/MediaCenter-${_mcversion}-amd64.deb"
@@ -703,7 +708,7 @@ EOF'
#######################################
_buildRPM() {
debug "Running: ${FUNCNAME[0]}"
_runDebug "${FUNCNAME[0]}"
# install build dependencies
_installPackage wget dpkg rpm-build
@@ -719,11 +724,13 @@ EOF'
local _build_requires=''
fi
if [[ "$ID" == "fedora" && -n $_rpminstall ]]; then
# TODO: find out why this is required since it's not easily available on CentOS
if [[ "$ID" != "centos" ]]; then
local _requires='Requires: pangox-compat >= 0.0.2'
else
local _requires='Requires: libXScrnSaver'
fi
# Create spec file
bash -c "cat <<EOF > $_outputdir/SPECS/mediacenter.spec
Name: MediaCenter
@@ -751,7 +758,6 @@ Requires: mesa-libGL
Requires: libglvnd-glx
Requires: pango >= 1.36
$_requires
Requires: libXScrnSaver
Requires: xdg-utils
Requires: libgomp >= 4.9
Requires: gstreamer1 >= 1.4.4
@@ -791,7 +797,7 @@ EOF"
declare -g _mcrpm="$_outputdir/RPMS/x86_64/MediaCenter-$_mcversion.x86_64.rpm"
# skip rebuilding the rpm if it already exists
if [[ -f "$_mcrpm" ]]; then
if [[ -f "$_mcrpm" && -z "$_force" ]]; then
echo "$_mcrpm already exists. Skipping build step..."
return 0 # this is fine
else
@@ -824,7 +830,7 @@ EOF"
#######################################
_runCreaterepo() {
debug "Running: ${FUNCNAME[0]}"
_runDebug "${FUNCNAME[0]}"
_installPackage createrepo_c
@@ -865,7 +871,7 @@ EOF"
#######################################
_symlinkCerts() {
debug "Running: ${FUNCNAME[0]}"
_runDebug "${FUNCNAME[0]}"
if [[ ! -f /etc/ssl/certs/ca-certificates.crt && \
-f /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem ]]; then
@@ -888,7 +894,7 @@ EOF"
#######################################
_restoreLicense() {
debug "Running: ${FUNCNAME[0]}"
_runDebug "${FUNCNAME[0]}"
local _mjr
@@ -923,7 +929,7 @@ EOF"
#######################################
_openFirewall() {
debug "Running: ${FUNCNAME[0]}"
_runDebug "${FUNCNAME[0]}"
# Create OS-specific port rules based on argument (service) name
local -a _f_ports # for firewall_cmd
@@ -982,7 +988,7 @@ EOF"
#######################################
_setX11VNCPass() {
debug "Running: ${FUNCNAME[0]}"
_runDebug "${FUNCNAME[0]}"
_vncpassfile="$HOME/.vnc/jrmc_passwd"
@@ -1016,7 +1022,7 @@ EOF"
#######################################
_setVNCPass() {
debug "Running: ${FUNCNAME[0]}"
_runDebug "${FUNCNAME[0]}"
_vncpassfile="$HOME/.vnc/jrmc_passwd"
@@ -1107,7 +1113,7 @@ EOF"
#######################################
_service_jriver-mediaserver() {
debug "Running: ${FUNCNAME[0]}"
_runDebug "${FUNCNAME[0]}"
_setDisplayAndPort
@@ -1139,7 +1145,7 @@ EOF"
_service_jriver-mediacenter() {
debug "Running: ${FUNCNAME[0]}"
_runDebug "${FUNCNAME[0]}"
_setDisplayAndPort
@@ -1171,7 +1177,7 @@ EOF"
_service_jriver-vnc-mediacenter() {
debug "Running: ${FUNCNAME[0]}"
_runDebug "${FUNCNAME[0]}"
_installPackage tigervnc-server
@@ -1212,7 +1218,7 @@ EOF"
_service_jriver-x11vnc() {
debug "Running: ${FUNCNAME[0]}"
_runDebug "${FUNCNAME[0]}"
_installPackage x11vnc
@@ -1256,7 +1262,7 @@ EOF"
_service_jriver-createrepo() {
debug "Running: ${FUNCNAME[0]}"
_runDebug "${FUNCNAME[0]}"
_bash_cmd "cat <<-EOF > $_service_fname
[Unit]
@@ -1306,7 +1312,7 @@ EOF"
_uninstall() {
debug "Running: ${FUNCNAME[0]}"
_runDebug "${FUNCNAME[0]}"
read -r -p "Do you really want to uninstall JRiver Media Center? [y/N] " _response
_response=${_response,,} # tolower