7 Melakukan

Penulis SHA1 Pesan Tanggal
6f3c07c266 Update README 2020-04-30 13:04:20 -04:00
14672fe85d Set _mcpkg even when _mcversion is specified 2020-04-30 12:30:12 -04:00
52bcde5620 Update README 2020-04-30 12:16:24 -04:00
3f4bc9dd98 Add the ability to specify a version from repo 2020-04-30 12:15:09 -04:00
c9a9d82d3a Rename install-rpmbuild argument to install-rpm 2020-04-30 10:20:02 -04:00
988222540a Fix firewall-cmd derp on fedora/centos 2020-04-30 10:17:01 -04:00
a4d82c621f Break out standalone x11vnc service 2020-04-29 23:31:51 -04:00
2 mengubah file dengan 107 tambahan dan 57 penghapusan

Melihat File

@@ -2,29 +2,34 @@
This program will install [JRiver Media Center](https://www.jriver.com/) and associated helper services on Fedora (>=29), CentOS (>=8), Ubuntu (>=16.04), and Debian (>=9).
## Notes
## README
1. This script will not point major upgrades (i.e. from v25 to v26) to your old library. You should **first perform a library backup**, install the new major version, and then restore the library backup in the new version.
2. In *most* cases `installJRMC` should be **executed as your normal user** (i.e. don't run it with `sudo`). Services are installed for the user that executes the script so do not execute as root unless you want to install system-wide services. Doing so may lead to permissions issues. `installJRMC` will prompt you for your `sudo` password as necessary to install dependencies and services.
2. Typically `installJRMC` should be **executed as your normal user** (i.e. don't run it with `sudo`). Services are installed for the user that executes the script so do not execute as root unless you want to install system-wide services. Doing so may lead to permissions issues. `installJRMC` will prompt you for your `sudo` password as necessary to install dependencies and services.
## Executing
`installJRMC [--option [ARGUMENT]]`
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. If any other option is specified then the default install method will need to be specified using `--install-repo` (or `--install-rpm`). This makes it possible to install services, containers, repos, etc. independent from Media Center.
## Options
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. If any other option is specified then the default install method will need to be specified using `--install-repo` (or `--install-rpmbuild`). This makes it possible to create services, containers, repos, etc. separate from installing Media Center.
Here is a list of possible options that can be passed to the script. You can always find the latest supported options by running `installJRMC --help`.
Here is a list of additional options that can be passed to the script. You can always find the latest supported options by running `installJRMC --help`.
```text
--install-repo
Install JRiver Media Center from repository using package manager (Default)
DEB-based OSes: Official package repository
RPM-based OSes: BryanC's unofficial repository
--install-rpmbuild
--install-rpm
(RPM-based OSes only) Build RPM from source DEB and install it
--rpmbuild
Build RPM from source DEB
--outputdir PATH
Generate rpmbuild output in this directory (Default: $PWD/outputdir)
--mcversion VERSION
Build or install a specific version (Default: scrape the latest version from Interact)
Build or install a specific version (Default: install the latest version)
--restorefile RESTOREFILE
Restore file location for registration (Default: skip registration)
--betapass PASSWORD
@@ -35,6 +40,7 @@ Here is a list of additional options that can be passed to the script. You can a
See SERVICES section below for a list of possible services to install
--container, -c CONTAINER
See CONTAINERS section below for a list of possible services to install
TODO: Containers are a work-in-progress
--createrepo
Build rpm, copy to webroot, and run createrepo
--createrepo-webroot PATH
@@ -53,7 +59,7 @@ Here is a list of additional options that can be passed to the script. You can a
### services
When installing systemd services it is important to execute `installJRMC` as the user you wish to run the services. Typically this is your normal user account but for some server installations it may be necessary to execute the script as root.
When installing systemd services it is important to execute `installJRMC` as the user you wish to run the services. Typically this is your normal user account but for some server installations it may be necessary to execute the script as root. If so, use `--service-user root` to override sanity checks.
```text
@@ -61,26 +67,33 @@ jriver-mediaserver
Enable and start a mediaserver systemd service (requires an existing X server)
jriver-mediacenter
Enable and start a mediacenter systemd service (requires an existing X server)
jriver-x11vnc-mediacenter
Enable and start x11vnc for the local desktop (requires an existing X server)
jriver-x11vnc
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)
jriver-xvnc-mediacenter
Enable and start a new Xvnc session running JRiver Media Center
--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
--display DISPLAY
Display to start x11vnc/Xvnc (Default: The current display (x11vnc) or the
current display incremented by 1 (Xvnc))
jriver-xvnc-mediacenter
Enable and start an Xvnc session running JRiver Media Center
--vncpass and --display are also valid options (see above)
jriver-createrepo
Install hourly service to build latest MC RPM and run createrepo
```
##### `jriver-x11vnc-mediaserver` versus `jriver-xvnc-mediacenter`
`x11vnc` shares your existing X display via vnc and starts a minimized JRiver Media Center service. Conversely, `xvnc` creates a new VNC display and starts a JRiver Media Center service in the foreground. The requisite firewall rules will also be added to the system firewall to enable remote access.
It is possible to install multiple services at one time using multiple `--service` blocks: `installJRMC --install-repo --service jriver-x11vnc --service jriver-mediacenter`
**Note**: If `jriver-xvnc-mediacenter` finds an existing display it will attempt to increment the display number by 1. This should work fine in 99% of cases, but if you have multiple running X servers on your host machine you should use the `--display` option to specify a free display.
##### `jriver-x11vnc` versus `jriver-xvnc-mediacenter`
[jriver-x11vnc](http://www.karlrunge.com/x11vnc/) shares your existing X display via VNC and can be combined with additional services to start Media Center or Media Server. Conversely, [jriver-xvnc-mediacenter](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. The requisite firewall rules will also be added to the system firewall to enable remote access.
**Note**: If `jriver-xvnc-mediacenter` finds an existing display it will attempt to increment the display number by 1. This should work fine in most cases, but if you have multiple running X servers on your host machine you should use the `--display` option to specify a free display.
### Firewall Rules
`installJRMC` will automatically install and enable port forwarding firewall rules to enable remote access to Media Server (52100-52200/tcp, 1900/udp DLNA) and Xvnc/x11vnc (depends on port selection). `installJRMC` uses `firewall-cmd` on Fedora/CentOS and `ufw` on Ubuntu/Debian.
**Note:** `ufw` is not installed by default on Debian but will be installed by `installJRMC`. To prevent user lock-out (i.e. SSH), Debian users that have not already enabled `ufw` will need to do so (`sudo ufw enable`) after running `installJRMC` and inspecting their rules.
### containers
@@ -94,9 +107,9 @@ jriver-createrepo
* `installJRMC --install-repo --service jriver-mediaserver`
Installs JRiver Media Center from the repository and starts/enables the mediaserver service.
Installs JRiver Media Center from the repository and starts/enables the /MediaServer service.
* `installJRMC --install-rpmbuild --restorefile /path/to/license.mjr --mcversion 26.0.56`
* `installJRMC --install-rpm --restorefile /path/to/license.mjr --mcversion 26.0.56`
Builds JRiver Media Center version 26.0.56 RPM from the source DEB, installs it (RPM distros only), and activates it using the specified .mjr license file.
@@ -108,13 +121,13 @@ jriver-createrepo
Installs the jriver-createrepo timer and service to build the RPM, move it to the webroot, and run createrepo as `www-user` hourly.
* `installJRMC --install-repo --service jriver-x11vnc-mediaserver --vncpass "letmein"`
* `installJRMC --install-repo --service jriver-x11vnc --service jriver-mediacenter --vncpass "letmein"`
Installs services to share the existing local desktop via VNC and automatically run a minimized instance of Media Center (Media Server).
Installs services to share the existing local desktop via VNC and automatically run Media Center on startup.
* `installJRMC --install-repo --service jriver-xvnc-mediacenter --display ":2"`
Installs a service that starts Xvnc on display ':2' that just runs Media Center.
Installs an Xvnc server on display ':2' that starts Media Center.
* `installJRMC --uninstall`

Melihat File

@@ -23,7 +23,7 @@ installJRMC() {
_outputdir="$_basedir/output"
_createrepo_webroot="/srv/jriver"
_exec_user="$(whoami)"
_available_services=("jriver-createrepo" "jriver-x11vnc-mediaserver" "jriver-mediaserver" "jriver-mediacenter" "jriver-xvnc-mediacenter")
_available_services=("jriver-createrepo" "jriver-x11vnc" "jriver-mediaserver" "jriver-mediacenter" "jriver-xvnc-mediacenter")
#_available_containers=("mediacenter-xvnc" "createrepo")
@@ -40,14 +40,14 @@ OPTIONS
Install JRiver Media Center from repository using package manager (Default)
DEB-based OSes: Official package repository
RPM-based OSes: BryanC unofficial repository
--install-rpmbuild
--install-rpm
(RPM-based OSes only) Build RPM from source DEB and install it
--rpmbuild
Build RPM from source DEB
--outputdir PATH
Generate rpmbuild output in this directory (Default: $PWD/outputdir)
--mcversion VERSION
Build or install a specific version (Default: scrape the latest version from Interact)
Build or install a specific version (Default: install the latest version)
--restorefile RESTOREFILE
Restore file location for registration (Default: skip registration)
--betapass PASSWORD
@@ -78,9 +78,9 @@ OPTIONS
Enable and start a mediaserver systemd service (requires an existing X server)
jriver-mediacenter
Enable and start a mediacenter systemd service (requires an existing X server)
jriver-x11vnc-mediaserver
Enable and start x11vnc for the local desktop (requires an existing X server) and
JRiver Media Server
jriver-x11vnc
Enable and start x11vnc for the local desktop (requires an existing X server)
Usually combined with jriver-mediaserver or jriver-mediacenter services
--vncpass and --display are also valid options (see below)
jriver-xvnc-mediacenter
Enable and start a new Xvnc session running JRiver Media Center
@@ -112,14 +112,14 @@ EOF
_repoinstall="true"
fi
if _input=$(getopt -o +vdhus:c: -l install-repo,install-rpmbuild,rpmbuild,outputdir:,mcversion:,restorefile:,betapass:,service-user:,service:,version,debug,help,uninstall,createrepo,createrepo-webroot:,createrepo-user:,vncpass:,display:,container: -- "$@"); then
if _input=$(getopt -o +vdhus:c: -l install-repo,install-rpm,rpmbuild,outputdir:,mcversion:,restorefile:,betapass:,service-user:,service:,version,debug,help,uninstall,createrepo,createrepo-webroot:,createrepo-user:,vncpass:,display:,container: -- "$@"); then
eval set -- "$_input"
while true; do
case "$1" in
--install-repo)
_repoinstall="true"
;;
--install-rpmbuild)
--install-rpm)
_rpmbuild="true"
_rpminstall="true"
;;
@@ -559,7 +559,7 @@ EOF
debug "Running: ${FUNCNAME[0]}"
for _service in "${_services[@]}"; do
if [[ "$_service" =~ ^(jriver-mediacenter|jriver-mediaserver|jriver-xvnc-mediacenter|jriver-x11vnc-mediaserver)$ ]] \
if [[ "$_service" =~ ^(jriver-mediacenter|jriver-mediaserver|jriver-xvnc-mediacenter|jriver-x11vnc)$ ]] \
&& [[ -z $_repoinstall && -z $_rpminstall ]] \
&& [[ ! -x $(command -v "mediacenter$_mversion") ]]; then
err "You are attempting to install a service that depends on JRiver Media Center"
@@ -604,52 +604,91 @@ EOF
debug "Running: ${FUNCNAME[0]}"
echo "Installing latest JRiver Media Center from repo..."
echo "Installing JRiver Media Center from repo..."
local _mcpkg
# Add repositories to OS-specific package managers
if [[ "$ID" =~ ^(fedora|centos)$ ]]; then
_bash_cmd 'cat <<-EOF > /etc/yum.repos.d/jriver.repo
# Add repository files
_addRepo() {
# Add repositories to OS-specific package managers
if [[ "$ID" =~ ^(fedora|centos)$ ]]; then
_bash_cmd 'cat <<-EOF > /etc/yum.repos.d/jriver.repo
[jriver]
name=JRiver Media Center repo by BryanC
baseurl=https://repos.bryanroessler.com/jriver
gpgcheck=0
EOF'
_mcpkg="MediaCenter"
elif [[ "$ID" =~ ^(ubuntu|debian)$ ]]; then
wget -q "http://dist.jriver.com/mediacenter@jriver.com.gpg.key" -O- | _ifSudo apt-key add - > /dev/null 2>&1
_bash_cmd 'cat <<-EOF > /etc/apt/sources.list.d/jriver.list
elif [[ "$ID" =~ ^(ubuntu|debian)$ ]]; then
wget -q "http://dist.jriver.com/mediacenter@jriver.com.gpg.key" -O- | _ifSudo apt-key add - > /dev/null 2>&1
_bash_cmd 'cat <<-EOF > /etc/apt/sources.list.d/jriver.list
deb [arch=amd64,i386,armhf] http://dist.jriver.com/latest/mediacenter/ jessie main
EOF'
fi
fi
}
_addRepo
# Update package list
[[ -n $_debug ]] && echo "Updating package list"
if ! _pkg_update > /dev/null 2>&1; then
err "Package update failed!"
exit 1
fi
# Find latest mversion to install on Ubuntu/Debian
# If user specifies a version, use that
if [[ -n $_mcversion ]]; then
_setVersion
local _specific_version="true"
fi
local _mcpkg
# Fedora/CentOS use a universal package name -- easy
if [[ "$ID" =~ ^(fedora|centos)$ ]]; then
_mcpkg="MediaCenter"
fi
# Ubuntu/Debian incorporate the mversion into the package name -- more fun!
if [[ "$ID" =~ ^(ubuntu|debian)$ ]]; then
# Try parsing the latest mediacenter?? version from the repo
if _mcpkg=$(apt-get install mediacenter?? -s -q0 | grep "selecting" | tail -1| awk '{print $3}'); then
_mcpkg="${_mcpkg%\'}"
_mcpkg="${_mcpkg#\'}"
fi
# If that fails, fall back to scraping Interact
if ! [[ "$_mcpkg" =~ ^[0-9][0-9]\.[0-9]\.[0-9]\+$ ]]; then
_setVersion
if [[ -z $_mversion ]]; then
# Try parsing the latest mversion from the repo
if _mcpkg=$(apt-get install mediacenter?? -s -q0 | grep "selecting" | tail -1| awk '{print $3}'); then
_mcpkg="${_mcpkg%\'}"
_mcpkg="${_mcpkg#\'}"
# Scrape Interact
else
_setVersion
_mcpkg="mediacenter$_mversion"
fi
else
_mcpkg="mediacenter$_mversion"
fi
# Sanity check
if [[ ! "$_mcpkg" =~ ^mediacenter[0-9][0-9]$ ]]; then
err "Could not parse MC package name"
exit 1
fi
fi
if [[ -n $_debug ]]; then
_installPackage "$_mcpkg"
if [[ -n $_specific_version ]]; then
if [[ "$ID" =~ ^(fedora|centos)$ ]]; then
if [[ -n $_debug ]]; then
_installPackage "$_mcpkg-$_mcversion"
else
_installPackage "$_mcpkg-$_mcversion" > /dev/null 2>&1
fi
elif [[ "$ID" =~ ^(ubuntu|debian)$ ]]; then
if [[ -n $_debug ]]; then
_installPackage "$_mcpkg=$_mcversion"
else
_installPackage "$_mcpkg=$_mcversion" > /dev/null 2>&1
fi
fi
else
_installPackage "$_mcpkg" > /dev/null 2>&1
if [[ -n $_debug ]]; then
_installPackage "$_mcpkg"
else
_installPackage "$_mcpkg" > /dev/null 2>&1
fi
fi
# shellcheck disable=SC2181
@@ -970,7 +1009,7 @@ EOF"
for _f_port in "${_f_ports[@]}"; do
_firewall_cmd --permanent --service="$1" --add-port="$_f_port" > /dev/null 2>&1
done
_firewall-cmd --add-service "$1" --permanent > /dev/null 2>&1
_firewall_cmd --add-service "$1" --permanent > /dev/null 2>&1
_firewall_cmd --reload > /dev/null 2>&1
fi
elif [[ "$ID" =~ ^(ubuntu|debian)$ ]]; then
@@ -1181,7 +1220,7 @@ EOF"
#######################################
# Starts and enables (at startup) JRiver Media Center in a new Xvnc session
#######################################
_service_jriver-xvnc-mediacenter() {
_service_jriver-xvnc() {
debug "Running: ${FUNCNAME[0]}"
@@ -1225,7 +1264,7 @@ EOF"
#######################################
# Starts and enables (at startup) JRiver Media Server and x11vnc sharing the local desktop
#######################################
_service_jriver-x11vnc-mediaserver() {
_service_jriver-x11vnc() {
debug "Running: ${FUNCNAME[0]}"
@@ -1273,8 +1312,6 @@ EOF"
_systemctl_enable "$_service_name" && \
echo "x11vnc running on localhost:$_port" && \
_openFirewall "jriver-x11vnc"
_service_jriver-mediacenter "/MediaServer"
}