Only use beta repo when --betapass is passed, and prefer it

This commit is contained in:
2024-11-12 00:08:49 -05:00
parent 188269e522
commit 11d3f1acb6

View File

@@ -18,7 +18,7 @@
# * Be careful with tabs in heredocs # * Be careful with tabs in heredocs
shopt -s extglob shopt -s extglob
declare -g SCRIPT_VERSION="1.4.4" declare -g SCRIPT_VERSION="1.4.5-dev"
declare -g MC_REPO="bullseye" # should match the MC_VERSION declare -g MC_REPO="bullseye" # should match the MC_VERSION
declare -g MC_VERSION="33.0.37" # Do find all replace declare -g MC_VERSION="33.0.37" # Do find all replace
declare -g BOARD_URL="https://yabb.jriver.com/interact/index.php/board,86.0.html" # MC33 declare -g BOARD_URL="https://yabb.jriver.com/interact/index.php/board,86.0.html" # MC33
@@ -114,10 +114,9 @@ print_help() {
parse_input() { parse_input() {
debug "Running: ${FUNCNAME[0]} $*" debug "Running: ${FUNCNAME[0]} $*"
declare -g BUILD_SWITCH REPO_INSTALL_SWITCH LOCAL_INSTALL_SWITCH \ declare -g BUILD_SWITCH REPO_INSTALL_SWITCH LOCAL_INSTALL_SWITCH \
COMPAT_SWITCH CREATEREPO_SWITCH UNINSTALL_SWITCH \ CONTAINER_INSTALL_SWITCH COMPAT_SWITCH CREATEREPO_SWITCH UNINSTALL_SWITCH \
YES_SWITCH USER_MC_VERSION USER_MC_REPO MJR_FILE \ YES_SWITCH USER_MC_VERSION USER_MC_REPO MJR_FILE \
BETAPASS SERVICE_TYPE VNCPASS USER_DISPLAY \ BETAPASS SERVICE_TYPE VNCPASS USER_DISPLAY BUILD_TARGET CREATEREPO_TARGET
BUILD_TARGET CREATEREPO_TARGET
local long_opts short_opts input local long_opts short_opts input
long_opts="install:,build::,outputdir:,mcversion:,arch:,mcrepo:,compat," long_opts="install:,build::,outputdir:,mcversion:,arch:,mcrepo:,compat,"
long_opts+="restorefile:,betapass:," long_opts+="restorefile:,betapass:,"
@@ -139,6 +138,8 @@ parse_input() {
case $1 in case $1 in
local|rpm|deb) BUILD_SWITCH=1; LOCAL_INSTALL_SWITCH=1 ;; local|rpm|deb) BUILD_SWITCH=1; LOCAL_INSTALL_SWITCH=1 ;;
repo|remote) REPO_INSTALL_SWITCH=1 ;; repo|remote) REPO_INSTALL_SWITCH=1 ;;
container) CONTAINER_INSTALL_SWITCH=1 ;;
*) err "Invalid --install option passed"; exit 1 ;;
esac esac
;; ;;
--build|-b) BUILD_SWITCH=1; shift; BUILD_TARGET="$1" ;; --build|-b) BUILD_SWITCH=1; shift; BUILD_TARGET="$1" ;;
@@ -201,6 +202,10 @@ parse_input() {
if [[ -n $USER_MC_REPO ]] && ((LOCAL_INSTALL_SWITCH)); then if [[ -n $USER_MC_REPO ]] && ((LOCAL_INSTALL_SWITCH)); then
err "--install=local is not compatible with --mcrepo as only the default ($MC_REPO) DEB is available" err "--install=local is not compatible with --mcrepo as only the default ($MC_REPO) DEB is available"
fi fi
if [[ -n $CONTAINER_INSTALL_SWITCH ]] && ((LOCAL_INSTALL_SWITCH || REPO_INSTALL_SWITCH)); then
err "Multiple --install methods are not compatible"
fi
} }
# @description Perform OS detection and generate OS-specific functions # @description Perform OS detection and generate OS-specific functions
@@ -584,7 +589,7 @@ install_mesa_freeworld() {
# @description Installs JRiver Media Center from a remote repository # @description Installs JRiver Media Center from a remote repository
install_mc_repo() { install_mc_repo() {
debug "Running: ${FUNCNAME[0]}" debug "Running: ${FUNCNAME[0]}"
local repo_file repo_text local repo_file repo_text channel
case $ID in case $ID in
fedora|centos) fedora|centos)
@@ -597,28 +602,46 @@ install_mc_repo() {
EOF EOF
;; ;;
debian|ubuntu) debian|ubuntu)
[[ -n $BETAPASS ]] && channel="beta" || channel="latest"
local major_version="${VERSION_ID%%.*}" local major_version="${VERSION_ID%%.*}"
local minor_version="${VERSION_ID##*.}" local minor_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" ]] \ if [[ $ID == "ubuntu" ]] \
&& [[ $major_version -gt 24 || ($major_version -eq 24 && $minor_version -ge 10) ]]; then && [[ $major_version -gt 24 || ($major_version -eq 24 && $minor_version -ge 10) ]]; then
repo_file="/etc/apt/sources.list.d/jriver.sources" # TODO new Ubuntu sources file format if [[ $channel == "beta" ]]; then
local old_repo_file="/etc/apt/sources.list.d/jriver.list" repo_file="/etc/apt/sources.list.d/jriver-beta.sources"
[[ -f $old_repo_file ]] && execute sudo rm -f "$old_repo_file" else
repo_file="/etc/apt/sources.list.d/jriver.sources"
fi
old_repo_files=(
"/etc/apt/sources.list.d/jriver.list"
"/etc/apt/sources.list.d/jriver-beta.list"
"/etc/apt/sources.list.d/jriver_beta.list"
)
for f in "${old_repo_files[@]}"; do
[[ -f $f ]] && execute sudo rm -f "$f"
done
read -r -d '' repo_text <<-EOF read -r -d '' repo_text <<-EOF
Types: deb Types: deb
URIs: http://dist.jriver.com/latest/mediacenter/ URIs: http://dist.jriver.com/$repo/mediacenter/
Signed-By: $keyfile Signed-By: $keyfile
Suites: $MC_REPO Suites: $MC_REPO
Components: main Components: main
EOF EOF
else
if [[ $channel == "beta" ]]; then
execute sudo rm -f "/etc/apt/sources.list.d/jriver_beta.list"
repo_file="/etc/apt/sources.list.d/jriver-beta.list"
else else
repo_file="/etc/apt/sources.list.d/jriver.list" repo_file="/etc/apt/sources.list.d/jriver.list"
repo_text="deb [signed-by=$keyfile arch=amd64,i386,armhf,arm64] http://dist.jriver.com/latest/mediacenter/ $MC_REPO main" repo_text="deb [signed-by=$keyfile arch=amd64,i386,armhf,arm64] http://dist.jriver.com/$repo/mediacenter/ $MC_REPO main"
fi fi
echo "Installing JRiver Media Center RPM key" echo "Installing JRiver Media Center RPM key"
download "http://dist.jriver.com/mediacenter@jriver.com.gpg.key" | download "http://dist.jriver.com/mediacenter@jriver.com.gpg.key" |
gpg --dearmor | sudo tee "$keyfile" &>/dev/null gpg --dearmor | sudo tee "$keyfile" &>/dev/null
fi
;; ;;
*) *)
err "An MC repository for $ID is not yet available" err "An MC repository for $ID is not yet available"
@@ -665,9 +688,11 @@ acquire_deb() {
# Define the repositories to check # Define the repositories to check
local repos=( local repos=(
"https://files.jriver-cdn.com/mediacenter/channels/v$MC_MVERSION/latest/$fname" "https://files.jriver-cdn.com/mediacenter/channels/v$MC_MVERSION/latest/$fname"
"https://files.jriver-cdn.com/mediacenter/test/$fname" "https://files.jriver-cdn.com/mediacenter/test/$fname")
"https://files.jriver-cdn.com/mediacenter/channels/v$MC_MVERSION/beta/$BETAPASS/$fname"
) if [[ -n $BETAPASS ]]; then
repos=("https://files.jriver-cdn.com/mediacenter/channels/v$MC_MVERSION/beta/$BETAPASS/$fname" "${repos[@]}")
fi
# Loop through the repositories and attempt to download # Loop through the repositories and attempt to download
for repo in "${repos[@]}"; do for repo in "${repos[@]}"; do