diff -Naur gentoo-vdr-scripts-2.5_rc1_orig/etc/conf.d/vdr gentoo-vdr-scripts-2.5_rc1/etc/conf.d/vdr --- gentoo-vdr-scripts-2.5_rc1_orig/etc/conf.d/vdr 2014-09-23 12:51:46.000000000 +0200 +++ gentoo-vdr-scripts-2.5_rc1/etc/conf.d/vdr 2014-10-04 04:05:13.564027000 +0200 @@ -225,6 +225,10 @@ # and who want to start vdr as user root # allowed values: yes no # default: no +# WILL BE IGNORED IF USING SYSTEMD !!! +# Enable the 'User=root' key under the [Service] section in +# /etc/systemd/system/vdr.service.d/00-gentoo-vdr-user.conf +# only if you want to run vdr as user root and use systemd #START_VDR_AS_ROOT="no" # Use only the given DVB device (NUM = 0, 1, 2...) diff -Naur gentoo-vdr-scripts-2.5_rc1_orig/etc/systemd/system/vdr.service.d/00-gentoo-vdr-user.conf gentoo-vdr-scripts-2.5_rc1/etc/systemd/system/vdr.service.d/00-gentoo-vdr-user.conf --- gentoo-vdr-scripts-2.5_rc1_orig/etc/systemd/system/vdr.service.d/00-gentoo-vdr-user.conf 2014-09-23 12:51:46.000000000 +0200 +++ gentoo-vdr-scripts-2.5_rc1/etc/systemd/system/vdr.service.d/00-gentoo-vdr-user.conf 2014-10-04 04:08:59.858013000 +0200 @@ -3,16 +3,11 @@ # # use this file to override settings from vdr.service -## need testing, which one will work - -# test1 -#[Service] -# uncomment this if you have to set START_VDR_AS_ROOT="yes" in /etc/conf.d/vdr +[Service] +# Uncomment this if you need to run vdr as root. +# ATTENTION !!! +# - START_VDR_AS_ROOT from /etc/conf.d/vdr IS IGNORED WHEN USING SYSTEMD !!! +# - if you use the dbus2vdr plugin, the user who owns the vdr-dbus-service +# has to also be set in /etc/dbus-1/system.d/de.tvdr.vdr.conf as root if +# you uncomment the line below #User=root - -# test2 -# For people who really know what they do -# and who want to start vdr as user root -# allowed values: yes no -# default: no -#START_VDR_AS_ROOT="no" \ No newline at end of file diff -Naur gentoo-vdr-scripts-2.5_rc1_orig/usr/lib/systemd/system/vdr.service gentoo-vdr-scripts-2.5_rc1/usr/lib/systemd/system/vdr.service --- gentoo-vdr-scripts-2.5_rc1_orig/usr/lib/systemd/system/vdr.service 2014-09-23 12:51:46.000000000 +0200 +++ gentoo-vdr-scripts-2.5_rc1/usr/lib/systemd/system/vdr.service 2014-10-04 03:55:59.552147000 +0200 @@ -18,7 +18,7 @@ # start VDR with our desired parameters, please disable the # internal watchdog by setting the timeout to 0 -ExecStart=/usr/bin/vdr ${VDR_OPTS} +ExecStart=/usr/bin/vdr "$VDR_OPTS" # execute addons/plugins scripts meant to be run afer starting ExecStartPost=/usr/share/vdr/systemd/vdr-systemd_helper.sh --start-post diff -Naur gentoo-vdr-scripts-2.5_rc1_orig/usr/share/vdr/systemd/vdr-systemd_helper.sh gentoo-vdr-scripts-2.5_rc1/usr/share/vdr/systemd/vdr-systemd_helper.sh --- gentoo-vdr-scripts-2.5_rc1_orig/usr/share/vdr/systemd/vdr-systemd_helper.sh 2014-09-23 12:51:46.000000000 +0200 +++ gentoo-vdr-scripts-2.5_rc1/usr/share/vdr/systemd/vdr-systemd_helper.sh 2014-10-04 03:59:37.631027000 +0200 @@ -20,7 +20,7 @@ include rc-functions include plugin-functions -#init_tmp_dirs +init_tmp_dirs VDR_LOG_FILE="${PL_TMP}/vdr-start-log" @@ -29,17 +29,6 @@ #common_init -# grep the user on who should vdr systemd running -# 2 values, vdr or root -run_as_user() { -. /etc/systemd/system/vdr.service.d/00-gentoo-vdr-user.conf - - if yesno "${START_VDR_AS_ROOT}"; then - systemd_vdr_user="root" - else - systemd_vdr_user="vdr" - fi -} # dummy functions to make the rest of gentoo-vdr-scripts happy, # as we do not want to rely on openrc's implementations of these @@ -102,10 +91,11 @@ init_params init_plugin_loader start || eexitfail "init_plugin_loader start" load_addons_prefixed pre-start || eexitfail "load_addons_prefixed pre-start" - run_as_user # these options are what we need to start VDR from the systemd unit file echo "VDR_OPTS=\"${vdr_opts}\"" > ${SYSTEMD_ENV_FILE} - echo "SYSTEMD_VDR_USER=\"${sytemd_vdr_user}\"" >> ${SYSTEMD_ENV_FILE} + # remove the command line --user argument if set by the scripts so far, + # as the user under which vdr will run is controlled by systemd + sed -e "s:'-u' 'vdr' ::" -i ${SYSTEMD_ENV_FILE} sync eend "--start-pre" elif [ "$1" = "--start-post" ]; then