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