5 Commits

Author SHA1 Message Date
99cd98a691 Release 1.2.1 2024-08-31 21:16:25 -04:00
2cf10fbf25 Update readme markdown 2024-08-31 21:08:13 -04:00
de1eeb194b Implement automatic repo selection 2024-08-31 21:05:31 -04:00
f96c2e25c0 Move dev back to dev version 2024-08-22 16:52:01 -04:00
b0d6d07a9a Remove legacy MC_STUB (now handled by package) 2024-08-22 16:51:31 -04:00
2 changed files with 67 additions and 184 deletions

View File

@@ -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
@@ -63,7 +63,7 @@ $ installJRMC --help
Uninstall JRiver MC, service files, and firewall rules (does not remove library or media files) Uninstall JRiver MC, service files, and firewall rules (does not remove library or media files)
``` ```
## `--service=` ### `--service=`
```text ```text
jriver-mediaserver [--service-type=user] jriver-mediaserver [--service-type=user]
@@ -84,17 +84,17 @@ jriver-createrepo [--service-type=system]
By default installs as root service to handle www permissions more gracefully By default installs as root service to handle www permissions more gracefully
``` ```
### `--service-type=` #### `--service-type=`
By default, MC services use a sane `--service-type` listed next to the service name in the [`--service=`](#--service) section. User services begin at user login and are managed by the unprivileged user, for example: `systemctl --user stop jriver-mediacenter`. System services begin at boot and are managed by root, for example: `sudo systemctl stop jriver-servicename@username.service`. It is possible to run all services of a particular user at boot using [`sudo loginctl enable-linger username`](https://www.freedesktop.org/software/systemd/man/loginctl.html). By default, MC services use a sane `--service-type` listed next to the service name in the [`--service=`](#--service) section. User services begin at user login and are managed by the unprivileged user, for example: `systemctl --user stop jriver-mediacenter`. System services begin at boot and are managed by root, for example: `sudo systemctl stop jriver-servicename@username.service`. It is possible to run all services of a particular user at boot using [`sudo loginctl enable-linger username`](https://www.freedesktop.org/software/systemd/man/loginctl.html).
Multiple services (but not `--service-types`) can be installed at one time using multiple `--service` blocks: `installJRMC --install repo --service jriver-x11vnc --service jriver-mediacenter` Multiple services (but not `--service-types`) can be installed at one time using multiple `--service` blocks: `installJRMC --install repo --service jriver-x11vnc --service jriver-mediacenter`
### `jriver-x11vnc` versus `jriver-xvnc` #### `jriver-x11vnc` versus `jriver-xvnc`
[jriver-x11vnc](http://www.karlrunge.com/x11vnc/) shares the existing X display via VNC and can be combined with additional services to start Media Center or Media Server. Conversely, [jriver-xvnc](https://tigervnc.org/doc/Xvnc.html) creates a new Xvnc display and starts a JRiver Media Center service in the foreground of the new VNC display. [jriver-x11vnc](http://www.karlrunge.com/x11vnc/) shares the existing X display via VNC and can be combined with additional services to start Media Center or Media Server. Conversely, [jriver-xvnc](https://tigervnc.org/doc/Xvnc.html) creates a new Xvnc display and starts a JRiver Media Center service in the foreground of the new VNC display.
## Containers ### Containers
**Coming soon!** **Coming soon!**
@@ -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`

View File

@@ -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
@@ -16,9 +16,9 @@
shopt -s extglob shopt -s extglob
declare -g SCRIPTVERSION="1.2.0" declare -g SCRIPTVERSION="1.2.1"
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,15 +443,15 @@ 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]}"
declare -g MC_VERSION_SOURCE MC_MVERSION MC_ROOT declare -g MC_VERSION_SOURCE MC_MVERSION MC_ROOT
declare -g MC_PKG MC_RPM MC_STUB MC_STUB_TARGET 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,28 +480,11 @@ 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"
MC_STUB="$MC_ROOT/mc$MC_MVERSION"
MC_STUB_TARGET="/usr/bin/mc$MC_MVERSION"
if [[ $MC_VERSION_SOURCE == "user input" ]]; then if [[ $MC_VERSION_SOURCE == "user input" ]]; then
# Append explicit package version when user provides --mcversion # Append explicit package version when user provides --mcversion
@@ -910,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"
@@ -1071,21 +1088,6 @@ runCreaterepo() {
} }
#######################################
# Symlink MC stub
#######################################
symlinkStub() {
debug "Running: ${FUNCNAME[0]}"
if [[ -f $MC_STUB && ! -e $MC_STUB_TARGET ]]; then
if ! execute sudo ln -fs "$MC_STUB" "$MC_STUB_TARGET"; then
err "Symlinking $MC_STUB to $MC_STUB_TARGET failed"
return 1
fi
fi
}
####################################### #######################################
# Symlink certificates if they do not exist in default location # Symlink certificates if they do not exist in default location
####################################### #######################################
@@ -1344,7 +1346,7 @@ service_jriver-mediacenter() {
Environment=DISPLAY=$THIS_DISPLAY Environment=DISPLAY=$THIS_DISPLAY
ExecStart=/usr/bin/mediacenter$MC_MVERSION $* ExecStart=/usr/bin/mediacenter$MC_MVERSION $*
KillMode=none KillMode=none
ExecStop=$MC_STUB_TARGET /MCC 20007 ExecStop=/usr/bin/mc$MC_MVERSION /MCC 20007
Restart=always Restart=always
RestartSec=10 RestartSec=10
TimeoutStopSec=30 TimeoutStopSec=30
@@ -1399,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
@@ -1553,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
####################################### #######################################
@@ -1661,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
####################################### #######################################
@@ -1749,27 +1642,17 @@ uninstall() {
mv "$SCRIPTDIR/.uninstall" "$SCRIPTDIR/.uninstall.bk" mv "$SCRIPTDIR/.uninstall" "$SCRIPTDIR/.uninstall.bk"
fi fi
if [[ -e $MC_STUB_TARGET ]]; then
echo "Removing $MC_STUB_TARGET"
execute sudo rm -f "$MC_STUB_TARGET"
fi
return 0 return 0
} }
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"