浏览代码

Run package update after adding jammy

bryan 2 天之前
父节点
当前提交
4c65c8a964
共有 1 个文件被更改,包括 8 次插入11 次删除
  1. 8 11
      installJRMC

+ 8 - 11
installJRMC

@@ -669,10 +669,7 @@ install_mc_repo() {
   debug "repo_text: $repo_text"
   sudo tee "$repo_file" &>/dev/null <<< "$repo_text"
 
-  if ! "${PKG_UPDATE[@]}"; then
-    err "Package update failed!"
-    return 1
-  fi
+  "${PKG_UPDATE[@]}" || { err "Package update failed!"; return 1; }
 
   if ! install_package \
     --no-install-check \
@@ -1019,20 +1016,20 @@ install_mc_deb() {
 
   # On Ubuntu 24.04+, add jammy repos for libwebkit2gtk-4.0-37
   if [[ "$ID" == "ubuntu" ]]; then
-    major_version="${VERSION_ID%%.*}"
-    minor_version="${VERSION_ID##*.}"
+    local major_version="${VERSION_ID%%.*}"
+    local minor_version="${VERSION_ID##*.}"
     if (( major_version > 24 || (major_version == 24 && minor_version >= 4) )); then
-      repo_file="/etc/apt/sources.list.d/jammy.sources"
-      read -r -d '' repo_text <<-EOF
+      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
-      echo "Creating repository file at $repo_file for jammy"
-      sudo tee "$repo_file" >/dev/null <<< "$repo_text"
+			EOF"
+      "${PKG_UPDATE[@]}" || err "Package update failed!"
     fi
   fi