Replace some debugging with set -x
This commit is contained in:
30
installJRMC
30
installJRMC
@@ -28,7 +28,6 @@ declare -g USER="${SUDO_USER:-$USER}"
|
|||||||
declare -g HOME; HOME=$(getent passwd "$USER" | cut -d: -f6)
|
declare -g HOME; HOME=$(getent passwd "$USER" | cut -d: -f6)
|
||||||
|
|
||||||
printHelp() {
|
printHelp() {
|
||||||
debug "Running: ${FUNCNAME[0]}"
|
|
||||||
|
|
||||||
cat <<-'EOF'
|
cat <<-'EOF'
|
||||||
USAGE:
|
USAGE:
|
||||||
@@ -116,7 +115,6 @@ askOk() {
|
|||||||
# Parses user input and sets sensible defaults
|
# Parses user input and sets sensible defaults
|
||||||
#######################################
|
#######################################
|
||||||
parseInput() {
|
parseInput() {
|
||||||
debug "Running: ${FUNCNAME[0]}"
|
|
||||||
|
|
||||||
declare -g BUILD_SWITCH REPO_INSTALL_SWITCH COMPAT_SWITCH LOCAL_INSTALL_SWITCH CREATEREPO_SWITCH UNINSTALL_SWITCH TEST_SWITCH
|
declare -g BUILD_SWITCH REPO_INSTALL_SWITCH COMPAT_SWITCH LOCAL_INSTALL_SWITCH CREATEREPO_SWITCH UNINSTALL_SWITCH TEST_SWITCH
|
||||||
declare -g OUTPUTDIR RESTOREFILE BETAPASS SERVICE_TYPE VNCPASS USER_DISPLAY CREATEREPO_WEBROOT
|
declare -g OUTPUTDIR RESTOREFILE BETAPASS SERVICE_TYPE VNCPASS USER_DISPLAY CREATEREPO_WEBROOT
|
||||||
@@ -205,6 +203,7 @@ parseInput() {
|
|||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
--debug|-d)
|
--debug|-d)
|
||||||
|
set -x
|
||||||
DEBUG=1
|
DEBUG=1
|
||||||
;;
|
;;
|
||||||
--help|-h)
|
--help|-h)
|
||||||
@@ -236,7 +235,6 @@ parseInput() {
|
|||||||
# Generate OS-specific functions
|
# Generate OS-specific functions
|
||||||
#######################################
|
#######################################
|
||||||
init() {
|
init() {
|
||||||
debug "Running: ${FUNCNAME[0]}"
|
|
||||||
|
|
||||||
declare -g ID RPM_MGR
|
declare -g ID RPM_MGR
|
||||||
|
|
||||||
@@ -335,7 +333,6 @@ init() {
|
|||||||
# TODO but how to determine build distro `$DEBIANBASE=buster`?
|
# TODO but how to determine build distro `$DEBIANBASE=buster`?
|
||||||
#######################################
|
#######################################
|
||||||
setMCVersion() {
|
setMCVersion() {
|
||||||
debug "Running: ${FUNCNAME[0]}"
|
|
||||||
|
|
||||||
declare -g MCVERSION MCVERSION_SOURCE MVERSION MCPKG MCRPM
|
declare -g MCVERSION MCVERSION_SOURCE MVERSION MCPKG MCRPM
|
||||||
declare cnt
|
declare cnt
|
||||||
@@ -396,7 +393,6 @@ setMCVersion() {
|
|||||||
# --silent, -s: Do not report errors (useful if package is not strictly required and errors are noisy)
|
# --silent, -s: Do not report errors (useful if package is not strictly required and errors are noisy)
|
||||||
#######################################
|
#######################################
|
||||||
installPackage() {
|
installPackage() {
|
||||||
debug "Running: ${FUNCNAME[0]}" "$@"
|
|
||||||
|
|
||||||
declare -a pkg_array install_flags
|
declare -a pkg_array install_flags
|
||||||
declare pkg skip_check_installed silent _return pkg_install_cmd
|
declare pkg skip_check_installed silent _return pkg_install_cmd
|
||||||
@@ -473,7 +469,6 @@ installPackage() {
|
|||||||
# Installs JRiver Media Center from a remote repository
|
# Installs JRiver Media Center from a remote repository
|
||||||
#######################################
|
#######################################
|
||||||
installMCFromRepo() {
|
installMCFromRepo() {
|
||||||
debug "Running: ${FUNCNAME[0]}"
|
|
||||||
|
|
||||||
declare repo_dir
|
declare repo_dir
|
||||||
|
|
||||||
@@ -524,7 +519,6 @@ installMCFromRepo() {
|
|||||||
# Acquires the source DEB package from JRiver
|
# Acquires the source DEB package from JRiver
|
||||||
#######################################
|
#######################################
|
||||||
acquireDeb() {
|
acquireDeb() {
|
||||||
debug "Running: ${FUNCNAME[0]}"
|
|
||||||
|
|
||||||
declare -g MCDEB="$OUTPUTDIR/SOURCES/MediaCenter-$MCVERSION-amd64.deb"
|
declare -g MCDEB="$OUTPUTDIR/SOURCES/MediaCenter-$MCVERSION-amd64.deb"
|
||||||
|
|
||||||
@@ -567,7 +561,6 @@ acquireDeb() {
|
|||||||
# Creates a SPEC file and builds the RPM from the source DEB using rpmbuild
|
# Creates a SPEC file and builds the RPM from the source DEB using rpmbuild
|
||||||
#######################################
|
#######################################
|
||||||
buildRPM() {
|
buildRPM() {
|
||||||
debug "Running: ${FUNCNAME[0]}"
|
|
||||||
|
|
||||||
declare i rpmbuild_cmd
|
declare i rpmbuild_cmd
|
||||||
declare -a requires recommends
|
declare -a requires recommends
|
||||||
@@ -737,7 +730,6 @@ buildRPM() {
|
|||||||
# Installs local Media Center DEB package and optional compatability fixes
|
# Installs local Media Center DEB package and optional compatability fixes
|
||||||
#######################################
|
#######################################
|
||||||
installMCDEB() {
|
installMCDEB() {
|
||||||
debug "Running: ${FUNCNAME[0]}"
|
|
||||||
|
|
||||||
declare pkg_install_cmd="installPackage --skip-check-installed --nogpgcheck"
|
declare pkg_install_cmd="installPackage --skip-check-installed --nogpgcheck"
|
||||||
if (( COMPAT_SWITCH )); then
|
if (( COMPAT_SWITCH )); then
|
||||||
@@ -767,7 +759,6 @@ installMCDEB() {
|
|||||||
# Installs local Media Center RPM package
|
# Installs local Media Center RPM package
|
||||||
#######################################
|
#######################################
|
||||||
installMCRPM() {
|
installMCRPM() {
|
||||||
debug "Running: ${FUNCNAME[0]}"
|
|
||||||
installPackage --skip-check-installed --nogpgcheck --allow-downgrades "$MCRPM"
|
installPackage --skip-check-installed --nogpgcheck --allow-downgrades "$MCRPM"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -776,7 +767,6 @@ installMCRPM() {
|
|||||||
# Installs local Media Center PKGBUILD
|
# Installs local Media Center PKGBUILD
|
||||||
#######################################
|
#######################################
|
||||||
installMCARCH() {
|
installMCARCH() {
|
||||||
debug "Running: ${FUNCNAME[0]}"
|
|
||||||
echo "Arch install under construction"
|
echo "Arch install under construction"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -785,7 +775,6 @@ installMCARCH() {
|
|||||||
# Copy the RPM to createrepo-webroot and runs createrepo as the createrepo-user
|
# Copy the RPM to createrepo-webroot and runs createrepo as the createrepo-user
|
||||||
#######################################
|
#######################################
|
||||||
runCreaterepo() {
|
runCreaterepo() {
|
||||||
debug "Running: ${FUNCNAME[0]}"
|
|
||||||
|
|
||||||
declare cr_cmd cr_cp_cmd cr_mkdir_cmd cr_chown_cmd
|
declare cr_cmd cr_cp_cmd cr_mkdir_cmd cr_chown_cmd
|
||||||
|
|
||||||
@@ -841,7 +830,6 @@ runCreaterepo() {
|
|||||||
# Symlink certificates if they do not exist in default location
|
# Symlink certificates if they do not exist in default location
|
||||||
#######################################
|
#######################################
|
||||||
symlinkCerts() {
|
symlinkCerts() {
|
||||||
debug "Running: ${FUNCNAME[0]}"
|
|
||||||
|
|
||||||
declare mc_cert_link="/usr/lib/jriver/Media Center $MVERSION/ca-certificates.crt"
|
declare mc_cert_link="/usr/lib/jriver/Media Center $MVERSION/ca-certificates.crt"
|
||||||
declare target_cert ln_cmd
|
declare target_cert ln_cmd
|
||||||
@@ -869,7 +857,6 @@ symlinkCerts() {
|
|||||||
# Restore the mjr license file if it is next to installJRMC or RESTOREFILE is set
|
# Restore the mjr license file if it is next to installJRMC or RESTOREFILE is set
|
||||||
#######################################
|
#######################################
|
||||||
restoreLicense() {
|
restoreLicense() {
|
||||||
debug "Running: ${FUNCNAME[0]}"
|
|
||||||
|
|
||||||
declare mjrfile
|
declare mjrfile
|
||||||
|
|
||||||
@@ -896,7 +883,6 @@ restoreLicense() {
|
|||||||
# Pre-defined service to enable
|
# Pre-defined service to enable
|
||||||
#######################################
|
#######################################
|
||||||
openFirewall() {
|
openFirewall() {
|
||||||
debug "Running: ${FUNCNAME[0]}" "$@"
|
|
||||||
|
|
||||||
# Create OS-specific port rules based on argument (service) name
|
# Create OS-specific port rules based on argument (service) name
|
||||||
declare -a f_ports # for firewall-cmd
|
declare -a f_ports # for firewall-cmd
|
||||||
@@ -963,7 +949,6 @@ openFirewall() {
|
|||||||
# Service type (xvnc, x11vnc)
|
# Service type (xvnc, x11vnc)
|
||||||
#######################################
|
#######################################
|
||||||
setVNCPass() {
|
setVNCPass() {
|
||||||
debug "Running: ${FUNCNAME[0]}"
|
|
||||||
|
|
||||||
declare vncpassfile="$HOME/.vnc/jrmc_passwd"
|
declare vncpassfile="$HOME/.vnc/jrmc_passwd"
|
||||||
declare vnc_pass_cmd
|
declare vnc_pass_cmd
|
||||||
@@ -1000,7 +985,6 @@ setVNCPass() {
|
|||||||
# Set display and port variables
|
# Set display and port variables
|
||||||
#######################################
|
#######################################
|
||||||
setDisplay() {
|
setDisplay() {
|
||||||
debug "Running: ${FUNCNAME[0]}"
|
|
||||||
|
|
||||||
declare -g DISPLAY DISPLAYNUM NEXT_DISPLAY NEXT_DISPLAYNUM
|
declare -g DISPLAY DISPLAYNUM NEXT_DISPLAY NEXT_DISPLAYNUM
|
||||||
|
|
||||||
@@ -1019,7 +1003,6 @@ setDisplay() {
|
|||||||
# Pre-defined service name
|
# Pre-defined service name
|
||||||
#######################################
|
#######################################
|
||||||
setServiceVars() {
|
setServiceVars() {
|
||||||
debug "Running: ${FUNCNAME[0]}"
|
|
||||||
|
|
||||||
declare -g SERVICE_NAME SERVICE_FNAME TIMER_NAME TIMER_FNAME USER_STRING GRAPHICAL_TARGET
|
declare -g SERVICE_NAME SERVICE_FNAME TIMER_NAME TIMER_FNAME USER_STRING GRAPHICAL_TARGET
|
||||||
declare -g SERVICE_TYPE="${SERVICE_TYPE:-system}"
|
declare -g SERVICE_TYPE="${SERVICE_TYPE:-system}"
|
||||||
@@ -1071,7 +1054,6 @@ setServiceVars() {
|
|||||||
# Passes arguments as startup options to /usr/bin/mediacenter??
|
# Passes arguments as startup options to /usr/bin/mediacenter??
|
||||||
#######################################
|
#######################################
|
||||||
service_jriver-mediacenter() {
|
service_jriver-mediacenter() {
|
||||||
debug "Running: ${FUNCNAME[0]}"
|
|
||||||
|
|
||||||
setServiceVars "${FUNCNAME[0]##*_}"
|
setServiceVars "${FUNCNAME[0]##*_}"
|
||||||
|
|
||||||
@@ -1105,7 +1087,6 @@ service_jriver-mediacenter() {
|
|||||||
# Starts and enables (at startup) a JRiver Media Server service
|
# Starts and enables (at startup) a JRiver Media Server service
|
||||||
#######################################
|
#######################################
|
||||||
service_jriver-mediaserver() {
|
service_jriver-mediaserver() {
|
||||||
debug "Running: ${FUNCNAME[0]}"
|
|
||||||
|
|
||||||
setServiceVars "${FUNCNAME[0]##*_}"
|
setServiceVars "${FUNCNAME[0]##*_}"
|
||||||
|
|
||||||
@@ -1117,7 +1098,6 @@ service_jriver-mediaserver() {
|
|||||||
# Starts and enables (at startup) JRiver Media Center in a new Xvnc session
|
# Starts and enables (at startup) JRiver Media Center in a new Xvnc session
|
||||||
#######################################
|
#######################################
|
||||||
service_jriver-xvnc() {
|
service_jriver-xvnc() {
|
||||||
debug "Running: ${FUNCNAME[0]}"
|
|
||||||
|
|
||||||
setServiceVars "${FUNCNAME[0]##*_}"
|
setServiceVars "${FUNCNAME[0]##*_}"
|
||||||
setDisplay
|
setDisplay
|
||||||
@@ -1163,7 +1143,6 @@ service_jriver-xvnc() {
|
|||||||
# Starts and enables (at startup) x11vnc screen sharing for the local desktop
|
# Starts and enables (at startup) x11vnc screen sharing for the local desktop
|
||||||
#######################################
|
#######################################
|
||||||
service_jriver-x11vnc() {
|
service_jriver-x11vnc() {
|
||||||
debug "Running: ${FUNCNAME[0]}"
|
|
||||||
|
|
||||||
setServiceVars "${FUNCNAME[0]##*_}"
|
setServiceVars "${FUNCNAME[0]##*_}"
|
||||||
setDisplay
|
setDisplay
|
||||||
@@ -1178,7 +1157,6 @@ service_jriver-x11vnc() {
|
|||||||
# Get current desktop resolution
|
# Get current desktop resolution
|
||||||
# TODO: may need to break this out into its own function and get smarter at identifying multi-monitors
|
# TODO: may need to break this out into its own function and get smarter at identifying multi-monitors
|
||||||
# _getResolution() {
|
# _getResolution() {
|
||||||
# debug "Running: ${FUNCNAME[0]}"
|
|
||||||
# installPackage xorg-x11-utils
|
# installPackage xorg-x11-utils
|
||||||
# _res=$(xdpyinfo | grep dimensions | awk '{print $2}')
|
# _res=$(xdpyinfo | grep dimensions | awk '{print $2}')
|
||||||
# }
|
# }
|
||||||
@@ -1227,7 +1205,6 @@ service_jriver-x11vnc() {
|
|||||||
# Center RPM from the source DEB and create/update an RPM repository
|
# Center RPM from the source DEB and create/update an RPM repository
|
||||||
#######################################
|
#######################################
|
||||||
service_jriver-createrepo() {
|
service_jriver-createrepo() {
|
||||||
debug "Running: ${FUNCNAME[0]}"
|
|
||||||
|
|
||||||
if [[ "$CREATEREPO_USER" != "$USER" ]]; then
|
if [[ "$CREATEREPO_USER" != "$USER" ]]; then
|
||||||
USER="root" SERVICE_TYPE="system" setServiceVars "${FUNCNAME[0]##*_}"
|
USER="root" SERVICE_TYPE="system" setServiceVars "${FUNCNAME[0]##*_}"
|
||||||
@@ -1425,7 +1402,6 @@ service_jriver-createrepo() {
|
|||||||
# Detects if MC is installed on btrfs and disables CoW
|
# Detects if MC is installed on btrfs and disables CoW
|
||||||
#######################################
|
#######################################
|
||||||
disableCoW() {
|
disableCoW() {
|
||||||
debug "Running: ${FUNCNAME[0]}"
|
|
||||||
|
|
||||||
declare dir
|
declare dir
|
||||||
declare mc_system_path="/usr/lib/jriver"
|
declare mc_system_path="/usr/lib/jriver"
|
||||||
@@ -1448,7 +1424,6 @@ disableCoW() {
|
|||||||
# Migrate major versions
|
# Migrate major versions
|
||||||
#######################################
|
#######################################
|
||||||
migrateLibrary() {
|
migrateLibrary() {
|
||||||
debug "Running: ${FUNCNAME[0]}"
|
|
||||||
|
|
||||||
declare mc_user_path="$HOME/.jriver"
|
declare mc_user_path="$HOME/.jriver"
|
||||||
declare current_config_path="$mc_user_path/Media Center $MVERSION"
|
declare current_config_path="$mc_user_path/Media Center $MVERSION"
|
||||||
@@ -1467,7 +1442,6 @@ migrateLibrary() {
|
|||||||
# Completely uninstalls MC, services, and firewall rules
|
# Completely uninstalls MC, services, and firewall rules
|
||||||
#######################################
|
#######################################
|
||||||
uninstall() {
|
uninstall() {
|
||||||
debug "Running: ${FUNCNAME[0]}"
|
|
||||||
|
|
||||||
declare service unit f i
|
declare service unit f i
|
||||||
|
|
||||||
@@ -1660,6 +1634,6 @@ main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Quickly turn debugging on (catch for real with getopt in parseInput())
|
# Quickly turn debugging on (catch for real with getopt in parseInput())
|
||||||
[[ " $* " =~ ( --debug | -d ) ]] && echo "First Debugging on!" && DEBUG=1
|
[[ " $* " =~ ( --debug | -d ) ]] && echo "First Debugging on!" && set -x DEBUG=1
|
||||||
|
|
||||||
main "$@"
|
main "$@"
|
||||||
|
|||||||
Reference in New Issue
Block a user