8 Commits 8d59e534a9 ... 9dcb6d690f

Author SHA1 Message Date
  bryan 9dcb6d690f 1.6.4 release 3 weeks ago
  bryan 44c9d3217a Add temp repos to Debian too 3 weeks ago
  bryan 7e75672bcc Add temp repos to Debian too 3 weeks ago
  bryan a8ab51bf81 Add temp repos to Debian too 3 weeks ago
  bryan b0b6556825 Only create .jriver 3 weeks ago
  bryan 6406ca564a If VERSION_ID is empty, treat as new 3 weeks ago
  bryan ffa3dea4b9 Revert Keep container 3 weeks ago
  bryan d5865d8dba Keep container 3 weeks ago
1 changed files with 45 additions and 26 deletions
  1. 45 26
      installJRMC

+ 45 - 26
installJRMC

@@ -19,7 +19,7 @@
 # * Avoid execute() for stdout
 # * Avoid execute() for stdout
 shopt -s extglob
 shopt -s extglob
 
 
-declare -g SCRIPT_VERSION="1.6.3"
+declare -g SCRIPT_VERSION="1.6.4"
 declare -g MC_VERSION="33.0.72" # do find all replace
 declare -g MC_VERSION="33.0.72" # do find all replace
 declare -g MC_REPO="bullseye" # should match the MC_VERSION
 declare -g MC_REPO="bullseye" # should match the MC_VERSION
 # declare -g MC_REPO="bookworm" # should match the MC_VERSION
 # declare -g MC_REPO="bookworm" # should match the MC_VERSION
