summaryrefslogtreecommitdiff
path: root/debian/twoftpd-run.postinst
blob: 206418bfb61c95900cb3a3101773a9b8ee298640 (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
#!/bin/sh
set -e

test "$1" = 'configure' || exit 0

getent passwd ftp >/dev/null || \
  adduser --system --home /var/ftp --no-create-home ftp
getent passwd ftplog >/dev/null || \
  adduser --system --home /nonexistent --no-create-home ftplog

READD=twoftpd
test -z "$2" || dpkg --compare-versions "$2" gt '1.21-4' || {
  update-service --remove /etc/twoftpd 2>/dev/null || :
  if update-service --check twoftpd-anon; then
    update-service --remove /etc/twoftpd-anon || :
    READD=twoftpd-anon
  fi
  sleep 6
  for i in twoftpd twoftpd-anon; do
    rm -rf /var/run/$i /var/run/$i.log
  done
}
update-service --add /etc/$READD

test -z "$2" || exit 0

# new install
chown ftplog:adm /var/log/twoftpd /var/log/twoftpd-anon
chmod 2750 /var/log/twoftpd /var/log/twoftpd-anon