1 # arg 1: the new package version
4 # check for logcheck group in case account exists without group
5 if ! getent group logcheck >/dev/null; then
10 # check for logcheck user or bad version without home
11 if ! getent passwd logcheck > /dev/null; then
12 useradd --home /var/log/logcheck -g logcheck --groups log,adm logcheck || true
15 # give logcheck system user a real name unless it has one.
16 if [ -z "$(getent passwd logcheck | cut -d: -f5)" ]; then
17 chfn -f 'logcheck system account' logcheck
20 # make sure the home directory exists
21 if [ ! -d "$(getent passwd logcheck | cut -d: -f6)" ]; then
22 usermod -d /var/lib/logcheck logcheck > /dev/null || true
25 # add logcheck to /etc/aliases
26 if [ -f /etc/aliases ] || [ -L /etc/aliases ]; then
27 if ! grep -qi "^logcheck[[:space:]]*:" /etc/aliases; then
28 echo "logcheck: root" >> /etc/aliases
29 test -x "$(command -v newaliases)" && newaliases || :
33 # add logcheck to /etc/postfix/aliases
34 aliases="/etc/postfix/aliases"
35 if [ -f $aliases ] || [ -L $aliases ]; then
36 if ! grep -qi "^logcheck[[:space:]]*:" $aliases; then
37 echo "logcheck: root" >> $aliases
38 test -x "`command -v newaliases`" && newaliases || :
43 chown -R logcheck:logcheck /etc/logcheck /var/lock/logcheck /var/lib/logcheck || true
44 chmod 750 /etc/logcheck
45 chmod 755 /var/lock/logcheck
47 # tell the user how to test it
48 echo ">>> To test your installation run 'logcheck -ot'"
51 # arg 1: the new package version
52 # arg 2: the old package version
55 usermod -G log,adm,logcheck logcheck
58 # arg 1: the old package version
60 userdel logcheck &> /dev/null
61 groupdel logcheck &> /dev/null
62 rmdir --ignore-fail-on-non-empty /etc/logcheck/cracking.ignore.d
63 rmdir --ignore-fail-on-non-empty /var/lib/logcheck /var/lock/logcheck