5 Commits

Author SHA1 Message Date
36c52e97a0 1.35.8 release 2026-01-21 18:32:21 -05:00
c671d1ea4f Normalize on Ubuntu codenames, not versions 2026-01-21 18:06:44 -05:00
459185ec9d Add rerun() 2026-01-21 06:47:31 -05:00
869e0995dd Revert use download() for piped re-exec 2026-01-21 06:34:51 -05:00
536123eef9 Use download() for piped re-exec 2026-01-21 06:33:53 -05:00

View File

@@ -21,7 +21,7 @@
# shellcheck disable=SC2329
shopt -s extglob
declare -g SCRIPT_VERSION="1.35.7"
declare -g SCRIPT_VERSION="1.35.8"
declare -g MC_VERSION_HARDCODE="35.0.37" # do find all replace
declare -g MC_REPO_HARDCODE="bookworm" # should match the MC_VERSION_HARDCODE
declare -g BOARD_ID="92.0" # MC35 board ID for fallback latest version detection
@@ -236,18 +236,15 @@ init() {
declare -g USER
declare -g SCRIPT_PATH; SCRIPT_PATH=$(readlink -f "${BASH_SOURCE[0]}")
declare -g SCRIPT_DIR; SCRIPT_DIR=$(readlink -f "$(dirname "${BASH_SOURCE[0]}")")
declare -gi SCRIPT_IS_PIPED=0
# Detect if script is being piped (SCRIPT_PATH won't be a regular file)
if [[ ! -f $SCRIPT_PATH ]]; then
declare -g SCRIPT_IS_PIPED=1
else
declare -g SCRIPT_IS_PIPED=0
fi
[[ ! -f $SCRIPT_PATH ]] && SCRIPT_IS_PIPED=1
declare -g OUTPUT_DIR="$SCRIPT_DIR/output"
declare -g CREATEREPO_WEBROOT="/var/www/jriver"
declare -g CREATEREPO_USER="$USER" # can be root
declare -g ID VERSION_ID ARCH MC_ARCH NAME
declare -g ID VERSION_ID UBUNTU_CODENAME ARCH MC_ARCH NAME
declare -g MC_MVERSION MC_RELEASE MC_PKG MC_RPM MC_ROOT
declare -ga PKG_INSTALL PKG_REMOVE PKG_UPDATE PKG_QUERY
declare -ga SERVICES CONTAINERS
@@ -265,7 +262,7 @@ init() {
fi
# Run the self-updater if enabled
((SELF_UPDATE_SWITCH)) && update "$@"
((SELF_UPDATE_SWITCH)) && ((! SCRIPT_IS_PIPED)) && update "$@"
# Check that the .jriver directory is owned by the user
((YES_SWITCH)) || fix_permissions "$HOME/.jriver" "$USER"
@@ -390,20 +387,10 @@ init() {
# Set default targets
BUILD_TARGET="${BUILD_TARGET:-$ID}"
CREATEREPO_TARGET="${CREATEREPO_TARGET:-$ID}"
# Repo selection (precedence: user > host (MC31+ debian/ubuntu) > hardcoded)
if [[ -n $MC_REPO_USER ]]; then
MC_REPO="$MC_REPO_USER"
elif [[ $ID =~ debian|ubuntu && "${MC_MVERSION_USER:-${MC_VERSION_HARDCODE%%.*}}" -ge 31 ]]; then
MC_REPO=${UBUNTU_CODENAME:-${VERSION_CODENAME:-$MC_REPO_HARDCODE}}
else
MC_REPO="$MC_REPO_HARDCODE"
fi
MC_REPO="${MC_REPO_USER:-${UBUNTU_CODENAME:-$MC_REPO_HARDCODE}}" # user>host>hardcoded
echo "MC source -> target: $MC_REPO $MC_ARCH -> $BUILD_TARGET $ARCH"
set_mc_version
echo "Selected MC version $MC_VERSION from the $MC_REPO repo (via $MC_VERSION_SOURCE)"
# Set additional MC version variables
@@ -616,13 +603,11 @@ install_external_repos() {
# @description Installs host-specific temporary legacy repo for missing dependencies
install_legacy_repo() {
debug "${FUNCNAME[0]}()"
local major_version="${VERSION_ID%%.*}"
local minor_version="${VERSION_ID##*.}"; minor_version="${minor_version#0}" # strip leading zero
local repo_name repo_uri repo_suite repo_key temp_repo_file
case $ID in
ubuntu)
if [[ $major_version -gt 24 || ( $major_version -eq 24 && minor_version -ge 4 ) ]]; then
if [[ $UBUNTU_CODENAME =~ ^[n-z] ]]; then # noble and later
echo "Temporarily adding jammy repository for libwebkit2gtk-4.0-37, etc."
repo_name="ubuntu-jammy-temp"
repo_uri="https://archive.ubuntu.com/ubuntu"
@@ -631,7 +616,7 @@ install_legacy_repo() {
fi
;;
debian)
if [[ $major_version -ge 13 ]]; then
if [[ ${VERSION_ID%%.*} -ge 13 ]]; then
echo "Temporarily adding bookworm repository for libwebkit2gtk-4.0-37, etc."
repo_name="debian-bookworm-temp"
repo_uri="https://deb.debian.org/debian"
@@ -1054,7 +1039,7 @@ install_mc_deb() {
execute sudo rm -f "$temp_deb"
if ask_ok "Remove source DEB and retry?"; then
execute sudo rm -f "$MC_DEB"
exec bash "$SCRIPT_PATH" "$@" "--no-update"
rerun "$@"
fi
return 1
fi
@@ -1716,7 +1701,7 @@ update() {
# If the commit hash has changed, an update occurred
if [[ "$before_pull_hash" != $(git -C "$SCRIPT_DIR" rev-parse HEAD) ]]; then
echo "Detected installJRMC update, restarting"
exec bash "$SCRIPT_PATH" "$@" "--no-update"
rerun "$@"
fi
else
debug "Not in the installJRMC repository, checking for installJRMC update via webscrape."
@@ -1747,7 +1732,7 @@ update() {
execute rm -f "$tmp"
echo "Detected installJRMC update, restarting"
exec bash "$SCRIPT_PATH" "$@" "--no-update"
rerun "$@"
else
debug "Current installJRMC $SCRIPT_VERSION is the latest version"
execute rm -f "$tmp"
@@ -1799,8 +1784,6 @@ main() {
EOF
;;
debian|ubuntu)
local major_version="${VERSION_ID%%.*}"
local minor_version="${VERSION_ID##*.}"; minor_version="${minor_version#0}" # strip leading zero
local keyfile="/usr/share/keyrings/jriver-com-archive-keyring.gpg"
local channel="latest"
[[ -n $BETAPASS ]] && channel="beta"
@@ -1812,8 +1795,8 @@ main() {
fi
echo "Installing repository file: $repo_file"
if [[ ($ID == "ubuntu" && $major_version -ge 24) ||
($ID == "debian" && (-z $major_version || $major_version -ge 12)) ]]; then
if [[ ($ID == "ubuntu" && $UBUNTU_CODENAME =~ ^[n-z]) ||
($ID == "debian" && ${VERSION_ID%%.*} -ge 12) ]]; then
sudo tee "$repo_file" &>/dev/null <<-EOF
Types: deb
URIs: https://dist.jriver.com/$channel/mediacenter/
@@ -1846,13 +1829,7 @@ main() {
[[ -n $LEGACY_REPO_FILE ]] && sudo rm -f "$LEGACY_REPO_FILE"
if [[ $MC_REPO != "$MC_REPO_HARDCODE" ]]; then
echo "Rerunning installJRMC with --mcrepo=$MC_REPO_HARDCODE"
if ((SCRIPT_IS_PIPED)); then
# Re-download and execute if script was piped
curl -fsSL "$SCRIPT_URL" | bash -s -- "$@" "--no-update" "--mcrepo=$MC_REPO_HARDCODE"
exit $?
else
exec bash "$SCRIPT_PATH" "$@" "--no-update" "--mcrepo=$MC_REPO_HARDCODE"
fi
rerun "$@" "--mcrepo=$MC_REPO_HARDCODE"
fi
return 1
fi
@@ -2030,6 +2007,16 @@ create_mc_apt_container() {
buildah run "$CNT" -- sh -c "$cmd" || { err "$cmd failed"; return 1; }
done
}
rerun() {
debug "${FUNCNAME[0]}()" "$@"
if ((SCRIPT_IS_PIPED)); then
# Re-download and execute if script was piped
curl -fsSL "$SCRIPT_URL" | bash -s -- "$@" "--no-update"
exit $?
else
exec bash "$SCRIPT_PATH" "$@" "--no-update"
fi
}
# Roughly turn debugging on for pre-init
# Reset and reparse in parse_input() with getopt