1 Commit-ok

Szerző SHA1 Üzenet Dátum
6431178333 Fix systemd user 2020-04-03 17:26:50 -04:00

Fájl megtekintése

@@ -61,8 +61,6 @@ OPTIONS
Specify URL to source DEB package (Default: automatic) Specify URL to source DEB package (Default: automatic)
--betapass PASSWORD --betapass PASSWORD
Enter beta team password for access to beta builds Enter beta team password for access to beta builds
--service SERVICE
See SERVICES section below for a list of possible service to install
-v|--version -v|--version
Print this script version and exit Print this script version and exit
-d|--debug -d|--debug
@@ -82,13 +80,14 @@ OPTIONS
--createrepo-user USER --createrepo-user USER
The web server user (Default: www-user) The web server user (Default: www-user)
SERVICES See SERVICES for service-createrepo to automate createrepo
mediaserver
Create and enable a JRiver MC Media Server systemd service for the current user
x11vnc-mediaserver SERVICES
Create and enable a JRiver MC mediaserver service and x11vnc (for headless --service-mediaserver
installations without an existing X server) service for the current user Install JRiver MC mediaserver service
--service-x11vnc-mediaserver
Install JRiver MC mediaserver service and x11vnc (for headless installations without
an existing X server)
--vncpass PASSWORD --vncpass PASSWORD
Set vnc password for x11vnc access. If no password is set, the script will either use Set vnc password for x11vnc access. If no password is set, the script will either use
@@ -97,13 +96,8 @@ OPTIONS
Start X11VNC on this display (Default: The current display or :0 if current display is Start X11VNC on this display (Default: The current display or :0 if current display is
unaccessible) unaccessible)
createrepo --service-createrepo
Install service to build latest MC RPM and run createrepo hourly for the current user Install service to build latest MC and run createrepo hourly
--createrepo-webroot PATH
The webroot directory to install the repo (Default: /var/www/html)
--createrepo-user USER
The web server user (Default: www-user)
EOF EOF
# Exit using passed exit code # Exit using passed exit code
@@ -114,7 +108,7 @@ EOF
_parseInput () { _parseInput () {
if _input=$(getopt -o +vdhu -l repo,build,outputdir:,mcversion:,restorefile:,boardurl:,deburl:,betapass:,service:,version,debug,help,uninstall,createrepo,createrepo-webroot:,createrepo-user:,vncpass:,display: -- "$@"); then if _input=$(getopt -o +vdhu -l repo,build,outputdir:,mcversion:,restorefile:,boardurl:,deburl:,betapass:,version,debug,help,uninstall,createrepo,createrepo-webroot:,createrepo-user:,service-mediaserver,service-x11vnc-mediaserver,vncpass:,display:,service-createrepo -- "$@"); then
eval set -- "$_input" eval set -- "$_input"
while true; do while true; do
case "$1" in case "$1" in
@@ -144,9 +138,6 @@ EOF
--betapass) --betapass)
shift && _betapass="$1" shift && _betapass="$1"
;; ;;
--service)
shift && _service="$1"
;;
--version|-v) --version|-v)
echo "Version: $_scriptversion" echo "Version: $_scriptversion"
exit 0 exit 0
@@ -171,12 +162,21 @@ EOF
--createrepo-user) --createrepo-user)
shift && _createrepo_user="$1" shift && _createrepo_user="$1"
;; ;;
--service-mediaserver)
_service_ms="true"
;;
--service-x11vnc-mediaserver)
_service_xms="true"
;;
--vncpass) --vncpass)
shift && _vncpass="$1" shift && _vncpass="$1"
;; ;;
--display) --display)
shift && _display="$1" shift && _display="$1"
;; ;;
--service-createrepo)
_service_createrepo="true"
;;
--) --)
shift shift
break break
@@ -222,6 +222,11 @@ EOF
_sanityChecks () { _sanityChecks () {
if [[ -n $_service_ms && -n $_service_xms ]]; then
echo "--service-mediaserver is redundant when --service-x11vnc-mediaserver is set, unsetting..."
unset _service_ms
fi
if ! [[ "$ID" == "fedora" || "$ID" == "centos" ]] && \ if ! [[ "$ID" == "fedora" || "$ID" == "centos" ]] && \
[[ -z $_installrepo && -z $_buildonly && -z $_createrepo ]]; then [[ -z $_installrepo && -z $_buildonly && -z $_createrepo ]]; then
echo "You must specify --repo, --build, or --createrepo on non-RHEL distributions!" echo "You must specify --repo, --build, or --createrepo on non-RHEL distributions!"
@@ -700,16 +705,19 @@ EOF"
unset _service_fname _service_name _timer_fname _timer_name _systemd_user unset _service_fname _service_name _timer_fname _timer_name _systemd_user
_service_name="$1.service"
_timer_name="$1.timer"
if [[ "$_user" == "root" ]]; then if [[ "$_user" == "root" ]]; then
_service_fname="/usr/lib/systemd/system/$1.service" _service_fname="/usr/lib/systemd/system/$1.service"
_timer_fname="/usr/lib/systemd/system/$1.timer" _timer_fname="/usr/lib/systemd/system/$1.timer"
_service_name="$1.service"
_timer_name="$1.timer"
else else
_service_fname="/usr/lib/systemd/system/$1@.service" if [[ ! -d "$HOME/.config/systemd/user" ]]; then
_timer_fname="/usr/lib/systemd/system/$1@.timer" mkdir -p "$HOME/.config/systemd/user"
_service_name="$1@$_user.service" fi
_timer_name="$1@$_user.timer" _service_fname="$HOME/.config/systemd/user/$1.service"
_timer_fname="$HOME/.config/systemd/user/$1.timer"
#_systemd_user="User=$_user"
fi fi
} }
@@ -718,7 +726,7 @@ EOF"
_generateServiceVars "jriver-mediaserver" _generateServiceVars "jriver-mediaserver"
"${_bash_cmd[@]}" "cat <<-EOF > $_service_fname bash -c "cat <<-EOF > $_service_fname
[Unit] [Unit]
Description=JRiver Media Center $_mversion Media Server Description=JRiver Media Center $_mversion Media Server
After=graphical.target After=graphical.target
@@ -747,12 +755,12 @@ EOF"
_generateServiceVars "jriver-x11vnc" _generateServiceVars "jriver-x11vnc"
if [[ "$_novncauth" == "true" ]]; then if [[ "$_novncauth" == "true" ]]; then
_exec_start_cmd="/usr/bin/x11vnc -display $_display -noscr -geometry 1920x1080 -auth guess -forever -bg -nopw" _exec_start_cmd="/usr/bin/x11vnc -display $_display -geometry 1920x1080 -auth guess -forever -bg -nopw"
else else
_exec_start_cmd="/usr/bin/x11vnc -display $_display -noscr -geometry 1920x1080 -rfbauth $HOME/.vnc/jrmc_passwd -auth guess -forever -bg" _exec_start_cmd="/usr/bin/x11vnc -display $_display -geometry 1920x1080 -rfbauth $HOME/.vnc/jrmc_passwd -auth guess -forever -bg"
fi fi
"${_bash_cmd[@]}" "cat <<-EOF > $_service_fname bash -c "cat <<-EOF > $_service_fname
[Unit] [Unit]
Description=x11vnc Description=x11vnc
After=display-manager.service After=display-manager.service
@@ -765,7 +773,7 @@ Restart=always
RestartSec=10 RestartSec=10
[Install] [Install]
WantedBy=default.target WantedBy=graphical.target
EOF" EOF"
_systemctlReloadAndEnable "$_service_name" _systemctlReloadAndEnable "$_service_name"
} }
@@ -775,7 +783,7 @@ EOF"
_generateServiceVars "jriver-createrepo" _generateServiceVars "jriver-createrepo"
"${_bash_cmd[@]}" "cat <<-EOF > $_service_fname bash -c "cat <<-EOF > $_service_fname
[Unit] [Unit]
Description=Builds JRiver Media Center RPM file, moves it to the repo dir, and runs createrepo Description=Builds JRiver Media Center RPM file, moves it to the repo dir, and runs createrepo
@@ -783,9 +791,9 @@ Description=Builds JRiver Media Center RPM file, moves it to the repo dir, and r
ExecStart=$_basedir/installJRMC --buildpath=$_outputdir --createrepo --createrepo-webroot $_createrepo_webroot --createrepo-user $_createrepo_user ExecStart=$_basedir/installJRMC --buildpath=$_outputdir --createrepo --createrepo-webroot $_createrepo_webroot --createrepo-user $_createrepo_user
[Install] [Install]
WantedBy=default.target WantedBy=multi-user.target
EOF" EOF"
"${_bash_cmd[@]}" "cat <<-EOF > $_timer_fname bash -c "cat <<-EOF > $_timer_fname
[Unit] [Unit]
Description=Run JRiver MC rpmbuild hourly Description=Run JRiver MC rpmbuild hourly
@@ -894,7 +902,7 @@ EOF"
fi fi
# Install createrepo systemd service # Install createrepo systemd service
if [[ "$_service" == "createrepo" ]]; then if [[ -n $_service_createrepo ]]; then
_serviceCreaterepo _serviceCreaterepo
fi fi
@@ -906,12 +914,12 @@ EOF"
_openFirewallPorts _openFirewallPorts
# Install MC systemd services # Install MC systemd services
if [[ "$_service" == "x11vnc-mediaserver" ]]; then if [[ -n $_service_xms ]]; then
_serviceMediaserver _serviceMediaserver
_serviceX11VNC _serviceX11VNC
fi fi
if [[ "$_service" == "mediaserver" ]]; then if [[ -n $_service_ms ]]; then
_serviceMediaserver _serviceMediaserver
fi fi
} }