Ver código fonte

Complete for compliance with features described by ticket #202

Michael Schloh von Bennewitz 22 anos atrás
pai
commit
c5ace50321
2 arquivos alterados com 29 adições e 3 exclusões
  1. 22 1
      mico/mico.spec
  2. 7 2
      mico/rc.mico

+ 22 - 1
mico/mico.spec

@@ -33,7 +33,7 @@ Distribution: OpenPKG [PLUS]
 Group:        System
 License:      LGPL/GPL
 Version:      2.3.10
-Release:      20030813
+Release:      20030814
 
 #   package options
 %option       with_ssl      no
@@ -202,3 +202,24 @@ AutoReqProv:  no
 %clean
     rm -rf $RPM_BUILD_ROOT
 
+%pre
+    #   before upgrade, save status and stop service
+    [ $1 -eq 2 ] || exit 0
+    eval `%{l_rc} mico status 2>/dev/null | tee %{l_tmpfile}`
+    %{l_rc} mico stop 2>/dev/null
+    exit 0
+
+%post
+    if [ $1 -eq 2 ]; then
+        #   after upgrade, restore status
+        eval `cat %{l_tmpfile}`; rm -f %{l_tmpfile}
+        [ ".$mico_active" = .yes ] && %{l_rc} mico start
+    fi
+    exit 0
+
+%preun
+    #   before erase, stop service
+    [ $1 -eq 0 ] || exit 0
+    %{l_rc} mico stop 2>/dev/null
+    exit 0
+

+ 7 - 2
mico/rc.mico

@@ -7,8 +7,10 @@
     mico_enable="$openpkg_rc_def"
     mico_micod="no"
     mico_nsd="no"
-    mico_nsd_args="-ORBGIOPVersion 1.2 -ORBIIOPVersion 1.2 -ORBIIOPAddr inet:`uname -n`:8914"
-    mico_micod_args="-ORBGIOPVersion 1.2 -ORBIIOPVersion 1.2 -ORBIIOPAddr inet:`uname -n`:8912"
+    mico_ip_micod="127.0.0.1"
+    mico_ip_nsd="127.0.0.1"
+    mico_micod_args="-ORBGIOPVersion 1.2 -ORBIIOPVersion 1.2 -ORBIIOPAddr inet:${mico_ip_micod}:8912"
+    mico_nsd_args="-ORBGIOPVersion 1.2 -ORBIIOPVersion 1.2 -ORBIIOPAddr inet:${mico_ip_nsd}:8914"
 
 %common
     mico_micod_pidfile="@l_prefix@/var/mico/micod.pid"
@@ -41,6 +43,7 @@
 
 %start -u @l_rusr@
     rcService mico enable yes || exit 0
+    rcService mico active yes && exit 0
     #   run the object adapter daemon for dynamic object activation
     if rcVarIsYes mico_micod; then
         @l_prefix@/bin/micod ${mico_micod_args} &
@@ -54,12 +57,14 @@
 
 %stop -u @l_rusr@
     rcService mico enable yes || exit 0
+    rcService mico active no && exit 0
     mico_signal TERM
     rm -f $mcio_micod_pidfile 2>/dev/null || true
     rm -f $mcio_nsd_pidfile 2>/dev/null || true
 
 %restart -u @l_rusr@
     rcService mico enable yes || exit 0
+    rcService mico active no && exit 0
     rc mico stop
     sleep 2
     rc mico start