Browse Source

Implement features in ticket #202, but leave this JUNK package broken for now

Michael Schloh von Bennewitz 22 years ago
parent
commit
c8bc3719b8
2 changed files with 56 additions and 7 deletions
  1. 37 1
      rdist/rc.rdist
  2. 19 6
      rdist/rdist.spec

+ 37 - 1
rdist/rc.rdist

@@ -11,14 +11,50 @@
     rdist_log_minsize="1M"
     rdist_log_complevel="9"
 
+%common
+    rdist_pidfile="@l_prefix@/var/rdist/rdist.pid"
+    rdist_cfgfile="@l_prefix@/etc/rdist/rdist.conf"
+    rdist_signal () {
+        [ -f $rdist_pidfile ] && kill -$1 `cat $rdist_pidfile`
+    }
+
+%status -u @l_susr@ -o
+    rdist_usable="unknown"
+    rdist_active="no"
+    rcService rdist enable yes && \
+        rdist_signal 0 && rdist_active="yes"
+    echo "rdist_enable=\"$rdist_enable\""
+    echo "rdist_usable=\"$rdist_usable\""
+    echo "rdist_active=\"$rdist_active\""
+
+%start -u @l_susr@
+    rcService rdist enable yes || exit 0
+    rcService rdist active yes && exit 0
+    @l_prefix@/sbin/rdist -S -D &
+    echo $! >$rdist_pidfile
+
+%stop -u @l_susr@
+    rcService rdist enable yes || exit 0
+    rcService rdist active no && exit 0
+    rdist_signal TERM
+    rm $rdist_pidfile
+
+%restart -u @l_susr@
+    rcService rdist enable yes || exit 0
+    rcService rdist active no && exit 0
+    rc rdist stop
+    sleep 2
+    rc rdist start
+
 %daily -u @l_susr@
     rcService rdist enable yes || exit 0
 
     #   rotate logfile
     shtool rotate -f \
         -n ${rdist_log_numfiles} -s ${rdist_log_minsize} -d \
-        -z ${rdist_log_complevel} -o @l_rusr@ -g @l_rgrp@ -m 644 \
+        -z ${rdist_log_complevel} -o @l_susr@ -g @l_mgrp@ -m 644 \
         -P "${rdist_log_prolog}" \
+        -E "${rdist_log_epilog} && rc rdist restart" \
         -E "${rdist_log_epilog}" \
         @l_prefix@/var/rdist/rdist.log
 

+ 19 - 6
rdist/rdist.spec

@@ -40,13 +40,13 @@ Distribution: OpenPKG [JUNK]
 Group:        Filesystem
 License:      BSD
 Version:      %{V_opkg}
-Release:      20030721
+Release:      20031001
 
 #   package options
 %option       with_fsl  yes
 
 #   list of sources
-Source0:      http://www.magnicomp.com/download/rdist/rdist-%{V_base}-%{V_pl}.tar.gz
+Source0:      ftp://ftp.rge.com/download/rdist/rdist-%{V_base}-%{V_pl}.tar.gz
 Source1:      rc.rdist
 Source2:      fsl.rdist
 
@@ -63,10 +63,9 @@ AutoReq:      no
 AutoReqProv:  no
 
 %description
-    RDist is an open source program to maintain identical copies of
-    files over multiple hosts. It preserves the owner, group, mode,
-    and mtime of files if possible and can update programs that are
-    executing.
+    RDist maintains identical copies of files over multiple hosts.
+    It preserves the owner, group, mode, and mtime of files if
+    possible and can update programs that are executing.
 
 %prep
     %setup -q -n rdist-%{V_base}-%{V_pl}
@@ -124,3 +123,17 @@ AutoReqProv:  no
 %clean
     rm -rf $RPM_BUILD_ROOT
 
+%post
+    #   after upgrade, restart service
+    [ $1 -eq 2 ] || exit 0
+    eval `%{l_rc} rdist status 2>/dev/null`
+    [ ".$rdist_active" = .yes ] && %{l_rc} rdist restart
+    exit 0
+
+%preun
+    #   before erase, stop service and remove log files
+    [ $1 -eq 0 ] || exit 0
+    %{l_rc} rdist stop 2>/dev/null
+    rm -f $RPM_INSTALL_PREFIX/var/rdist/rdist.log* >/dev/null 2>&1 || true
+    exit 0
+