revert git -x

This commit is contained in:
2022-10-13 14:28:24 -04:00
parent 7d4e771a57
commit e25bab1031

View File

@@ -28,6 +28,7 @@ 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:
@@ -115,6 +116,7 @@ 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
@@ -203,7 +205,6 @@ parseInput() {
exit 0 exit 0
;; ;;
--debug|-d) --debug|-d)
set -x
DEBUG=1 DEBUG=1
;; ;;
--help|-h) --help|-h)
@@ -235,6 +236,7 @@ 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
@@ -333,6 +335,7 @@ 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
@@ -393,6 +396,7 @@ 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
@@ -469,6 +473,7 @@ 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
@@ -519,6 +524,7 @@ 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"
@@ -561,6 +567,7 @@ 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
@@ -730,6 +737,7 @@ 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
@@ -759,6 +767,7 @@ 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"
} }
@@ -767,6 +776,7 @@ 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"
} }
@@ -775,6 +785,7 @@ 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
@@ -830,6 +841,7 @@ 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
@@ -857,6 +869,7 @@ 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
@@ -883,6 +896,7 @@ 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
@@ -949,6 +963,7 @@ 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
@@ -985,6 +1000,7 @@ 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
@@ -1003,6 +1019,7 @@ 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}"
@@ -1054,6 +1071,7 @@ 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]##*_}"
@@ -1087,6 +1105,7 @@ 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]##*_}"
@@ -1098,6 +1117,7 @@ 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
@@ -1143,6 +1163,7 @@ 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
@@ -1157,6 +1178,7 @@ 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}')
# } # }
@@ -1205,6 +1227,7 @@ 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]##*_}"
@@ -1402,6 +1425,7 @@ 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"
@@ -1424,6 +1448,7 @@ 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"
@@ -1442,6 +1467,7 @@ 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
@@ -1634,6 +1660,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!" && set -x DEBUG=1 [[ " $* " =~ ( --debug | -d ) ]] && echo "First Debugging on!" && DEBUG=1
main "$@" main "$@"