#!/bin/sh -e set -e TEMPLATE_DIR=/usr/share/vdradmin/template # Check if there are still cfgfiles in /etc/vdradmin/ and move them # to /var/lib/vdradmin if [ ! -f /var/lib/vdradmin/vdradmind.conf ]; then if [ -f /etc/vdradmin/vdradmind.conf ]; then mv /etc/vdradmin/vdradmind.conf /var/lib/vdradmin/ else cp /usr/share/doc/vdradmin/examples/vdradmind.conf /var/lib/vdradmin/ fi fi [ -e /etc/vdradmin/vdradmind.conf ] || ln -s /var/lib/vdradmin/vdradmind.conf \ /etc/vdradmin/vdradmind.conf if [ ! -f /var/lib/vdradmin/vdradmind.at ]; then [ ! -f /etc/vdradmin/vdradmind.at ] || mv /etc/vdradmin/vdradmind.at /var/lib/vdradmin/ fi # ensure that user and group 'vdradmin' exist USER=vdradmin GROUP=vdradmin if ! getent group | grep -q "^$GROUP:" ; then echo -n "Adding group $GROUP.." addgroup --quiet --system $GROUP echo "..done" fi if ! getent passwd | grep -q "^$USER:"; then echo -n "Adding user $USER.." adduser --system --home /var/lib/vdradmin --shell /bin/false \ --gecos "VDRAdmin user" --no-create-home \ --disabled-login --disabled-password \ --ingroup $GROUP \ $USER echo "...done" fi # ensure vdradmind.at (auto timers) exists ATFILE=/var/lib/vdradmin/vdradmind.at [ -e $ATFILE ] || touch $ATFILE # ensure that vdradmin's config files have the correct owner [ ! -d /var/lib/vdradmin ] || chown -R $USER:$GROUP /var/lib/vdradmin/ # change the permissions of the cfg-file to 0600 [ ! -e /var/lib/vdradmin/vdradmind.conf ] || chmod 0600 /var/lib/vdradmin/vdradmind.conf # change the owner and group of the logfile to vdradmin [ ! -e /var/log/vdradmind.log ] || chown $USER:$GROUP /var/log/vdradmind.log # make auto timer file "read/writeable" by group vdr and config file readable # by group "vdr",so that vdr plugins (Autotimeredit plugin) get access if getent group | grep -q "^vdr:" ; then if [ -d /var/lib/vdradmin ] ; then chgrp -R vdr /var/lib/vdradmin chmod a=,ug=rwx /var/lib/vdradmin chmod a=,ug=rw $ATFILE CFGFILE=/var/lib/vdradmin/vdradmind.conf [ -e $CFGFILE ] && chmod a=,u=rw,g=r $CFGFILE fi fi ##DEBHELPER##