6 Commits

Author SHA1 Message Date
2656a083db Alias repo and remote 2023-01-24 12:19:09 -05:00
9cc2416e01 Cleanup formatting 2023-01-24 12:18:05 -05:00
7155e1141c Assign dev version for major change 2023-01-24 11:57:48 -05:00
56898849eb Cleanup output 2023-01-24 11:52:24 -05:00
20ef1b03c5 Replace eval strings with arrays 2023-01-24 11:47:47 -05:00
703433aa94 Tighten up docs, background container work 2023-01-24 10:57:32 -05:00
2 changed files with 210 additions and 260 deletions

View File

@@ -8,7 +8,7 @@ This program will install [JRiver Media Center](https://www.jriver.com/) (JRMC)
Running `installJRMC` without any options will install the latest version of JRiver Media Center from the official JRiver repository (Ubuntu/Debian) or my [unofficial repository](https://repos.bryanroessler.com/jriver/) (Fedora/CentOS) using the system package manager (`--install repo`). If any other option is specified, then the default install method (i.e. `--install repo` or `--install local`) will need to be explicitly specified. This makes it possible to install services and containers independent of MC. Running `installJRMC` without any options will install the latest version of JRiver Media Center from the official JRiver repository (Ubuntu/Debian) or my [unofficial repository](https://repos.bryanroessler.com/jriver/) (Fedora/CentOS) using the system package manager (`--install repo`). If any other option is specified, then the default install method (i.e. `--install repo` or `--install local`) will need to be explicitly specified. This makes it possible to install services and containers independent of MC.
**Note**: As of 1.0b14 major version library migrations are performed if the destination config directory `$HOME/.jriver/Media Center XX` is missing for major release `XX`. However, it is still a good idea to create a manual library backup before migrating major versions. **Note**: As of v1.0b14 major version library migrations are performed if the destination config directory `$HOME/.jriver/Media Center XX` is missing for major release `XX`. However, it is still a good idea to create a manual library backup before migrating major versions.
## Options ## Options
@@ -16,14 +16,14 @@ Running `installJRMC` without any options will install the latest version of JRi
$ installJRMC --help $ installJRMC --help
--install, -i repo|local --install, -i repo|local
repo: Install MC from repository, future updates will be handled by the system package manager repo: Install MC from repository, future updates will be handled by the system package manager
local: Build and install MC package locally local: Build and install MC package locally from official source package
--build[=suse|fedora|centos] --build[=suse|fedora|centos]
Build RPM from source DEB but do not install Build RPM from source DEB but do not install
Optionally, specify a target distro for cross-building (ex. --build=suse, note the '=') Optionally, specify a target distro for cross-building (ex. --build=suse, note the '=')
--compat --compat
Build/install MC without minimum library specifiers Build/install MC without minimum dependency version requirements
--mcversion VERSION --mcversion VERSION
Build or install a specific MC version, ex. "30.0.17" Build or install a specific MC version, ex. "30.0.51"
--outputdir PATH --outputdir PATH
Generate rpmbuild output in this PATH (Default: ./output) Generate rpmbuild output in this PATH (Default: ./output)
--restorefile RESTOREFILE --restorefile RESTOREFILE
@@ -33,7 +33,7 @@ $ installJRMC --help
--service, -s SERVICE --service, -s SERVICE
See SERVICES section below for the list of services to deploy See SERVICES section below for the list of services to deploy
--service-type user|system --service-type user|system
Starts services at boot (system) or user login (user) (Default: system) Starts services at boot (system) or user login (user) (Default: per-service see SERVICES)
--container, -c CONTAINER (TODO: Under construction) --container, -c CONTAINER (TODO: Under construction)
See CONTAINERS section below for a list of containers to deploy See CONTAINERS section below for a list of containers to deploy
--createrepo[=suse|fedora|centos] --createrepo[=suse|fedora|centos]
@@ -56,20 +56,20 @@ $ installJRMC --help
## Services ## Services
```text ```text
jriver-mediaserver jriver-mediaserver (default --service-type=user)
Enable and start a mediaserver systemd service (requires an existing X server) Enable and start a mediaserver systemd service (requires an existing X server)
jriver-mediacenter jriver-mediacenter (user)
Enable and start a mediacenter systemd service (requires an existing X server) Enable and start a mediacenter systemd service (requires an existing X server)
jriver-x11vnc jriver-x11vnc (user)
Enable and start x11vnc for the local desktop (requires an existing X server, does NOT support Wayland) Enable and start x11vnc for the local desktop (requires an existing X server, does NOT support Wayland)
--vncpass and --display are also valid options (see below) --vncpass and --display are also valid options (see below)
jriver-xvnc jriver-xvnc (system)
Enable and start a new Xvnc session running JRiver Media Center Enable and start a new Xvnc session running JRiver Media Center
--vncpass PASSWORD --vncpass PASSWORD
Set vnc password for x11vnc/Xvnc access. If no password is set, the script will either use existing password stored in ~/.vnc/jrmc_passwd or use no password Set vnc password for x11vnc/Xvnc access. If no password is set, the script will either use existing password stored in ~/.vnc/jrmc_passwd or use no password
--display DISPLAY --display DISPLAY
Manually specify display to use for x11vnc/Xvnc (ex. ':1') Manually specify display to use for x11vnc/Xvnc (ex. ':1')
jriver-createrepo jriver-createrepo (system)
Install hourly service to build latest MC RPM and run createrepo Install hourly service to build latest MC RPM and run createrepo
By default installs as root service to handle www permissions more gracefully By default installs as root service to handle www permissions more gracefully
``` ```

View File

@@ -16,12 +16,13 @@
shopt -s extglob shopt -s extglob
declare -g SCRIPTVERSION="1.0-rc4" declare -g SCRIPTVERSION="1.0-dev"
declare -g OUTPUTDIR="$PWD/output" declare -g OUTPUTDIR="$PWD/output"
declare -g BOARDURL="https://yabb.jriver.com/interact/index.php/board,76.0.html" # MC30 (Buster) # MC30 (Buster)
declare -g BOARDURL="https://yabb.jriver.com/interact/index.php/board,76.0.html"
declare -g DEBIANBASE="buster" declare -g DEBIANBASE="buster"
declare -g MCVERSION_HARDCODE="30.0.48" # Hardcoded fallback declare -g MCVERSION_HARDCODE="30.0.51" # Hardcoded fallback
declare -g CREATEREPO_WEBROOT="/var/www/jriver" declare -g CREATEREPO_WEBROOT="/var/www/jriver"
declare -g USER="${SUDO_USER:-$USER}" declare -g USER="${SUDO_USER:-$USER}"
@@ -34,36 +35,37 @@ printHelp() {
USAGE: USAGE:
installJRMC [[OPTION] [VALUE]]... installJRMC [[OPTION] [VALUE]]...
If no options (excluding -d) are provided, the script will default to '--install repo'. If no options (excluding -d or --debug) are provided installJRMC defaults to '--install repo'.
OPTIONS OPTIONS
--install, -i repo|local --install, -i repo|local
repo: Install MC from repository, updates are handled by the system package manager repo: Install MC from repository, updates are handled by the system package manager
local: Build and install MC package locally local: Build and install MC package locally from official source release
--build[=suse|fedora|centos] --build[=suse|fedora|centos]
Build RPM from source DEB but do not install Build RPM from source DEB but do not install
Optionally, specify a target distro for cross-building (ex. --build=suse, note the '=') Optionally, specify a target distro for cross-building (ex. --build=suse, note the '=')
--compat --compat
Build/install MC locally without minimum library specifiers Build/install MC locally without minimum dependency version requirements
--mcversion VERSION --mcversion VERSION
Specify the MC version, ex. "30.0.17" (Default: latest version) Specify the MC version, ex. 30.0.51" (default: latest version)
--outputdir PATH --outputdir PATH
Generate rpmbuild output in this directory (Default: ./output) Generate rpmbuild output in this directory (default: ./output)
--restorefile RESTOREFILE --restorefile RESTOREFILE
Restore file location for automatic license registration (Default: skip registration) Restore file location for automatic license registration (default: skip registration)
--betapass PASSWORD --betapass PASSWORD
Enter beta team password for access to beta builds Enter beta team password for access to beta builds
--service, -s SERVICE --service, -s SERVICE
See SERVICES section below for a list of possible services to install See SERVICES section below for a list of possible services to install
--service-type user|system --service-type user|system
Starts services at boot (system) or at user login (user) (Default: boot) Starts services at boot (system) or at user login (user) (default: per service, see SERVICES)
--container, -c CONTAINER (TODO: Under construction) --container, -c CONTAINER (TODO: Under construction)
See CONTAINERS section below for a list of possible services to install See CONTAINERS section below for a list of possible services to install
--createrepo[=suse|fedora|centos] --createrepo[=suse|fedora|centos]
Build rpm, copy to webroot, and run createrepo. Use in conjunction with --build=TARGET for crossbuilding repos Build rpm, copy to webroot, and run createrepo.
Use in conjunction with --build=TARGET for crossbuilding repos
Optionally, specify a target distro for non-native repo (ex. --createrepo=fedora, note the '=') Optionally, specify a target distro for non-native repo (ex. --createrepo=fedora, note the '=')
--createrepo-webroot PATH --createrepo-webroot PATH
Specify the webroot directory to install the repo (Default: /var/www/jriver) Specify the webroot directory to install the repo (default: /var/www/jriver)
--createrepo-user USER --createrepo-user USER
Specify the web server user if it differs from $USER Specify the web server user if it differs from $USER
--version, -v --version, -v
@@ -73,27 +75,27 @@ printHelp() {
--help, -h --help, -h
Print help dialog and exit Print help dialog and exit
--uninstall, -u --uninstall, -u
Uninstall JRiver MC, remove services, and remove firewall rules (does not remove library files) Uninstall JRiver MC, remove services, containers, and firewall rules (does not remove library files)
SERVICES SERVICES
jriver-mediaserver jriver-mediaserver (default --service-type=user)
Enable and start a mediaserver systemd service (requires an existing X server) (user) Enable and start a mediaserver systemd service (requires an existing X server)
jriver-mediacenter jriver-mediacenter (user)
Enable and start a mediacenter systemd service (requires an existing X server) (user) Enable and start a mediacenter systemd service (requires an existing X server)
jriver-x11vnc jriver-x11vnc (user)
Enable and start x11vnc for the local desktop (requires an existing X server) (user) Enable and start x11vnc for the local desktop (requires an existing X server)
Usually combined with jriver-mediaserver or jriver-mediacenter services Usually combined with jriver-mediaserver or jriver-mediacenter services
--vncpass and --display are optional (see below) --vncpass and --display are optional (see below)
jriver-xvnc jriver-xvnc (system)
Enable and start a new Xvnc session running JRiver Media Center (system) Enable and start a new Xvnc session running JRiver Media Center
--vncpass PASSWORD --vncpass PASSWORD
Set vnc password for x11vnc/Xvnc access. If no password is set, the script Set the vnc password for x11vnc/Xvnc access. If no password is set, installJRMC
will either use existing password stored in $HOME/.vnc/jrmc_passwd or use no password will either use existing password stored in $HOME/.vnc/jrmc_passwd or use no password
--display DISPLAY --display DISPLAY
Display to start x11vnc/Xvnc (Default: The current display (x11vnc) or the Display to use for x11vnc/Xvnc (default: The current display (x11vnc) or the
current display incremented by 1 (Xvnc)) current display incremented by 1 (Xvnc))
jriver-createrepo jriver-createrepo (system)
Install hourly service to build latest MC RPM and run createrepo (system) Install hourly service to build latest MC RPM and run createrepo
CONTAINERS (TODO: Under construction) CONTAINERS (TODO: Under construction)
mediacenter-xvnc mediacenter-xvnc
@@ -117,7 +119,8 @@ askOk() {
parseInput() { parseInput() {
debug "Running: ${FUNCNAME[0]}" debug "Running: ${FUNCNAME[0]}"
declare -g BUILD_SWITCH REPO_INSTALL_SWITCH COMPAT_SWITCH LOCAL_INSTALL_SWITCH CREATEREPO_SWITCH UNINSTALL_SWITCH TEST_SWITCH declare -g BUILD_SWITCH REPO_INSTALL_SWITCH COMPAT_SWITCH
declare -g LOCAL_INSTALL_SWITCH CREATEREPO_SWITCH UNINSTALL_SWITCH TEST_SWITCH
declare -g OUTPUTDIR RESTOREFILE BETAPASS SERVICE_TYPE VNCPASS USER_DISPLAY CREATEREPO_WEBROOT declare -g OUTPUTDIR RESTOREFILE BETAPASS SERVICE_TYPE VNCPASS USER_DISPLAY CREATEREPO_WEBROOT
declare -ga SERVICES CONTAINERS declare -ga SERVICES CONTAINERS
declare long_opts short_opts input declare long_opts short_opts input
@@ -149,7 +152,7 @@ parseInput() {
BUILD_SWITCH=1 BUILD_SWITCH=1
LOCAL_INSTALL_SWITCH=1 LOCAL_INSTALL_SWITCH=1
;; ;;
repo) repo|remote)
REPO_INSTALL_SWITCH=1 REPO_INSTALL_SWITCH=1
;; ;;
esac esac
@@ -277,7 +280,7 @@ init() {
ID="debian" ID="debian"
;; ;;
*) *)
echo "Autodetecting distro, this may be unreliable and --compat may also be required" err "Autodetecting distro, this is unreliable and --compat may also be required"
if hash dnf &>/dev/null; then if hash dnf &>/dev/null; then
ID="fedora" ID="fedora"
RPM_MGR="dnf" RPM_MGR="dnf"
@@ -297,7 +300,7 @@ init() {
debug "Using host platform: $ID $VERSION_ID" debug "Using host platform: $ID $VERSION_ID"
# Set distro-specific functions # Abstract distro-specific package manager commands
case "$ID" in case "$ID" in
fedora|centos) fedora|centos)
pkg_install(){ sudo "$RPM_MGR" install -y "$@"; } pkg_install(){ sudo "$RPM_MGR" install -y "$@"; }
@@ -306,7 +309,6 @@ init() {
pkg_update(){ sudo "$RPM_MGR" makecache; } pkg_update(){ sudo "$RPM_MGR" makecache; }
pkg_swap() { sudo dnf swap -y "$1" "$2"; } pkg_swap() { sudo dnf swap -y "$1" "$2"; }
pkg_query(){ rpm -q "$@"; } pkg_query(){ rpm -q "$@"; }
firewall_cmd(){ sudo firewall-cmd "$@"; }
;; ;;
debian|ubuntu) debian|ubuntu)
pkg_install(){ sudo apt-get install -y -q0 "$@"; } pkg_install(){ sudo apt-get install -y -q0 "$@"; }
@@ -314,7 +316,6 @@ init() {
pkg_remove(){ sudo apt-get remove --auto-remove -y -q0 "$@"; } pkg_remove(){ sudo apt-get remove --auto-remove -y -q0 "$@"; }
pkg_update(){ sudo apt-get update -y -q0; } pkg_update(){ sudo apt-get update -y -q0; }
pkg_query(){ dpkg -s "$@"; } pkg_query(){ dpkg -s "$@"; }
firewall_cmd(){ sudo ufw "$@"; }
;; ;;
suse) suse)
pkg_install(){ sudo zypper --non-interactive -q install --force --no-confirm "$@"; } pkg_install(){ sudo zypper --non-interactive -q install --force --no-confirm "$@"; }
@@ -322,7 +323,6 @@ init() {
pkg_remove(){ sudo zypper --non-interactive -q remove --clean-deps "$@"; } pkg_remove(){ sudo zypper --non-interactive -q remove --clean-deps "$@"; }
pkg_update(){ sudo zypper --non-interactive -q refresh jriver; } pkg_update(){ sudo zypper --non-interactive -q refresh jriver; }
pkg_query(){ rpm -q "$@"; } pkg_query(){ rpm -q "$@"; }
firewall_cmd(){ sudo firewall-cmd "$@"; }
;; ;;
arch) arch)
pkg_install(){ sudo pacman -Sy --noconfirm "$@"; } pkg_install(){ sudo pacman -Sy --noconfirm "$@"; }
@@ -330,7 +330,6 @@ init() {
pkg_remove(){ sudo pacman -Rs --noconfirm "$@"; } pkg_remove(){ sudo pacman -Rs --noconfirm "$@"; }
pkg_update(){ sudo pacman -Syy ; } pkg_update(){ sudo pacman -Syy ; }
pkg_query(){ sudo pacman -Qs "$@"; } pkg_query(){ sudo pacman -Qs "$@"; }
#firewall_cmd(){ sudo nft -A INPUT "$@"; }
;; ;;
esac esac
} }
@@ -373,7 +372,7 @@ setMCVersion() {
else else
MCVERSION="$MCVERSION_HARDCODE" MCVERSION="$MCVERSION_HARDCODE"
MCVERSION_SOURCE="hardcoded version" MCVERSION_SOURCE="hardcoded version"
err "Warning! Using hardcoded version number." err "Warning! Using hardcoded version number"
fi fi
MVERSION="${MCVERSION%%.*}" MVERSION="${MCVERSION%%.*}"
@@ -391,8 +390,8 @@ setMCVersion() {
;; ;;
esac esac
fi fi
echo "Using MC version $MCVERSION determined by $MCVERSION_SOURCE." echo "Using MC version $MCVERSION determined by $MCVERSION_SOURCE"
[[ "$MCVERSION_SOURCE" == "user input" ]] || echo "To override, use --mcversion." [[ "$MCVERSION_SOURCE" == "user input" ]] || echo "To override, use --mcversion"
debug "MVERSION: $MVERSION, MCVERSION: $MCVERSION, MCPKG: $MCPKG, MCRPM: $MCRPM" debug "MVERSION: $MVERSION, MCVERSION: $MCVERSION, MCPKG: $MCPKG, MCRPM: $MCRPM"
} }
@@ -410,8 +409,8 @@ setMCVersion() {
installPackage() { installPackage() {
debug "Running: ${FUNCNAME[0]}" "$@" debug "Running: ${FUNCNAME[0]}" "$@"
declare -a pkg_array install_flags declare -a pkg_array install_flags pkg_install_cmd
declare input pkg skip_check_installed silent pkg_install_cmd refresh allow_downgrades no_gpg_check declare input pkg skip_check_installed silent refresh allow_downgrades no_gpg_check
declare -A pkg_aliases declare -A pkg_aliases
if input=$(getopt -o +s -l skip-check-installed,allow-downgrades,no-gpg-check,refresh,silent -- "$@"); then if input=$(getopt -o +s -l skip-check-installed,allow-downgrades,no-gpg-check,refresh,silent -- "$@"); then
@@ -483,9 +482,9 @@ installPackage() {
# Install packages from package array # Install packages from package array
if [[ ${#pkg_array[@]} -ge 1 ]]; then if [[ ${#pkg_array[@]} -ge 1 ]]; then
pkg_install_cmd="pkg_install ${install_flags[*]} ${pkg_array[*]}" pkg_install_cmd=(pkg_install "${install_flags[@]}" "${pkg_array[@]}")
debug "$pkg_install_cmd" || pkg_install_cmd+=" &>/dev/null" debug "${pkg_install_cmd[*]}" || pkg_install_cmd+=(" &>/dev/null")
if ! eval "$pkg_install_cmd"; then if ! eval "${pkg_install_cmd[*]}"; then
(( silent )) || err "Failed to install ${pkg_array[*]}. Attempting to continue" (( silent )) || err "Failed to install ${pkg_array[*]}. Attempting to continue"
return 1 return 1
fi fi
@@ -501,6 +500,7 @@ installMCFromRepo() {
debug "Running: ${FUNCNAME[0]}" debug "Running: ${FUNCNAME[0]}"
declare repo_dir declare repo_dir
declare -a pkg_install_cmd
case "$ID" in case "$ID" in
fedora|centos) fedora|centos)
@@ -523,15 +523,15 @@ installMCFromRepo() {
wget -qO- "http://dist.jriver.com/mediacenter@jriver.com.gpg.key" | sudo tee /etc/apt/trusted.gpg.d/jriver.asc &>/dev/null wget -qO- "http://dist.jriver.com/mediacenter@jriver.com.gpg.key" | sudo tee /etc/apt/trusted.gpg.d/jriver.asc &>/dev/null
;; ;;
*) *)
err "An MC repository for $ID is not yet available." err "An MC repository for $ID is not yet available"
err "Try using --install local to install MC on $ID." err "Try using --install local to install MC on $ID"
return 1 return 1
;; ;;
esac esac
declare pkg_update_cmd="pkg_update" declare -a pkg_update_cmd=( pkg_update )
debug "$pkg_update_cmd" || pkg_update_cmd+=" &>/dev/null" debug "${pkg_update_cmd[*]}" || pkg_update_cmd+=(" &>/dev/null")
if ! eval "$pkg_update_cmd"; then if ! eval "${pkg_update_cmd[*]}"; then
err "Package update failed!" err "Package update failed!"
return 1 return 1
fi fi
@@ -539,9 +539,13 @@ installMCFromRepo() {
# Install mesa-va-drivers-freeworld separately from the RPM for dnf swap # Install mesa-va-drivers-freeworld separately from the RPM for dnf swap
installMesa installMesa
declare pkg_install_cmd="installPackage --skip-check-installed --allow-downgrades --no-gpg-check $MCPKG" pkg_install_cmd=(installPackage
debug "$pkg_install_cmd" --skip-check-installed
if ! eval "$pkg_install_cmd"; then --allow-downgrades
--no-gpg-check
"$MCPKG")
debug "${pkg_install_cmd[*]}" || pkg_install_cmd+=(" &>/dev/null")
if ! eval "${pkg_install_cmd[*]}"; then
err "Package install failed!" err "Package install failed!"
return 1 return 1
fi fi
@@ -565,12 +569,10 @@ acquireDeb() {
return 0 return 0
fi fi
if [[ -v BETAPASS ]]; then if [[ -v BETAPASS ]] &&
echo "Checking beta repo for DEB package" echo "Checking beta repo for DEB package" && wget -q -O "$MCDEB" \
if wget -q -O "$MCDEB" \
"https://files.jriver.com/mediacenter/channels/v$MVERSION/beta/$BETAPASS/MediaCenter-$MCVERSION-amd64.deb"; then "https://files.jriver.com/mediacenter/channels/v$MVERSION/beta/$BETAPASS/MediaCenter-$MCVERSION-amd64.deb"; then
echo "Found!" echo "Found!"
fi
elif echo "Checking latest repo for DEB package" && wget -q -O "$MCDEB" \ elif echo "Checking latest repo for DEB package" && wget -q -O "$MCDEB" \
"https://files.jriver.com/mediacenter/channels/v$MVERSION/latest/MediaCenter-$MCVERSION-amd64.deb"; then "https://files.jriver.com/mediacenter/channels/v$MVERSION/latest/MediaCenter-$MCVERSION-amd64.deb"; then
echo "Found!" echo "Found!"
@@ -606,7 +608,7 @@ buildRPM() {
return 0 return 0
fi fi
[[ ! -d "$OUTPUTDIR/SPECS" ]] && mkdir -p "$OUTPUTDIR/SPECS" [[ -d "$OUTPUTDIR/SPECS" ]] || mkdir -p "$OUTPUTDIR/SPECS"
# Load deb dependencies into array # Load deb dependencies into array
IFS=',' read -ra requires <<< "$(dpkg-deb -f "$MCDEB" Depends)" IFS=',' read -ra requires <<< "$(dpkg-deb -f "$MCDEB" Depends)"
@@ -746,15 +748,18 @@ buildRPM() {
# Run rpmbuild # Run rpmbuild
echo "Building MC $MCVERSION RPM, this may take awhile" echo "Building MC $MCVERSION RPM, this may take awhile"
rpmbuild_cmd="rpmbuild --define=\"%_topdir $OUTPUTDIR\" --define=\"%_libdir /usr/lib\" -bb" rpmbuild_cmd=(rpmbuild
rpmbuild_cmd+=" $OUTPUTDIR/SPECS/mediacenter.spec" --define=\"%_topdir "$OUTPUTDIR"\"
debug "$rpmbuild_cmd" || rpmbuild_cmd+=" &>/dev/null" --define=\"%_libdir /usr/lib\"
if eval "$rpmbuild_cmd" && [[ -f "$MCRPM" ]] ; then -bb
"$OUTPUTDIR/SPECS/mediacenter.spec")
debug "${rpmbuild_cmd[*]}" || rpmbuild_cmd+=(" &>/dev/null")
if eval "${rpmbuild_cmd[*]}" && [[ -f "$MCRPM" ]] ; then
echo "Build successful. The RPM file is located at: $MCRPM" echo "Build successful. The RPM file is located at: $MCRPM"
else else
err "Build failed" err "Build failed"
# For automation, let's remove the source DEB and reaquire it on next run # For automation, let's remove the source DEB and reaquire it on next
# after failure in case it is corrupted or buggy # run after failure in case it is corrupted or buggy
[[ -f "$MCDEB" ]] && echo "Removing source DEB" && rm -f "$MCDEB" [[ -f "$MCDEB" ]] && echo "Removing source DEB" && rm -f "$MCDEB"
exit 1 exit 1
fi fi
@@ -767,7 +772,11 @@ buildRPM() {
installMCDEB() { installMCDEB() {
debug "Running: ${FUNCNAME[0]}" debug "Running: ${FUNCNAME[0]}"
declare pkg_install_cmd="installPackage --skip-check-installed --no-gpg-check --allow-downgrades" declare pkg_install_cmd
pkg_install_cmd=(installPackage
--skip-check-installed
--no-gpg-check
--allow-downgrades)
if (( COMPAT_SWITCH )); then if (( COMPAT_SWITCH )); then
declare extract_dir && extract_dir="$(mktemp -d)" declare extract_dir && extract_dir="$(mktemp -d)"
pushd "$extract_dir" &>/dev/null || return pushd "$extract_dir" &>/dev/null || return
@@ -784,9 +793,9 @@ installMCDEB() {
popd &>/dev/null || return popd &>/dev/null || return
rm -rf "$extract_dir" rm -rf "$extract_dir"
fi fi
pkg_install_cmd+=" $MCDEB" pkg_install_cmd+=("$MCDEB")
debug "$pkg_install_cmd" || pkg_install_cmd+=" &>/dev/null" debug "${pkg_install_cmd[*]}" || pkg_install_cmd+=(" &>/dev/null")
eval "$pkg_install_cmd" eval "${pkg_install_cmd[*]}"
} }
@@ -809,14 +818,16 @@ installMCRPM() {
installMesa() { installMesa() {
debug "Running: ${FUNCNAME[0]}" debug "Running: ${FUNCNAME[0]}"
declare -a pkg_swap_cmd
# Currently only necessary in Fedora/CentOS # Currently only necessary in Fedora/CentOS
case "$ID" in case "$ID" in
fedora|centos) fedora|centos)
if ! pkg_query mesa-va-drivers-freeworld &>/dev/null; then if ! pkg_query mesa-va-drivers-freeworld &>/dev/null; then
if pkg_query mesa-va-drivers &>/dev/null; then if pkg_query mesa-va-drivers &>/dev/null; then
declare pkg_swap_cmd="pkg_swap mesa-va-drivers mesa-va-drivers-freeworld" pkg_swap_cmd=(pkg_swap mesa-va-drivers mesa-va-drivers-freeworld)
debug "$pkg_swap_cmd" || pkg_swap_cmd+=" &>/dev/null" debug "${pkg_swap_cmd[*]}" || pkg_swap_cmd+=(" &>/dev/null")
if ! eval "$pkg_swap_cmd"; then if ! eval "${pkg_swap_cmd[*]}"; then
err "Package swap failed!" err "Package swap failed!"
return 1 return 1
fi fi
@@ -835,6 +846,9 @@ installMesa() {
####################################### #######################################
installMCARCH() { installMCARCH() {
debug "Running: ${FUNCNAME[0]}" debug "Running: ${FUNCNAME[0]}"
declare -a makepkg_cmd
echo "Arch install under construction" echo "Arch install under construction"
[[ -d "$OUTPUTDIR/PKGBUILD" ]] || mkdir -p "$OUTPUTDIR/PKGBUILD" [[ -d "$OUTPUTDIR/PKGBUILD" ]] || mkdir -p "$OUTPUTDIR/PKGBUILD"
cat <<-EOF > "$OUTPUTDIR/PKGBUILD/mediacenter.pkgbuild" cat <<-EOF > "$OUTPUTDIR/PKGBUILD/mediacenter.pkgbuild"
@@ -863,13 +877,19 @@ installMCARCH() {
} }
EOF EOF
pushd "$OUTPUTDIR/PKGBUILD" &>/dev/null || return makepkg_cmd=(makepkg --install
makepkg_cmd="makepkg" --syncdeps
# TODO try to acquire checksums from deb --clean
makepkg_cmd+=" --syncdeps --clean --cleanbuild --skipinteg --force --install --noconfirm" --cleanbuild
makepkg_cmd+=" -p mediacenter.pkgbuild" --skipinteg
--force
--noconfirm
-p mediacenter.pkgbuild)
if ! eval "${makepkg_cmd}"; then pushd "$OUTPUTDIR/PKGBUILD" &>/dev/null || return
debug "${makepkg_cmd[*]}" || makepkg_cmd+=(" &>/dev/null")
if ! eval "${makepkg_cmd[*]}"; then
echo "makepkg failed" echo "makepkg failed"
exit exit
fi fi
@@ -884,20 +904,20 @@ installMCARCH() {
runCreaterepo() { runCreaterepo() {
debug "Running: ${FUNCNAME[0]}" debug "Running: ${FUNCNAME[0]}"
declare cr_cmd cr_cp_cmd cr_mkdir_cmd cr_chown_cmd declare -a cr_cmd cr_cp_cmd cr_mkdir_cmd cr_chown_cmd
installPackage createrepo_c installPackage createrepo_c
# If the webroot does not exist, create it # If the webroot does not exist, create it
if [[ ! -d "$CREATEREPO_WEBROOT" ]]; then if [[ ! -d "$CREATEREPO_WEBROOT" ]]; then
cr_mkdir_cmd="sudo -u $CREATEREPO_USER mkdir -p $CREATEREPO_WEBROOT" cr_mkdir_cmd=(sudo -u "$CREATEREPO_USER" mkdir -p "$CREATEREPO_WEBROOT")
debug "$cr_mkdir_cmd" || cr_mkdir_cmd+=" &>/dev/null" debug "${cr_mkdir_cmd[*]}" || cr_mkdir_cmd+=(" &>/dev/null")
if ! eval "$cr_mkdir_cmd"; then if ! eval "${cr_mkdir_cmd[*]}"; then
cr_mkdir_cmd="sudo mkdir -p $CREATEREPO_WEBROOT" cr_mkdir_cmd=(sudo mkdir -p "$CREATEREPO_WEBROOT")
debug "$cr_mkdir_cmd" || cr_mkdir_cmd+=" &>/dev/null" debug "${cr_mkdir_cmd[*]}" || cr_mkdir_cmd+=(" &>/dev/null")
cr_chown_cmd="sudo chown -R $CREATEREPO_USER:$CREATEREPO_USER $CREATEREPO_WEBROOT" cr_chown_cmd=(sudo chown -R "$CREATEREPO_USER":"$CREATEREPO_USER" "$CREATEREPO_WEBROOT")
debug "$cr_chown_cmd" || cr_chown_cmd+=" &>/dev/null" debug "${cr_chown_cmd[*]}" || cr_chown_cmd+=(" &>/dev/null")
if ! ( eval "$cr_mkdir_cmd" && eval "$cr_chown_cmd" ); then if ! ( eval "${cr_mkdir_cmd[*]}" && eval "${cr_chown_cmd[*]}" ); then
err "Could not create the createrepo-webroot path!" err "Could not create the createrepo-webroot path!"
err "Make sure that the webroot $CREATEREPO_WEBROOT is writeable by user $CREATEREPO_USER" err "Make sure that the webroot $CREATEREPO_WEBROOT is writeable by user $CREATEREPO_USER"
err "Or change the repo ownership with --createrepo-user" err "Or change the repo ownership with --createrepo-user"
@@ -907,26 +927,26 @@ runCreaterepo() {
fi fi
# Copy built rpms to webroot # Copy built rpms to webroot
cr_cp_cmd="sudo cp -nf $MCRPM $CREATEREPO_WEBROOT" cr_cp_cmd=(sudo cp -nf "$MCRPM" "$CREATEREPO_WEBROOT")
cr_chown_cmd="sudo chown -R $CREATEREPO_USER:$CREATEREPO_USER $CREATEREPO_WEBROOT" cr_chown_cmd=(sudo chown -R "$CREATEREPO_USER":"$CREATEREPO_USER" "$CREATEREPO_WEBROOT")
debug "$cr_cp_cmd" || cr_cp_cmd+=" &>/dev/null" debug "${cr_cp_cmd[*]}" || cr_cp_cmd+=(" &>/dev/null")
debug "$cr_chown_cmd" || cr_cp_cmd+=" &>/dev/null" debug "${cr_chown_cmd[*]}" || cr_cp_cmd+=(" &>/dev/null")
if ! ( eval "$cr_cp_cmd" && eval "$cr_chown_cmd" ); then if ! ( eval "${cr_cp_cmd[*]}" && eval "${cr_chown_cmd[*]}" ); then
err "Could not copy $MCRPM to $CREATEREPO_WEBROOT" err "Could not copy $MCRPM to $CREATEREPO_WEBROOT"
return 1 return 1
fi fi
# Run createrepo # Run createrepo
cr_cmd="sudo -u $CREATEREPO_USER createrepo -q $CREATEREPO_WEBROOT" cr_cmd=(sudo -u "$CREATEREPO_USER" createrepo -q "$CREATEREPO_WEBROOT")
[[ -d "$CREATEREPO_WEBROOT/repodata" ]] && cr_cmd+=" --update" [[ -d "$CREATEREPO_WEBROOT/repodata" ]] && cr_cmd+=(--update)
debug "$cr_cmd" || cr_cmd+=" &>/dev/null" debug "${cr_cmd[*]}" || cr_cmd+=(" &>/dev/null")
if ! eval "$cr_cmd"; then if ! eval "${cr_cmd[*]}"; then
cr_cmd="sudo createrepo -q $CREATEREPO_WEBROOT" cr_cmd=(sudo createrepo -q "$CREATEREPO_WEBROOT")
[[ -d "$CREATEREPO_WEBROOT/repodata" ]] && cr_cmd+=" --update" [[ -d "$CREATEREPO_WEBROOT/repodata" ]] && cr_cmd+=(--update)
cr_chown_cmd="sudo chown -R $CREATEREPO_USER:$CREATEREPO_USER $CREATEREPO_WEBROOT" cr_chown_cmd=(sudo chown -R "$CREATEREPO_USER":"$CREATEREPO_USER" "$CREATEREPO_WEBROOT")
debug "$cr_cmd" || cr_cmd+=" &>/dev/null" debug "${cr_cmd[*]}" || cr_cmd+=(" &>/dev/null")
debug "$cr_chown_cmd" || cr_cp_cmd+=" &>/dev/null" debug "${cr_chown_cmd[*]}" || cr_cp_cmd+=(" &>/dev/null")
if ! ( eval "$cr_cmd" && eval "$cr_chown_cmd"); then if ! ( eval "${cr_cmd[*]}" && eval "${cr_chown_cmd[*]}"); then
err "Createrepo failed" err "Createrepo failed"
return 1 return 1
fi fi
@@ -940,22 +960,22 @@ runCreaterepo() {
symlinkCerts() { symlinkCerts() {
debug "Running: ${FUNCNAME[0]}" debug "Running: ${FUNCNAME[0]}"
declare mc_cert_link="/usr/lib/jriver/Media Center $MVERSION/ca-certificates.crt" declare mc_cert_link="/usr/lib/jriver/MC30/ca-certificates.crt"
declare target_cert ln_cmd declare target_cert
declare -a ln_cmd
target_cert=$(readlink -f "$mc_cert_link") target_cert=$(readlink -f "$mc_cert_link")
[[ -f $target_cert ]] && return 0 [[ -f $target_cert ]] && return 0
# Have to use command array instead of eval because of whitespace in $mc_cert_link
if [[ -f /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem ]]; then if [[ -f /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem ]]; then
ln_cmd="sudo ln -fs /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem \"$mc_cert_link\"" # For RHEL ln_cmd=(sudo ln -fs /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem "$mc_cert_link") # For RHEL/CentOS
elif [[ -f /var/lib/ca-certificates/ca-bundle.pem ]]; then elif [[ -f /var/lib/ca-certificates/ca-bundle.pem ]]; then
ln_cmd="sudo ln -fs /var/lib/ca-certificates/ca-bundle.pem \"$mc_cert_link\"" # For SUSE ln_cmd=(sudo ln -fs /var/lib/ca-certificates/ca-bundle.pem "$mc_cert_link") # For SUSE
fi fi
debug "$ln_cmd" || ln_cmd+=" &>/dev/null" debug "${ln_cmd[*]}" || ln_cmd+=(" &>/dev/null")
if ! eval "$ln_cmd"; then if ! eval "${ln_cmd[*]}"; then
err "Symlinking certificates failed" err "Symlinking certificates failed"
return 1 return 1
fi fi
@@ -1014,15 +1034,15 @@ openFirewall() {
if ! case "$ID" in if ! case "$ID" in
fedora|centos|suse) fedora|centos|suse)
hash firewall-cmd 2>/dev/null || installPackage firewalld hash firewall-cmd 2>/dev/null || installPackage firewalld
if ! firewall_cmd --get-services | grep -q "$1"; then if ! sudo firewall-cmd --get-services | grep -q "$1"; then
firewall_cmd --permanent --new-service="$1" &>/dev/null sudo firewall-cmd --permanent --new-service="$1" &>/dev/null
firewall_cmd --permanent --service="$1" --set-description="$1 installed by installJRMC" &>/dev/null sudo firewall-cmd --permanent --service="$1" --set-description="$1 installed by installJRMC" &>/dev/null
firewall_cmd --permanent --service="$1" --set-short="$1" &>/dev/null sudo firewall-cmd --permanent --service="$1" --set-short="$1" &>/dev/null
for port in "${f_ports[@]}"; do for port in "${f_ports[@]}"; do
firewall_cmd --permanent --service="$1" --add-port="$port" &>/dev/null sudo firewall-cmd --permanent --service="$1" --add-port="$port" &>/dev/null
done done
firewall_cmd --add-service "$1" --permanent &>/dev/null sudo firewall-cmd --add-service "$1" --permanent &>/dev/null
firewall_cmd --reload &>/dev/null sudo firewall-cmd --reload &>/dev/null
fi fi
;; ;;
debian|ubuntu) debian|ubuntu)
@@ -1036,8 +1056,8 @@ openFirewall() {
ports=$u_ports ports=$u_ports
EOF" EOF"
fi fi
firewall_cmd app update "$1" &>/dev/null sudo ufw app update "$1" &>/dev/null
firewall_cmd allow "$1" &>/dev/null sudo ufw allow "$1" &>/dev/null
;; ;;
arch) arch)
# sysctl -w net.ipv4.ip_forward = 1 # sysctl -w net.ipv4.ip_forward = 1
@@ -1063,7 +1083,7 @@ setVNCPass() {
debug "Running: ${FUNCNAME[0]}" debug "Running: ${FUNCNAME[0]}"
declare vncpassfile="$HOME/.vnc/jrmc_passwd" declare vncpassfile="$HOME/.vnc/jrmc_passwd"
declare vnc_pass_cmd declare -a vnc_pass_cmd
[[ ! -d "${vncpassfile%/*}" ]] && mkdir -p "${vncpassfile%/*}" [[ ! -d "${vncpassfile%/*}" ]] && mkdir -p "${vncpassfile%/*}"
@@ -1079,11 +1099,11 @@ setVNCPass() {
if [[ -v VNCPASS ]]; then if [[ -v VNCPASS ]]; then
if [[ $1 == "xvnc" ]]; then if [[ $1 == "xvnc" ]]; then
vnc_pass_cmd="echo $VNCPASS | vncpasswd -f > $vncpassfile" vnc_pass_cmd=(echo "$VNCPASS" "|" vncpasswd -f ">" "$vncpassfile")
elif [[ $1 == "x11vnc" ]]; then elif [[ $1 == "x11vnc" ]]; then
vnc_pass_cmd="x11vnc -storepasswd $VNCPASS $vncpassfile" vnc_pass_cmd=(x11vnc -storepasswd "$VNCPASS" "$vncpassfile")
fi fi
if ! eval "$vnc_pass_cmd"; then if ! eval "${vnc_pass_cmd[*]}"; then
err "Could not create VNC password file" err "Could not create VNC password file"
return 1 return 1
fi fi
@@ -1381,131 +1401,62 @@ service_jriver-createrepo() {
# installPackage buildah podman # installPackage buildah podman
# # Eventually try to switch to Debian # if ! CNT=$(buildah from debian:$DEBIANBASE-slim); then
# # if ! CNT=$(buildah from debian:$DEBIANBASE); then # echo "Bad base image for container, skipping"
# # echo "Bad base image for container $CNAME, skipping" # return 1
# # continue
# # fi
# if ! CNT=$(buildah from jlesage/baseimage-gui:debian-10-v3.5.7); then
# echo "Bad base image for container $CNAME, skipping"
# continue
# fi # fi
# buildah run "$CNT" add-pkg gnupg2 libxss1 wmctrl xdotool ca-certificates inotify-tools libgbm1 ffmpeg # brc() { buildah run "$CNT" bash -c "$*"; }
# brc "add-pkg gnupg2 libxss1 wmctrl xdotool ca-certificates inotify-tools libgbm1 ffmpeg"
# # #BASEIMAGE=jlesage/baseimage-gui:debian-10-v3.5.7
# # JRIVER_RELEASE=28
# # JRIVER_TAG=stable
# # ARCH=amd64
# # REBUILD_MIN=22
# # REBUILD_MAX=120
# # # JRiver Version tag (latest, stable or beta)
# # ARG jriver_tag
# # # JRiver Release Version (25, 26 etc.)
# # ARG jriver_release
# # # Image Version of the build
# # ARG image_version
# # # .deb download URL, if set to "repository" the JRiver repository will be used
# # ARG deb_url
# # RUN add-pkg gnupg2 libxss1 wmctrl xdotool ca-certificates inotify-tools libgbm1 ffmpeg
# # Install JRiver # # Install JRiver
# RUN \ # brc "
# add-pkg ca-certificates gnupg &&
# add-pkg --virtual build-dependencies wget && # add-pkg --virtual build-dependencies wget &&
# # Install from Repository # wget -qO- http://dist.jriver.com/mediacenter@jriver.com.gpg.key | tee /etc/apt/trusted.gpg.d/jriver.asc &&
# if [ "${deb_url}" = "repository" ]; then \ # wget -O /etc/apt/sources.list.d/mediacenter${MVERSION}.list http://dist.jriver.com/latest/mediacenter/mediacenter${MVERSION}.list &&
# echo "Installing JRiver from repository ${jriver_release}:${jriver_tag}" &&
# wget -q "http://dist.jriver.com/mediacenter@jriver.com.gpg.key" -O- | apt-key add - &&
# wget http://dist.jriver.com/${jriver_tag}/mediacenter/mediacenter${jriver_release}.list -O /etc/apt/sources.list.d/mediacenter${jriver_release}.list &&
# apt update && # apt update &&
# add-pkg mediacenter${jriver_release}; \ # add-pkg mediacenter${MVERSION} &&
# # Install from .deb URL # del-pkg build-dependencies
# else \ # "
# echo "Installing JRiver from URL: ${deb_url}" &&
# wget -q -O "jrivermc.deb" ${deb_url} &&
# add-pkg "./jrivermc.deb"; \
# fi &&
# # Cleanup
# del-pkg build-dependencies &&
# rm -rf /tmp/* /tmp/.[!.]*
# # Add rootfs # buildah config "$CNT" \
# COPY rootfs/ / # --author "bryanroessler@gmail.com" \
# VOLUME ["/config"]
# # Application Icon
# RUN \
# APP_ICON_URL=https://gitlab.com/shiomax/jrivermc-docker/raw/master/assets/Application.png &&
# install_app_icon.sh "$APP_ICON_URL"
# # Various configuration vars
# ENV KEEP_APP_RUNNING=1 \
# DISPLAY_WIDTH=1280 \
# DISPLAY_HEIGHT=768 \
# APP_NAME="JRiver MediaCenter ${jriver_release}" \
# MAXIMIZE_POPUPS=0 \
# S6_KILL_GRACETIME=8000
# # Modify startapp.sh and rc.xml with JRiver version
# RUN sed-patch s/%%MC_VERSION%%/${jriver_release}/g \
# /startapp.sh &&
# sed-patch s/%%MC_VERSION%%/${jriver_release}/g \
# /etc/xdg/openbox/rc.xml
# EXPOSE 5800 5900 52100 52101 52199 1900/udp
# # Metadata.
# LABEL \
# org.label-schema.name="jrivermc${jriver_release}" \
# org.label-schema.description="Docker image for JRiver Media Center ${jriver_release}" \
# org.label-schema.version="${image_version}" \
# org.label-schema.vcs-url="https://gitlab.com/shiomax/jrivermc-docker" \
# org.label-schema.schema-version="1.0"
# installPackage buildah podman
# cnt=$(buildah from docker.io/jlesage/baseimage-gui:debian-10)
# podman_create_cmd=(podman create --name "$CNAME")
# buildah_config_cmd=(buildah config \
# --author bryanroessler@gmail.com \
# --label maintainer="$MAINTAINER" \ # --label maintainer="$MAINTAINER" \
# --env TZ="$TZ" \ # --env TZ="$TZ" \
# --workingdir /app \ # --workingdir /app \
# --cmd mediacenter"$MVERSION") # --cmd "mediacenter$MVERSION"
# 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" # # EXPOSE 5800 5900 52100 52101 52199 1900/udp
# podman_create_cmd=(
# podman create
# --name "mediacenter$MVERSION"
# )
# podman_create_cmd+=(-v "$HOME/.jriver:/root/.jriver") # podman_create_cmd+=(-v "$HOME/.jriver:/root/.jriver")
# podman_create_cmd+=(-v "$DOWNLOAD_ROOT:/downloads:z") # podman_create_cmd+=(-v "$DOWNLOAD_ROOT:/downloads:z")
# podman_create_cmd+=(-v "$MONITOR_ROOT/nzbs:/nzbs") # podman_create_cmd+=(-v "$MONITOR_ROOT/nzbs:/nzbs")
# podman_create_cmd+=(-p "${CONTAINER[HOST_PORT]}:${CONTAINER[CONTAINER_PORT]}") # podman_create_cmd+=(-p "${CONTAINER[HOST_PORT]}:${CONTAINER[CONTAINER_PORT]}")
# brc() { buildah run "$1" "${@:2}" || return 1; } # # 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
# # }
# brc add-pkg gnupg2 libxss1 wmctrl xdotool ca-certificates inotify-tools libgbm1 # # mkcdirs "$HOME/.jriver"
# brc add-pkg --virtual .build-deps wget
# brc sh -s <<-EOF # brc sh -s <<-EOF
# wget -q "http://dist.jriver.com/mediacenter@jriver.com.gpg.key" -O- | apt-key add - &>/dev/null # wget -q "http://dist.jriver.com/mediacenter@jriver.com.gpg.key" -O- | apt-key add - &>/dev/null
@@ -1571,6 +1522,8 @@ uninstall() {
declare service unit f i declare service unit f i
declare -a firewall_cmd mc_pkg_rm_cmd
echo "Stopping and removing all Media Center services" echo "Stopping and removing all Media Center services"
for service in $(compgen -A "function" "service"); do for service in $(compgen -A "function" "service"); do
service="${service##service_}" service="${service##service_}"
@@ -1603,22 +1556,19 @@ uninstall() {
echo "Removing firewall rules" echo "Removing firewall rules"
if hash firewall-cmd 2>/dev/null; then if hash firewall-cmd 2>/dev/null; then
if [[ -v debug ]]; then firewall_cmd=(sudo firewall-cmd --permanent --remove-service=jriver)
debug "firewall_cmd --permanent --remove-service=jriver" debug "${firewall_cmd[*]}" || firewall_cmd+=(" &>/dev/null")
firewall_cmd --permanent --remove-service=jriver eval "${firewall_cmd[*]}"
debug "firewall_cmd --permanent --delete-service=jriver" firewall_cmd=(sudo firewall-cmd --permanent --delete-service=jriver)
firewall_cmd --permanent --delete-service=jriver debug "${firewall_cmd[*]}" || firewall_cmd+=(" &>/dev/null")
debug "firewall_cmd --reload" eval "${firewall_cmd[*]}"
firewall_cmd --reload firewall_cmd=(sudo firewall-cmd --reload)
else debug "${firewall_cmd[*]}" || firewall_cmd+=(" &>/dev/null")
firewall_cmd --permanent --remove-service=jriver &>/dev/null eval "${firewall_cmd[*]}"
firewall_cmd --permanent --delete-service=jriver &>/dev/null
firewall_cmd --reload &>/dev/null
fi
elif hash ufw 2>/dev/null; then elif hash ufw 2>/dev/null; then
firewall_cmd="firewall_cmd delete allow jriver" firewall_cmd=(sudo ufw delete allow jriver)
debug "$firewall_cmd" || firewall_cmd+=" &>/dev/null" debug "${firewall_cmd[*]}" || firewall_cmd+=(" &>/dev/null")
eval "$firewall_cmd" eval "${firewall_cmd[*]}"
[[ -f "/etc/ufw/applications.d/jriver" ]] && [[ -f "/etc/ufw/applications.d/jriver" ]] &&
sudo rm -f /etc/ufw/applications.d/jriver sudo rm -f /etc/ufw/applications.d/jriver
# elif hash nft 2>/dev/null; then # elif hash nft 2>/dev/null; then
@@ -1626,9 +1576,9 @@ uninstall() {
fi fi
echo "Uninstalling JRiver Media Center package" echo "Uninstalling JRiver Media Center package"
mc_pkg_rm_cmd="pkg_remove $MCPKG" mc_pkg_rm_cmd=(pkg_remove "$MCPKG")
debug "$mc_pkg_rm_cmd" || mc_pkg_rm_cmd+=" &>/dev/null" debug "${mc_pkg_rm_cmd[*]}" || mc_pkg_rm_cmd+=(" &>/dev/null")
if eval "$mc_pkg_rm_cmd"; then if eval "${mc_pkg_rm_cmd[*]}"; then
echo "JRiver Media Center has been completely uninstalled" echo "JRiver Media Center has been completely uninstalled"
echo "To remove your library files, run: rm -rf $HOME/.jriver" echo "To remove your library files, run: rm -rf $HOME/.jriver"
elif [[ $? -eq 100 ]]; then elif [[ $? -eq 100 ]]; then
@@ -1669,7 +1619,7 @@ main() {
if askOk "Do you really want to uninstall JRiver Media Center?"; then if askOk "Do you really want to uninstall JRiver Media Center?"; then
uninstall uninstall
else else
echo "Uninstall canceled." echo "Uninstall canceled"
fi fi
exit exit
fi fi
@@ -1679,9 +1629,9 @@ main() {
ubuntu) ubuntu)
if ! grep ^deb /etc/apt/sources.list|grep -q universe; then if ! grep ^deb /etc/apt/sources.list|grep -q universe; then
echo "Adding universe repository" echo "Adding universe repository"
declare add_universe_cmd="sudo add-apt-repository -y universe" declare -a add_universe_cmd=(sudo add-apt-repository -y universe)
debug "$add_universe_cmd" || add_universe_cmd+=" &>/dev/null" debug "${add_universe_cmd[*]}" || add_universe_cmd+=(" &>/dev/null")
if ! eval "$add_universe_cmd"; then if ! eval "${add_universe_cmd[*]}"; then
err "Adding universe repository failed" err "Adding universe repository failed"
fi fi
fi fi