@@ -621,8 +621,8 @@ install_mc_repo() {
       [[ -n $BETAPASS ]] && channel="beta" || channel="latest"
       [[ -n $BETAPASS ]] && channel="beta" || channel="latest"
       local major_version="${VERSION_ID%%.*}"
       local major_version="${VERSION_ID%%.*}"
       local keyfile="/usr/share/keyrings/jriver-com-archive-keyring.gpg"
       local keyfile="/usr/share/keyrings/jriver-com-archive-keyring.gpg"
-      if [[ $ID == "ubuntu" && $major_version -ge 24 ]] ||
-      [[ $ID == "debian" && $major_version -ge 12 ]]; then
+      if [[ ($ID == "ubuntu" && $major_version -ge 24) ||
+      ($ID == "debian" && (-z $major_version || $major_version -ge 12)) ]]; then
         if [[ $channel == "beta" ]]; then
         if [[ $channel == "beta" ]]; then
           repo_file="/etc/apt/sources.list.d/jriver-beta.sources"
           repo_file="/etc/apt/sources.list.d/jriver-beta.sources"
         else
         else
@@ -961,25 +961,42 @@ install_mc_deb() {
     execute rm -rf "$extract_dir"
     execute rm -rf "$extract_dir"
   fi
   fi
 
 
-  # On Ubuntu 24.04+, add jammy repos for libwebkit2gtk-4.0-37
-  local -i remove_jammy=0
+  # Helper function to add repository
+  add_temp_repo() {
+    local repo_name="$1"
+    local repo_uri="$2"
+    local repo_suite="$3"
+    local repo_key="$4"
+    declare -g TEMP_REPO_FILE="/etc/apt/sources.list.d/${repo_name}.sources"
+
+    echo "Creating temporary repository file $TEMP_REPO_FILE for $repo_suite"
+    sudo bash -c "cat <<-EOF > $TEMP_REPO_FILE
+			Types: deb
+			URIs: $repo_uri
+			Suites: $repo_suite
+			Components: main
+			Architectures: $MC_ARCH
+			Signed-By: $repo_key
+		EOF"
+    "${PKG_UPDATE[@]}" || { err "Package update failed!"; return 1; }
+  }
+
+  # Add older repository for libwebkit2gtk-4.0-37, etc, on newer Debian/Ubuntu
+  local -i remove_temp_repo=0
   if [[ "$ID" == "ubuntu" ]]; then
   if [[ "$ID" == "ubuntu" ]]; then
     local major_version="${VERSION_ID%%.*}"
     local major_version="${VERSION_ID%%.*}"
     local minor_version="${VERSION_ID##*.}"
     local minor_version="${VERSION_ID##*.}"
-    if (( major_version > 24 || (major_version == 24 && minor_version >= 4) )); then
+    if [[ $major_version -gt 24 || ($major_version == 24 && minor_version -ge 4) ]]; then
       echo "Temporarily adding jammy repository for libwebkit2gtk-4.0-37, etc."
       echo "Temporarily adding jammy repository for libwebkit2gtk-4.0-37, etc."
-      local repo_file="/etc/apt/sources.list.d/jammy.sources"
-      echo "Creating repository file $repo_file for jammy"
-      sudo bash -c "cat <<-EOF > $repo_file
-				Types: deb
-				URIs: https://archive.ubuntu.com/ubuntu
-				Suites: jammy
-				Components: main
-				Architectures: $MC_ARCH
-				Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
-			EOF"
-      "${PKG_UPDATE[@]}" || err "Package update failed!"
-      remove_jammy=1
+      remove_temp_repo=1
+      add_temp_repo "jammy" "https://archive.ubuntu.com/ubuntu" "jammy" "/usr/share/keyrings/ubuntu-archive-keyring.gpg"
+    fi
+  elif [[ "$ID" == "debian" ]]; then
+    local major_version="${VERSION_ID%%.*}"
+    if [[ $major_version -ge 13 || -z $major_version ]]; then
+      echo "Temporarily adding bookworm repository for libwebkit2gtk-4.0-37, etc."
+      remove_temp_repo=1
+      add_temp_repo "bookworm" "https://deb.debian.org/debian" "bookworm" "/usr/share/keyrings/debian-archive-keyring.gpg"
     fi
     fi
   fi
   fi
 
 
@@ -992,19 +1009,21 @@ install_mc_deb() {
 
 
   # Use --reinstall to make sure local package is installed over repo package
   # Use --reinstall to make sure local package is installed over repo package
   if ! install_package \
   if ! install_package \
-  --no-install-check \
-  --no-gpg-check \
-  --allow-downgrades \
-  --reinstall \
-  "$temp_deb"; then
+    --no-install-check \
+    --no-gpg-check \
+    --allow-downgrades \
+    --reinstall \
+    "$temp_deb"; then
     err "Local MC DEB installation failed"
     err "Local MC DEB installation failed"
-    ((remove_jammy)) && { echo "Removing jammy repo"; execute sudo rm -f "$repo_file"; }
+    ((remove_temp_repo)) && { echo "Removing temporary repo"; execute sudo rm -f "$TEMP_REPO_FILE"; }
     if ask_ok "Remove source DEB and retry"; then
     if ask_ok "Remove source DEB and retry"; then
       execute sudo rm -f "$MC_DEB" "$temp_deb"
       execute sudo rm -f "$MC_DEB" "$temp_deb"
       exec "$SCRIPT_PATH" "$@" "--no-update"
       exec "$SCRIPT_PATH" "$@" "--no-update"
     fi
     fi
   fi
   fi
-  ((remove_jammy)) && { echo "Removing jammy repo"; execute sudo rm -f "$repo_file"; }
+
+  # Cleanup temporary repository and temporary DEB file
+  ((remove_temp_repo)) && { echo "Removing temporary repo"; execute sudo rm -f "$TEMP_REPO_FILE"; }
   execute sudo rm -f "$temp_deb"
   execute sudo rm -f "$temp_deb"
 }
 }
 
 
@@ -1546,7 +1565,7 @@ disable_btrfs_cow() {
   local mc_user_path="$HOME/.jriver"
   local mc_user_path="$HOME/.jriver"
 
 
   for dir in "$MC_ROOT" "$mc_user_path"; do
   for dir in "$MC_ROOT" "$mc_user_path"; do
-    [[ -d $dir ]] || execute mkdir -p "$dir"
+    [[ -d $mc_user_path ]] || execute mkdir -p "$mc_user_path"
     if [[ $(stat -f -c %T "$dir") == "btrfs" ]] &&
     if [[ $(stat -f -c %T "$dir") == "btrfs" ]] &&
     ! lsattr -d "$dir" | cut -f1 -d" " | grep -q C &&
     ! lsattr -d "$dir" | cut -f1 -d" " | grep -q C &&
     execute sudo chattr +C "$dir"; then
     execute sudo chattr +C "$dir"; then