Explorar o código

fix configuration and deinstallation problems

Ralf S. Engelschall %!s(int64=24) %!d(string=hai) anos
pai
achega
71dd208ead
Modificáronse 1 ficheiros con 16 adicións e 0 borrados
  1. 16 0
      postfix/postfix.spec

+ 16 - 0
postfix/postfix.spec

@@ -244,19 +244,35 @@ Provides:     MTA
 
 %post
     if [ $1 -eq 1 ]; then
+        #   generate logfile with correct owner and permissions
+        if [ ! -f $RPM_INSTALL_PREFIX/var/postfix/log/postfix.log ]; then
+            $RPM_INSTALL_PREFIX/lib/openpkg/shtool \
+                install -c -m 755 -o %{l_musr} -g %{l_mgrp} \
+                /dev/null $RPM_INSTALL_PREFIX/var/postfix/log/postfix.log
+        fi
+        #   generate initial configuration
         (cd $RPM_INSTALL_PREFIX/etc/postfix; %{l_make} all >/dev/null 2>&1 || true)
     elif [ $1 -gt 1 ]; then
+        #   re-genersate configuration
         (cd $RPM_INSTALL_PREFIX/etc/postfix; %{l_make} clean all >/dev/null 2>&1 || true)
+        #   re-load daemon
         $RPM_INSTALL_PREFIX/etc/rc postfix reload >/dev/null 2>&1 || true
     fi
 
 %preun
     if [ $1 -eq 0 ]; then
+        #   stop daemon
         $RPM_INSTALL_PREFIX/etc/rc postfix stop >/dev/null 2>&1 || true
+        #   remove generated configuration files
         (cd $RPM_INSTALL_PREFIX/etc/postfix/; %{l_make} clean >/dev/null 2>&1 || true)
+        #   remove generated run-time files and directories
         rm -rf $RPM_INSTALL_PREFIX/etc/postfix/prng_exch
         rm -rf $RPM_INSTALL_PREFIX/var/postfix/pid/*
         rm -rf $RPM_INSTALL_PREFIX/var/postfix/private/*
         rm -rf $RPM_INSTALL_PREFIX/var/postfix/public/*
+        find $RPM_INSTALL_PREFIX/var/postfix/active/ -type d -print |\
+            xargs rmdir >/dev/null 2>&1 || true
+        find $RPM_INSTALL_PREFIX/var/postfix/incoming/ -type d -print |\
+            xargs rmdir >/dev/null 2>&1 || true
     fi