Kaynağa Gözat

fix logging; fix stopping; fix run-runtime UID switchig; fix... well, just fix everything.

Ralf S. Engelschall 21 yıl önce
ebeveyn
işleme
a3589f2d95
2 değiştirilmiş dosya ile 22 ekleme ve 5 silme
  1. 16 1
      postgrey/postgrey.spec
  2. 6 4
      postgrey/rc.postgrey

+ 16 - 1
postgrey/postgrey.spec

@@ -34,7 +34,7 @@ Class:        PLUS
 Group:        Mail
 License:      GPL
 Version:      1.16
-Release:      20041011
+Release:      20041208
 
 #   list of sources
 Source0:      http://isg.ee.ethz.ch/tools/postgrey/pub/postgrey-%{version}.tar.gz
@@ -90,6 +90,7 @@ AutoReqProv:  no
     #   install programs and manual pages
     %{l_shtool} install -c -m 755 \
         -e 's;#!/usr/bin/perl;#!%{l_prefix}/bin/perl;g' \
+        -e "s;\\(.\\)Sys::Syslog\\(. : undef\\);\\1%{l_prefix}/var/postgrey/postgrey.log\\2;" \
         postgrey $RPM_BUILD_ROOT%{l_prefix}/sbin/
     %{l_shtool} install -c -m 755 \
         -e 's;#!/usr/bin/perl;#!%{l_prefix}/bin/perl;g' \
@@ -124,3 +125,17 @@ AutoReqProv:  no
 %clean
     rm -rf $RPM_BUILD_ROOT
 
+%post
+    #   after upgrade, restart service
+    [ $1 -eq 2 ] || exit 0
+    eval `%{l_rc} postgrey status 2>/dev/null`
+    [ ".$postgrey_active" = .yes ] && %{l_rc} postgrey restart
+    exit 0
+
+%preun
+    #   before erase, stop service and remove log files
+    [ $1 -eq 0 ] || exit 0
+    %{l_rc} postgrey stop 2>/dev/null
+    rm -f $RPM_INSTALL_PREFIX/var/postgrey/*
+    exit 0
+

+ 6 - 4
postgrey/rc.postgrey

@@ -14,7 +14,7 @@
     postgrey_log_complevel="9"
 
 %common
-    postgrey_logfile="@l_prefix@/var/postgrey/postgrey.pid"
+    postgrey_logfile="@l_prefix@/var/postgrey/postgrey.log"
     postgrey_pidfile="@l_prefix@/var/postgrey/postgrey.pid"
     postgrey_socket="@l_prefix@/var/postgrey/postgrey.socket"
     postgrey_dbdir="@l_prefix@/var/postgrey"
@@ -25,11 +25,13 @@
 %status -u @l_rusr@ -o
     postgrey_usable="unknown"
     postgrey_active="no"
+    rcService postgrey enable yes && \
+        postgrey_signal 0 && postgrey_active="yes"
     echo "postgrey_enable=\"$postgrey_enable\""
     echo "postgrey_usable=\"$postgrey_usable\""
     echo "postgrey_active=\"$postgrey_active\""
 
-%start -u @l_susr@
+%start -u @l_rusr@
     rcService postgrey enable yes || exit 0
     rcService postgrey active yes && exit 0
     @l_prefix@/sbin/postgrey \
@@ -41,13 +43,13 @@
         --delay=$postgrey_delay \
         --max-age=$postgrey_maxage
 
-%stop -u @l_susr@
+%stop -u @l_rusr@
     rcService postgrey enable yes || exit 0
     rcService postgrey active no && exit 0
     postgrey_signal TERM
     rm -f $postgrey_pidfile 2>/dev/null || true
 
-%restart -u @l_susr@
+%restart -u @l_rusr@
     rcService postgrey enable yes || exit 0
     rcService postgrey active no && exit 0
     rc postgrey stop