blob: 735d58692f905fe5827e68e95b59085a9084ac2d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
#!/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##
|