浏览代码

Remove and reacquire broken DEB

bryan 5 月之前
父节点
当前提交
76370a8be8
共有 1 个文件被更改,包括 12 次插入6 次删除
  1. 12 6
      installJRMC

+ 12 - 6
installJRMC

@@ -207,7 +207,7 @@ init() {
   declare -g CREATEREPO_USER="$USER" # can be root
   declare -g CREATEREPO_USER="$USER" # can be root
   declare -g ID VERSION_ID ARCH NAME
   declare -g ID VERSION_ID ARCH NAME
   declare -g MC_MVERSION MC_PKG MC_RPM MC_ROOT 
   declare -g MC_MVERSION MC_PKG MC_RPM MC_ROOT 
-  declare -ga PKG_INSTALL PKG_REMOVE PKG_UPDATE PKG_QUERY DOWNLOAD_CMD
+  declare -ga PKG_INSTALL PKG_REMOVE PKG_UPDATE PKG_QUERY
   declare -ga SERVICES CONTAINERS
   declare -ga SERVICES CONTAINERS
 
 
   # Try to save users from themselves
   # Try to save users from themselves
@@ -366,7 +366,7 @@ init() {
       PKG_REMOVE=(execute sudo apt-get remove --auto-remove -y -q0)
       PKG_REMOVE=(execute sudo apt-get remove --auto-remove -y -q0)
       PKG_UPDATE=(execute sudo apt-get update -y -q0)
       PKG_UPDATE=(execute sudo apt-get update -y -q0)
       PKG_QUERY=(dpkg -s)
       PKG_QUERY=(dpkg -s)
-      PKG_INSTALL_LOCAL() { install_mc_deb; }
+      PKG_INSTALL_LOCAL() { install_mc_deb "$@"; }
       ;;
       ;;
     suse)
     suse)
       PKG_INSTALL=(execute sudo zypper --gpg-auto-import-keys --non-interactive --quiet install --force --no-confirm)
       PKG_INSTALL=(execute sudo zypper --gpg-auto-import-keys --non-interactive --quiet install --force --no-confirm)
@@ -856,7 +856,7 @@ install_mc_deb() {
   debug "Running: ${FUNCNAME[0]}"  
   debug "Running: ${FUNCNAME[0]}"  
 
 
   if (( COMPAT_SWITCH )); then
   if (( COMPAT_SWITCH )); then
-    declare extract_dir && extract_dir="$(mktemp -d)"
+    local extract_dir; extract_dir="$(mktemp -d)"
     pushd "$extract_dir" &>/dev/null || return
     pushd "$extract_dir" &>/dev/null || return
     command -v ar &>/dev/null || { install_package binutils || return 1; }
     command -v ar &>/dev/null || { install_package binutils || return 1; }
     execute ar x "$MC_DEB"
     execute ar x "$MC_DEB"
@@ -878,11 +878,17 @@ install_mc_deb() {
     execute rm -rf "$extract_dir"
     execute rm -rf "$extract_dir"
   fi
   fi
 
 
-  install_package \
+  if ! install_package \
     --no-install-check \
     --no-install-check \
     --no-gpg-check \
     --no-gpg-check \
     --allow-downgrades \
     --allow-downgrades \
-    "$MC_DEB"
+    "$MC_DEB"; then
+    err "Local MC DEB installation failed"
+    if ask_ok "Remove source DEB and retry"; then
+      execute rm -f "$MC_DEB"
+      exec "$SCRIPT_PATH" "$@" "--no-update"
+    fi
+  fi
 }
 }
 
 
 # @description Installs Media Center RPM package on RHEL distros
 # @description Installs Media Center RPM package on RHEL distros
@@ -1620,7 +1626,7 @@ main() {
   fi
   fi
 
 
   if (( LOCAL_INSTALL_SWITCH )); then
   if (( LOCAL_INSTALL_SWITCH )); then
-    if PKG_INSTALL_LOCAL; then
+    if PKG_INSTALL_LOCAL "$@"; then
       echo "JRiver Media Center installed successfully from local package"
       echo "JRiver Media Center installed successfully from local package"
     else
     else
       err "JRiver Media Center local package installation failed"
       err "JRiver Media Center local package installation failed"