Implement automatic repo selection
This commit is contained in:
@@ -27,7 +27,7 @@ $ installJRMC --help
|
|||||||
--compat
|
--compat
|
||||||
Build/install MC without minimum dependency version requirements
|
Build/install MC without minimum dependency version requirements
|
||||||
--mcversion VERSION
|
--mcversion VERSION
|
||||||
Build or install a specific MC version, ex. "33.0.13" (default: latest version)
|
Build or install a specific MC version, ex. "33.0.15" (default: latest version)
|
||||||
--mcrepo REPO
|
--mcrepo REPO
|
||||||
Specify the MC repository, ex. "bullseye", "bookworm", "noble", etc (default: latest official)
|
Specify the MC repository, ex. "bullseye", "bookworm", "noble", etc (default: latest official)
|
||||||
--arch ARCH
|
--arch ARCH
|
||||||
@@ -118,9 +118,9 @@ Multiple services (but not `--service-types`) can be installed at one time using
|
|||||||
|
|
||||||
Install MC from the repository and start/enable `jriver-mediacenter.service` as a user service.
|
Install MC from the repository and start/enable `jriver-mediacenter.service` as a user service.
|
||||||
|
|
||||||
* `installJRMC --install local --compat --restorefile /path/to/license.mjr --mcversion 33.0.13`
|
* `installJRMC --install local --compat --restorefile /path/to/license.mjr --mcversion 33.0.15`
|
||||||
|
|
||||||
Build and install an MC 33.0.13 comptability RPM locally and activate it using the `/path/to/license.mjr`
|
Build and install an MC 33.0.15 comptability RPM locally and activate it using the `/path/to/license.mjr`
|
||||||
|
|
||||||
* `installJRMC --createrepo --createrepo-webroot /srv/jriver/repo --createrepo-user www-user`
|
* `installJRMC --createrepo --createrepo-webroot /srv/jriver/repo --createrepo-user www-user`
|
||||||
|
|
||||||
|
|||||||
202
installJRMC
202
installJRMC
@@ -1,12 +1,12 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# Install JRiver Media Center and associated services
|
# Install JRiver Media Center and associated services
|
||||||
# See installJRMC --help or printHelp() below
|
# See installJRMC --help or printHelp() below for usage
|
||||||
#
|
#
|
||||||
# Copyright (c) 2021-2024 Bryan C. Roessler
|
# Copyright (c) 2021-2024 Bryan C. Roessler
|
||||||
# This software is released under the Apache License.
|
# This software is released under the Apache License.
|
||||||
# https://www.apache.org/licenses/LICENSE-2.0
|
# https://www.apache.org/licenses/LICENSE-2.0
|
||||||
#
|
#
|
||||||
# TODO (v1.1)
|
# TODO (v2)
|
||||||
# 1. Interactive mode
|
# 1. Interactive mode
|
||||||
# 2. Additional containerization (createrepo and rpmbuild)
|
# 2. Additional containerization (createrepo and rpmbuild)
|
||||||
# 3. Tests
|
# 3. Tests
|
||||||
@@ -18,7 +18,7 @@ shopt -s extglob
|
|||||||
|
|
||||||
declare -g SCRIPTVERSION="1.2.1-dev"
|
declare -g SCRIPTVERSION="1.2.1-dev"
|
||||||
declare -g BOARDURL="https://yabb.jriver.com/interact/index.php/board,86.0.html" # MC33
|
declare -g BOARDURL="https://yabb.jriver.com/interact/index.php/board,86.0.html" # MC33
|
||||||
declare -g MC_VERSION="33.0.13" # Do find all replace
|
declare -g MC_VERSION="33.0.15" # Do find all replace
|
||||||
declare -g MC_DEFAULT_REPO="bullseye" # should match the MC_VERSION
|
declare -g MC_DEFAULT_REPO="bullseye" # should match the MC_VERSION
|
||||||
|
|
||||||
printHelp() {
|
printHelp() {
|
||||||
@@ -176,10 +176,6 @@ init() {
|
|||||||
;;
|
;;
|
||||||
linuxmint|neon|zorin|*ubuntu*)
|
linuxmint|neon|zorin|*ubuntu*)
|
||||||
ID="ubuntu"
|
ID="ubuntu"
|
||||||
if [[ ${VERSION_ID%.*} -ge 24 ]]; then
|
|
||||||
debug "Switching to noble repo for *buntu 24"
|
|
||||||
declare -g MC_REPO='noble'
|
|
||||||
fi
|
|
||||||
;;
|
;;
|
||||||
*suse*)
|
*suse*)
|
||||||
ID="suse"
|
ID="suse"
|
||||||
@@ -210,7 +206,35 @@ init() {
|
|||||||
fi
|
fi
|
||||||
esac
|
esac
|
||||||
|
|
||||||
[[ $ID != "unknown" ]] && debug "Using host platform: $ID $VERSION_ID"
|
# Select the correct repo if unspecified
|
||||||
|
if [[ -z $MC_REPO ]]; then
|
||||||
|
case $ID in
|
||||||
|
debian|ubuntu)
|
||||||
|
if [[ -n $VERSION_CODENAME ]]; then
|
||||||
|
MC_DEFAULT_REPO="$VERSION_CODENAME"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
# For when users try to install legacy versions
|
||||||
|
if [[ -n $USER_MC_VERSION ]]; then
|
||||||
|
case $MC_MVERSION in
|
||||||
|
2[0-6])
|
||||||
|
MC_DEFAULT_REPO="jessie"
|
||||||
|
;;
|
||||||
|
2[7-9]|30)
|
||||||
|
MC_DEFAULT_REPO="buster"
|
||||||
|
;;
|
||||||
|
# After this point, things get messy with
|
||||||
|
# multiple repos for same version
|
||||||
|
31)
|
||||||
|
MC_DEFAULT_REPO="bullseye"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
debug "Using host platform: $ID $VERSION_ID"
|
||||||
|
debug "Using MC repository: ${MC_REPO:-$MC_DEFAULT_REPO}"
|
||||||
|
|
||||||
# Abstract distro-specific package manager commands
|
# Abstract distro-specific package manager commands
|
||||||
case $ID in
|
case $ID in
|
||||||
@@ -276,14 +300,24 @@ parseInput() {
|
|||||||
declare -g USER="${SUDO_USER:-$USER}"
|
declare -g USER="${SUDO_USER:-$USER}"
|
||||||
declare -g HOME; HOME=$(getent passwd "$USER" | cut -d: -f6)
|
declare -g HOME; HOME=$(getent passwd "$USER" | cut -d: -f6)
|
||||||
|
|
||||||
if [[ $# -eq 0 ]] ||
|
if [[ $# -eq 0 && $ID != "unknown" ]]; then
|
||||||
[[ $# -eq 1 && " $1 " =~ ^( --debug | -d | -y | --yes | --auto )$ ]] &&
|
|
||||||
[[ $ID != "unknown" ]]; then
|
|
||||||
REPO_INSTALL_SWITCH=1
|
REPO_INSTALL_SWITCH=1
|
||||||
elif [[ $# -eq 1 && " $1 " =~ ^( --compat )$ ]]; then
|
elif [[ $# -eq 1 || $# -eq 2 ]]; then
|
||||||
|
case "$1" in
|
||||||
|
--debug | -d | -y | --yes | --auto | --mcrepo | --mcversion | \
|
||||||
|
--arch | --betapass | --restorefile | --outputdir)
|
||||||
|
if [[ $ID != "unknown" ]]; then
|
||||||
|
REPO_INSTALL_SWITCH=1
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
--compat)
|
||||||
|
if [[ $# -eq 1 ]]; then
|
||||||
BUILD_SWITCH=1
|
BUILD_SWITCH=1
|
||||||
LOCAL_INSTALL_SWITCH=1
|
LOCAL_INSTALL_SWITCH=1
|
||||||
fi
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
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:,"
|
||||||
@@ -409,7 +443,6 @@ parseInput() {
|
|||||||
|
|
||||||
#######################################
|
#######################################
|
||||||
# Uses several methods to determine the latest JRiver MC version
|
# Uses several methods to determine the latest JRiver MC version
|
||||||
# TODO but how to determine build distro `$MC_REPO=bullseye`?
|
|
||||||
#######################################
|
#######################################
|
||||||
setMCVersion() {
|
setMCVersion() {
|
||||||
debug "Running: ${FUNCNAME[0]}"
|
debug "Running: ${FUNCNAME[0]}"
|
||||||
@@ -418,6 +451,7 @@ setMCVersion() {
|
|||||||
declare -g MC_PKG MC_RPM
|
declare -g MC_PKG MC_RPM
|
||||||
declare cnt
|
declare cnt
|
||||||
|
|
||||||
|
# Determine the latest MC version
|
||||||
# User input
|
# User input
|
||||||
if [[ -n $USER_MC_VERSION ]]; then
|
if [[ -n $USER_MC_VERSION ]]; then
|
||||||
MC_VERSION_SOURCE="user input"
|
MC_VERSION_SOURCE="user input"
|
||||||
@@ -446,23 +480,8 @@ setMCVersion() {
|
|||||||
err "Warning! Using hardcoded version number"
|
err "Warning! Using hardcoded version number"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Set major version var
|
# Set major version number and other variables
|
||||||
MC_MVERSION="${MC_VERSION%%.*}"
|
MC_MVERSION="${MC_VERSION%%.*}"
|
||||||
|
|
||||||
# Set legacy MC repos automatically based on the major version number (if not passed by --mcrepo)
|
|
||||||
# Users can override with --mcrepo
|
|
||||||
case $MC_MVERSION in
|
|
||||||
2[0-6])
|
|
||||||
MC_DEFAULT_REPO="jessie"
|
|
||||||
;;
|
|
||||||
2[7-9]|30)
|
|
||||||
MC_DEFAULT_REPO="buster"
|
|
||||||
;;
|
|
||||||
3[1-3])
|
|
||||||
MC_DEFAULT_REPO="bullseye"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
MC_PKG="mediacenter$MC_MVERSION"
|
MC_PKG="mediacenter$MC_MVERSION"
|
||||||
MC_RPM="$OUTPUTDIR/RPMS/x86_64/mediacenter$MC_MVERSION-$MC_VERSION.x86_64.rpm"
|
MC_RPM="$OUTPUTDIR/RPMS/x86_64/mediacenter$MC_MVERSION-$MC_VERSION.x86_64.rpm"
|
||||||
MC_ROOT="/usr/lib/jriver/Media Center $MC_MVERSION"
|
MC_ROOT="/usr/lib/jriver/Media Center $MC_MVERSION"
|
||||||
@@ -908,7 +927,7 @@ installMCDeb() {
|
|||||||
execute tar xJf "control.tar.xz"
|
execute tar xJf "control.tar.xz"
|
||||||
# Remove minimum version specifiers from control file
|
# Remove minimum version specifiers from control file
|
||||||
sed -i 's/ ([^)]*)//g' "control"
|
sed -i 's/ ([^)]*)//g' "control"
|
||||||
sed -i 's/([^)]*)//g' "control" # TODO MC DEB package error
|
# sed -i 's/([^)]*)//g' "control" # TODO MC DEB package error
|
||||||
[[ $ID == "ubuntu" && ${VERSION_ID%.*} -le 16 ]] &&
|
[[ $ID == "ubuntu" && ${VERSION_ID%.*} -le 16 ]] &&
|
||||||
! grep -q zorin /etc/os-release && # TODO ugly ZorinOS workaround
|
! grep -q zorin /etc/os-release && # TODO ugly ZorinOS workaround
|
||||||
sed -i 's/libva2/libva1/g' "control"
|
sed -i 's/libva2/libva1/g' "control"
|
||||||
@@ -1382,12 +1401,10 @@ service_jriver-xvnc() {
|
|||||||
if (( NOVNCAUTH )); then
|
if (( NOVNCAUTH )); then
|
||||||
start_cmd+=(
|
start_cmd+=(
|
||||||
-name "jriver$NEXT_DISPLAY"
|
-name "jriver$NEXT_DISPLAY"
|
||||||
-SecurityTypes None
|
-SecurityTypes None)
|
||||||
)
|
|
||||||
else
|
else
|
||||||
start_cmd+=(
|
start_cmd+=(
|
||||||
-rfbauth "$HOME/.vnc/jrmc_passwd"
|
-rfbauth "$HOME/.vnc/jrmc_passwd")
|
||||||
)
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
sudo bash -c "cat <<-EOF > $SERVICE_FNAME
|
sudo bash -c "cat <<-EOF > $SERVICE_FNAME
|
||||||
@@ -1536,94 +1553,6 @@ service_jriver-createrepo() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#######################################
|
|
||||||
# CONTAINERS
|
|
||||||
#######################################
|
|
||||||
# container_jriver-createrepo() {
|
|
||||||
# :
|
|
||||||
# }
|
|
||||||
|
|
||||||
|
|
||||||
# container_jriver-xvnc() {
|
|
||||||
# :
|
|
||||||
# }
|
|
||||||
|
|
||||||
|
|
||||||
# container_jriver-mediacenter() {
|
|
||||||
|
|
||||||
# installPackage buildah podman
|
|
||||||
|
|
||||||
# if ! CNT=$(buildah from debian:$DEBIANBASE-slim); then
|
|
||||||
# echo "Bad base image for container, skipping"
|
|
||||||
# return 1
|
|
||||||
# fi
|
|
||||||
|
|
||||||
# brc() { buildah run "$CNT" bash -c "$*"; }
|
|
||||||
|
|
||||||
# brc "add-pkg gnupg2 libxss1 wmctrl xdotool ca-certificates inotify-tools libgbm1 ffmpeg"
|
|
||||||
|
|
||||||
# # Install JRiver
|
|
||||||
# brc "
|
|
||||||
# add-pkg ca-certificates gnupg &&
|
|
||||||
# add-pkg --virtual build-dependencies wget &&
|
|
||||||
# wget -qO- http://dist.jriver.com/mediacenter@jriver.com.gpg.key | tee /etc/apt/trusted.gpg.d/jriver.asc &&
|
|
||||||
# wget -O /etc/apt/sources.list.d/mediacenter${MC_MVERSION}.list http://dist.jriver.com/latest/mediacenter/mediacenter${MC_MVERSION}.list &&
|
|
||||||
# apt update &&
|
|
||||||
# add-pkg mediacenter${MC_MVERSION} &&
|
|
||||||
# del-pkg build-dependencies
|
|
||||||
# "
|
|
||||||
|
|
||||||
# buildah config "$CNT" \
|
|
||||||
# --author "bryanroessler@gmail.com" \
|
|
||||||
# --label maintainer="$MAINTAINER" \
|
|
||||||
# --env TZ="$TZ" \
|
|
||||||
# --workingdir /app \
|
|
||||||
# --cmd "mediacenter$MC_MVERSION"
|
|
||||||
|
|
||||||
|
|
||||||
# # EXPOSE 5800 5900 52100 52101 52199 1900/udp
|
|
||||||
|
|
||||||
# podman_create_cmd=(
|
|
||||||
# podman create
|
|
||||||
# --name "mediacenter$MC_MVERSION"
|
|
||||||
# )
|
|
||||||
|
|
||||||
# podman_create_cmd+=(-v "$HOME/.jriver:/root/.jriver")
|
|
||||||
# podman_create_cmd+=(-v "$DOWNLOAD_ROOT:/downloads:z")
|
|
||||||
# podman_create_cmd+=(-v "$MONITOR_ROOT/nzbs:/nzbs")
|
|
||||||
# podman_create_cmd+=(-p "${CONTAINER[HOST_PORT]}:${CONTAINER[CONTAINER_PORT]}")
|
|
||||||
|
|
||||||
# # mkcdirs() {
|
|
||||||
# # declare dir
|
|
||||||
# # for dir in "$@"; do
|
|
||||||
# # if [[ ! -d "$dir" ]]; then
|
|
||||||
# # if ! mkdir -p "$dir"; then
|
|
||||||
# # err "Could not create directory $dir, check your permissions"
|
|
||||||
# # fi
|
|
||||||
# # fi
|
|
||||||
# # if ! chcon -t container_file_t -R "$dir"; then
|
|
||||||
# # err "Could not set container_file_t attribute for $dir, check your permissions"
|
|
||||||
# # fi
|
|
||||||
# # done
|
|
||||||
# # }
|
|
||||||
|
|
||||||
# # mkcdirs "$HOME/.jriver"
|
|
||||||
|
|
||||||
|
|
||||||
# brc sh -s <<-EOF
|
|
||||||
# wget -q "http://dist.jriver.com/mediacenter@jriver.com.gpg.key" -O- | apt-key add - &>/dev/null
|
|
||||||
# EOF
|
|
||||||
|
|
||||||
# brc wget "http://dist.jriver.com/latest/mediacenter/mediacenter$MC_MVERSION.list" -O "/etc/apt/sources.list.d/mediacenter$MC_MVERSION.list"
|
|
||||||
|
|
||||||
# brc apt update -y -q0
|
|
||||||
|
|
||||||
# brc add-pkg "mediacenter$MC_MVERSION"
|
|
||||||
|
|
||||||
# brc del-pkg .build-deps
|
|
||||||
# }
|
|
||||||
|
|
||||||
|
|
||||||
#######################################
|
#######################################
|
||||||
# Detects if MC is installed on btrfs and disables CoW
|
# Detects if MC is installed on btrfs and disables CoW
|
||||||
#######################################
|
#######################################
|
||||||
@@ -1644,25 +1573,6 @@ disableCoW() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#######################################
|
|
||||||
# Migrate major versions
|
|
||||||
#######################################
|
|
||||||
# migrateLibrary() {
|
|
||||||
# debug "Running: ${FUNCNAME[0]}"
|
|
||||||
|
|
||||||
# declare mc_user_path="$HOME/.jriver"
|
|
||||||
# declare current_config_path="$mc_user_path/Media Center $MC_MVERSION"
|
|
||||||
# declare previous_config_path="$mc_user_path/Media Center $(( MC_MVERSION - 1 ))"
|
|
||||||
|
|
||||||
# if [[ ! -d $current_config_path ]] &&
|
|
||||||
# [[ -d $previous_config_path ]] &&
|
|
||||||
# mkdir -p "$current_config_path"; then
|
|
||||||
# echo "Migrating $previous_config_path to $current_config_path"
|
|
||||||
# cp -fa "$previous_config_path"/* "$current_config_path"
|
|
||||||
# fi
|
|
||||||
# }
|
|
||||||
|
|
||||||
|
|
||||||
#######################################
|
#######################################
|
||||||
# Completely uninstalls MC, services, and firewall rules
|
# Completely uninstalls MC, services, and firewall rules
|
||||||
#######################################
|
#######################################
|
||||||
@@ -1736,19 +1646,13 @@ uninstall() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
tests() {
|
|
||||||
# To test on Mint/16.04: sudo apt install -y spice-vdagent ca-certificates git; export GIT_SSL_NO_VERIFY=1
|
|
||||||
: # TODO
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
debug "Running: ${FUNCNAME[0]} $*"
|
debug "Running: ${FUNCNAME[0]} $*"
|
||||||
|
|
||||||
init
|
|
||||||
|
|
||||||
parseInput "$@"
|
parseInput "$@"
|
||||||
|
|
||||||
|
init
|
||||||
|
|
||||||
debug "Debugging on"
|
debug "Debugging on"
|
||||||
debug "installJRMC version: $SCRIPTVERSION"
|
debug "installJRMC version: $SCRIPTVERSION"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user