summaryrefslogtreecommitdiff
path: root/extra/fetchmail/fetchmail.install
blob: 5f6dc4911c898e6a60dfa33f33a87abd4b03aa38 (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
post_install() {
  # /etc/fetchmail must be owned by fetchmail for daemon to work.
  echo "If you run fetchmail as a daemon and not a cron job"
  echo "then 'chown fetchmail /etc/fetchmailrc'"
  getent passwd fetchmail >/dev/null || usr/sbin/useradd -u 90 -g nobody \
      -d '/var/lib/fetchmail' -c 'Fetchmail daemon' -s /bin/false fetchmail
  if [[ ! -d run/fetchmail ]]; then
    usr/bin/systemd-tmpfiles --create fetchmail.conf
  fi
}

post_upgrade() {
  getent passwd fetchmail >/dev/null || usr/sbin/useradd -u 90 -g nobody \
      -d '/var/lib/fetchmail' -c 'Fetchmail daemon' -s /bin/false fetchmail

  if [ "$(vercmp $2 6.3.19-3)" -lt 0 ] ; then
    usermod -d '/var/lib/fetchmail' -s /bin/false fetchmail
  fi
  if [[ ! -d run/fetchmail ]]; then
    usr/bin/systemd-tmpfiles --create fetchmail.conf
  fi
}

pre_remove() {
  usr/sbin/userdel fetchmail &>/dev/null
}