summarylogtreecommitdiffstats
path: root/sendmail.install
diff options
context:
space:
mode:
Diffstat (limited to 'sendmail.install')
-rw-r--r--sendmail.install29
1 files changed, 29 insertions, 0 deletions
diff --git a/sendmail.install b/sendmail.install
new file mode 100644
index 000000000000..0c7fb25f9cd0
--- /dev/null
+++ b/sendmail.install
@@ -0,0 +1,29 @@
+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
+}