summarylogtreecommitdiffstats
path: root/vdr-devel.install
blob: 9ff74353fb0b3a817a963fd9b292634862c0faf2 (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
# vdr.install

# VDR directory environment
VDR_USER=vdr
CONFDIR=/etc/vdr
VIDEODIR=/var/spool/video
EPGDIR=/var/spool/epg

## arg 1:  the new package version
post_install() {
  echo ""
  echo "********************************************************************"
  echo "  Configuration files are installed in ${CONFDIR} and should be"
  echo '  owned by "'${VDR_USER}':'${VDR_USER}'"'
  echo ""
  echo "  NOTE: The template runvdr script that comes with the vdr source"
  echo "  is installed in /usr/share/doc/vdr, NOT in /usr/bin. To make a"
  echo "  fully working installation either copy the template to /usr/bin,"
  echo "  edit it as necessary and then make it executable or use one of"
  echo "  the alternative runvdr scripts that can be found by searching"
  echo "  the Internet, e.g. runvdr-extreme."
  echo "********************************************************************"
  echo ""
  if ! getent passwd ${VDR_USER} >/dev/null; then
    echo -n 'Creating VDR user "'${VDR_USER}'"...'
    [ ! -e ${VIDEODIR} ] && mkdir -p ${VIDEODIR}
    [ ! -e ${EPGDIR} ] && mkdir -p ${EPGDIR}
    usr/sbin/groupadd -g 199 ${VDR_USER} >/dev/null
    /usr/sbin/useradd -r -d ${VIDEODIR} -g ${VDR_USER} -G video -s /bin/false -c "Video Disk Recorder" ${VDR_USER} &>/dev/null
    passwd -l ${VDR_USER} &>/dev/null
    chown -R ${VDR_USER}:${VDR_USER} ${CONFDIR}
    chown ${VDR_USER}:${VDR_USER} ${VIDEODIR}
    chown ${VDR_USER}:${VDR_USER} ${EPGDIR}
    echo "done."
    echo ""
  else
    echo 'VDR user "'${VDR_USER}'" already exists.  Check that:'
    echo '1. "'${CONFDIR}'" and vdr configuration files are owned by "'${VDR_USER}':'${VDR_USER}'"'
    echo '2. "'${VIDEODIR}'" exists and is owned by "'${VDR_USER}':'${VDR_USER}'"'
    echo '3. "'${EPGDIR}'" exists and is owned by "'${VDR_USER}':'${VDR_USER}'"'
    echo ""
  fi
}

## arg 1:  the new package version
## arg 2:  the old package version
post_upgrade() {
  post_install $1
}

# arg 1:  the old package version
post_remove() {
  echo 'VDR user "'${VDR_USER}'", "'${EPGDIR}'" and "'${VIDEODIR}'" will not be deleted.'
}