OpenPKG CVS Repository
  http://cvs.openpkg.org/
  ____________________________________________________________________________

  Server: cvs.openpkg.org                  Name:   Thomas Lotterer
  Root:   /e/openpkg/cvs                   Email:  [EMAIL PROTECTED]
  Module: openpkg-src openpkg-web          Date:   18-Jul-2003 00:05:25
  Branch: HEAD                             Handle: 2003071723052302

  Modified files:
    openpkg-src/postfix     postfix.spec rc.postfix
    openpkg-web             news.txt

  Log:
    PR#202: spec ghost log, %pre, %post, %preun; rc %status

  Summary:
    Revision    Changes     Path
    1.154       +41 -30     openpkg-src/postfix/postfix.spec
    1.18        +22 -7      openpkg-src/postfix/rc.postfix
    1.5623      +1  -0      openpkg-web/news.txt
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: openpkg-src/postfix/postfix.spec
  ============================================================================
  $ cvs diff -u -r1.153 -r1.154 postfix.spec
  --- openpkg-src/postfix/postfix.spec  17 Jul 2003 21:56:45 -0000      1.153
  +++ openpkg-src/postfix/postfix.spec  17 Jul 2003 22:05:25 -0000      1.154
  @@ -39,7 +39,7 @@
   Group:        Mail
   License:      IPL
   Version:      %{V_postfix}
  -Release:      20030717
  +Release:      20030718
   
   #   package options
   %option       with_fsl       yes
  @@ -253,7 +253,7 @@
             flush incoming private saved
         %{l_shtool} mkdir -f -p -m 730 maildrop
         %{l_shtool} mkdir -f -p -m 710 public
  -      %{l_shtool} mkdir -f -p -m 755 log pid )
  +      %{l_shtool} mkdir -f -p -m 755 pid )
   
       #   install addons
       ( cd pflogsumm-%{V_pflogsumm}
  @@ -279,11 +279,18 @@
           %{SOURCE fsl.postfix} \
           $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
   
  +    #   install ghost log
  +    %{l_shtool} mkdir -f -p -m 755 \
  +        $RPM_BUILD_ROOT%{l_prefix}/var/postfix/log
  +    %{l_shtool} install -c /dev/null \
  +        $RPM_BUILD_ROOT%{l_prefix}/var/postfix/log/postfix.log
  +
       #   generate file list
       %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
           %{l_files_std} \
           '%not %dir %{l_prefix}/etc/fsl' \
           '%config %{l_prefix}/etc/fsl/fsl.postfix' \
  +        '%ghost %attr(644,%{l_musr},%{l_mgrp}) 
%{l_prefix}/var/postfix/log/postfix.log' \
           '%attr(-,%{l_susr},%{l_mgrp}) %{l_prefix}/etc/postfix' \
           '%config %attr(-,%{l_susr},%{l_mgrp}) %{l_prefix}/etc/postfix/*' \
           '%attr(-,%{l_susr},%{l_mgrp}) %{l_prefix}/libexec/postfix/*' \
  @@ -297,37 +304,41 @@
   %clean
       rm -rf $RPM_BUILD_ROOT
   
  +%pre
  +    #   before upgrade, save status and stop service
  +    [ $1 -eq 2 ] || exit 0
  +    eval `%{l_rc} postfix status 2>/dev/null | tee %{l_tmpfile}`
  +    %{l_rc} postfix stop 2>/dev/null
  +    exit 0
  +
   %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-generate 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
  +        #   after install, generate configuration
  +        ( cd $RPM_INSTALL_PREFIX/etc/postfix && %{l_make} all; true ) >/dev/null 
2>&1
       fi
  +    if [ $1 -eq 2 ]; then
  +        #   after upgrade, regenerate configuration
  +        ( cd $RPM_INSTALL_PREFIX/etc/postfix && %{l_make} clean all; true ) 
>/dev/null 2>&1
  +        #   after upgrade, restore status
  +        { eval `cat %{l_tmpfile}`; rm -f %{l_tmpfile}; true; } >/dev/null 2>&1
  +        [ ".$postfix_active" = .yes ] && %{l_rc} postfix start
  +    fi
  +    exit 0
   
   %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
  +    #   before erase, stop service
  +    [ $1 -eq 0 ] || exit 0
  +    %{l_rc} postfix stop 2>/dev/null
  +    #   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
  +    exit 0
   
  @@ .
  patch -p0 <<'@@ .'
  Index: openpkg-src/postfix/rc.postfix
  ============================================================================
  $ cvs diff -u -r1.17 -r1.18 rc.postfix
  --- openpkg-src/postfix/rc.postfix    17 Jul 2003 21:34:59 -0000      1.17
  +++ openpkg-src/postfix/rc.postfix    17 Jul 2003 22:05:25 -0000      1.18
  @@ -15,32 +15,47 @@
       postfix_log_complevel="9"
       postfix_sum_flags=""
   
  +%status -p 200 -u @l_susr@ -o
  +    postfix_usable="no"
  +    postfix_active="no"
  +    @l_prefix@/sbin/postfix check 2>&1 >/dev/null && postfix_usable="yes"
  +    @l_prefix@/libexec/postfix/master -t 2>&1 >/dev/null || postfix_active="yes"
  +    echo "postfix_enable=\"$postfix_enable\""
  +    echo "postfix_usable=\"$postfix_usable\""
  +    echo "postfix_active=\"$postfix_active\""
  +
   %start -p 200 -u @l_susr@
       opService postfix enable yes || exit 0
  +    opService postfix active yes && exit 0
       @l_prefix@/sbin/postfix start
   
   %stop -p 200 -u @l_susr@
       opService postfix enable yes || exit 0
  +    opService postfix active no  && exit 0
       @l_prefix@/sbin/postfix stop
   
  -%restart -u @l_susr@
  +%restart -p 200 -u @l_susr@
       opService postfix enable yes || exit 0
  -    @l_prefix@/sbin/postfix stop
  +    opService postfix active no  && exit 0
  +    rc postfix stop
       sleep 2
  -    @l_prefix@/sbin/postfix start
  +    rc postfix start
   
   %reload -u @l_susr@
       opService postfix enable yes || exit 0
  +    opService postfix active no  && exit 0
       @l_prefix@/sbin/postfix reload
   
   %daily -u @l_susr@
       opService postfix enable yes || exit 0
   
  -    #   generate logfile summary
  +    #   rotate summary logfile
       shtool rotate -f \
           -n${postfix_log_numfiles} -s0 \
  -        -z${postfix_log_complevel} [EMAIL PROTECTED]@ [EMAIL PROTECTED]@ -m644 \
  +        -z${postfix_log_complevel} -m644 [EMAIL PROTECTED]@ [EMAIL PROTECTED]@ \
           @l_prefix@/var/postfix/log/postfix.sum
  +
  +    #   generate summary logfile
       logfiles="@l_prefix@/var/postfix/log/postfix.log"
       if [ -f "@l_prefix@/var/postfix/log/postfix.log.0" ]; then
           logfiles="$logfiles @l_prefix@/var/postfix/log/postfix.log.0"
  @@ -53,8 +68,8 @@
       #   rotate logfile
       shtool rotate -f \
           -n${postfix_log_numfiles} -s${postfix_log_minsize} -d \
  -        -z${postfix_log_complevel} [EMAIL PROTECTED]@ [EMAIL PROTECTED]@ -m644 \
  +        -z${postfix_log_complevel} -m644 [EMAIL PROTECTED]@ [EMAIL PROTECTED]@ 
-m644 \
           -P "$postfix_log_prolog" \
  -        -E "@l_prefix@/sbin/postfix reload; $postfix_log_epilog" \
  +        -E "$postfix_log_epilog && rc postfix reload" \
           @l_prefix@/var/postfix/log/postfix.log
   
  @@ .
  patch -p0 <<'@@ .'
  Index: openpkg-web/news.txt
  ============================================================================
  $ cvs diff -u -r1.5622 -r1.5623 news.txt
  --- openpkg-web/news.txt      17 Jul 2003 21:50:12 -0000      1.5622
  +++ openpkg-web/news.txt      17 Jul 2003 22:05:23 -0000      1.5623
  @@ -1,3 +1,4 @@
  +18-Jul-2003: Upgraded package: P<postfix-2.0.13-20030718>
   17-Jul-2003: Upgraded package: P<wine-20030709-20030717>
   17-Jul-2003: Upgraded package: P<portfwd-0.26rc6-20030717>
   17-Jul-2003: New package: P<wine-20030709-20030717>
  @@ .
______________________________________________________________________
The OpenPKG Project                                    www.openpkg.org
CVS Repository Commit List                     [EMAIL PROTECTED]

Reply via email to