From 20177ec52cdf39bcce929bd334f37e893e83ed6c Mon Sep 17 00:00:00 2001 From: bryan Date: Wed, 15 Apr 2020 18:42:51 -0400 Subject: [PATCH] Add a ton of debugging --- installJRMC | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 62 insertions(+), 1 deletion(-) diff --git a/installJRMC b/installJRMC index 13243eb..d014a47 100755 --- a/installJRMC +++ b/installJRMC @@ -40,6 +40,8 @@ installJRMC () { _printHelpAndExit () { + _runDebug "${FUNCNAME[0]}" + cat <<-'EOF' USAGE: installJRMC [[OPTION] [VALUE]]... @@ -103,6 +105,8 @@ EOF _parseInput () { + _runDebug "${FUNCNAME[0]}" + if _input=$(getopt -o +vdhu -l rpmbuild,outputdir:,mcversion:,restorefile:,betapass:,service:,version,debug,help,uninstall,createrepo,createrepo-webroot:,createrepo-user:,vncpass:,display: -- "$@"); then eval set -- "$_input" while true; do @@ -168,8 +172,16 @@ EOF } + _runDebug () { + + [[ -n $_debug ]] && echo "Running: " "$@" + } + + _checkUser () { + _runDebug "${FUNCNAME[0]}" + if [[ "$_user" == "root" ]]; then cat < /etc/yum.repos.d/jriver.repo [jriver] name=JRiver Media Center repo by BryanC @@ -386,6 +419,8 @@ EOF' _acquireDeb () { + _runDebug "${FUNCNAME[0]}" + # If necessary, create SOURCES dir [[ ! -d "$_outputdir/SOURCES" ]] && mkdir -p "$_outputdir/SOURCES" @@ -420,6 +455,8 @@ EOF' _buildRPM () { + _runDebug "${FUNCNAME[0]}" + # install build dependencies _installPackage wget dpkg rpm-build @@ -524,6 +561,8 @@ EOF" _runCreateRepo () { + _runDebug "${FUNCNAME[0]}" + _installPackage createrepo_c unset _prefix @@ -564,6 +603,8 @@ EOF" _installRPM () { + _runDebug "${FUNCNAME[0]}" + # skip installing same version _installed_ver="$(rpm --query MediaCenter)" _to_be_installed_ver="MediaCenter-$_mcversion.x86_64" @@ -591,6 +632,8 @@ EOF" _symlinkCerts () { + _runDebug "${FUNCNAME[0]}" + if [[ ! -f /etc/ssl/certs/ca-certificates.crt && \ -f /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem ]]; then echo "Symlinking /etc/ssl/certs/ca-certificates.crt to /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem" @@ -605,6 +648,8 @@ EOF" _restoreLicense () { + _runDebug "${FUNCNAME[0]}" + # Allow user to drop an mjr file next to installJRMC if [[ -z $_restorefile ]]; then for _mjr in "$_basedir"/*.mjr; do @@ -623,6 +668,8 @@ EOF" _openFirewall () { + _runDebug "${FUNCNAME[0]}" + # RHEL if [[ "$ID" =~ ^(fedora|centos)$ ]] && [[ -x $(command -v firewall-cmd) ]]; then if ! firewall-cmd --get-services | grep -q jriver; then @@ -653,6 +700,8 @@ EOF" _setVNCPass () { + _runDebug "${FUNCNAME[0]}" + _vncpassfile="$HOME/.vnc/jrmc_passwd" if [[ -n $_vncpass ]]; then @@ -668,6 +717,8 @@ EOF" _systemctlReloadAndEnable () { + _runDebug "${FUNCNAME[0]}" + echo "Enabling $1" if [[ "$_user" == "root" ]]; then @@ -682,6 +733,8 @@ EOF" _generateServiceVars () { + _runDebug "${FUNCNAME[0]}" + unset _service_fname _service_name _timer_fname _timer_name _user_specifier if [[ "$_user" == "root" ]]; then @@ -702,6 +755,8 @@ EOF" _serviceMediaserver () { + _runDebug "${FUNCNAME[0]}" + _generateServiceVars "jriver-mediaserver" "${_bash_cmd[@]}" "cat <<-EOF > $_service_fname @@ -728,6 +783,8 @@ EOF" _serviceX11VNC () { + _runDebug "${FUNCNAME[0]}" + _installPackage x11vnc _setVNCPass @@ -761,6 +818,8 @@ EOF" _serviceCreaterepo () { + _runDebug "${FUNCNAME[0]}" + _generateServiceVars "jriver-createrepo" "${_bash_cmd[@]}" "cat <<-EOF > $_service_fname @@ -791,6 +850,8 @@ EOF" _uninstall () { + _runDebug "${FUNCNAME[0]}" + read -r -p "Do you really want to uninstall all JRiver Media Center files? [y/N] " _response _response=${_response,,} # tolower [[ ! "$_response" =~ ^(yes|y)$ ]] && echo "Cancelling uninstall..." && exit 0