summarylogtreecommitdiffstats
path: root/sendmail.install
blob: 866adb934edf064e40784b931ac0d75d4fd17a3e (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
post_install() {
  if grep -q "^smmsp:" /etc/group &> /dev/null ; then
    groupmod -g 25 -n smmsp smmsp &> /dev/null
  else
    groupadd -g 25 smmsp &> /dev/null
  fi

  if grep -q "^smmsp:" /etc/passwd 2> /dev/null ; then
    usermod -s /bin/false -c "sendmail user" -d /var/spool/mail -u 150 -g smmsp smmsp &> /dev/null
  else
    useradd -s /bin/false -c "sendmail user" -d /var/spool/mail -u 150 -g smmsp -r smmsp &> /dev/null
  fi
  chown smmsp:smmsp /var/spool/clientmqueue
  chown root:smmsp /usr/bin/sendmail
  chmod 2555 /usr/bin/sendmail
}

post_upgrade() {
  post_install $1
}

pre_remove() {
  systemctl stop sendmail|| :
  systemctl stop sm-client|| :
  killall sendmail || /bin/true
  userdel smmsp &> /dev/null
  rm -f /etc/mail/aliases.db || /bin/true
  groupdel smmsp &> /dev/null || /bin/true
  rmdir --ignore-fail-on-non-empty /var/spool/mqueue &> /dev/null || /bin/true
}