merge changes from HEAD
authorMark Huang <mlhuang@cs.princeton.edu>
Thu, 6 Jul 2006 18:21:02 +0000 (18:21 +0000)
committerMark Huang <mlhuang@cs.princeton.edu>
Thu, 6 Jul 2006 18:21:02 +0000 (18:21 +0000)
host.init
myplc.spec

index 0f46162..62aeed4 100755 (executable)
--- a/host.init
+++ b/host.init
@@ -6,13 +6,27 @@
 #
 # description: Manages all PLC services on this machine
 #
-# $Id: host.init,v 1.6 2006/04/20 09:01:00 thierry Exp $
+# $Id: host.init,v 1.8 2006/07/06 17:43:52 mlhuang Exp $
 #
 
 PATH=/sbin:/bin:/usr/bin:/usr/sbin
 
 # Source function library.
-. /etc/init.d/functions
+if [ -f /etc/init.d/functions ] ; then
+    . /etc/init.d/functions
+fi
+
+# If success() or failure() are not defined
+if ! type -type success >/dev/null || ! type -type failure >/dev/null ; then
+    success() {
+       echo -ne "[  OK  ]\r"
+       return 0
+    }
+    failure() {
+       echo -ne "[FAILED]\r"
+       return 1
+    }
+fi
 
 # Source configuration
 if [ -f /etc/sysconfig/plc -a -z "${PLC_ROOT}${PLC_DATA}" ] ; then
@@ -101,15 +115,13 @@ stop ()
     fi
 }
 
-mount_status ()
+mountstatus_plc ()
 {
-  lines=$(mount | grep $PLC_ROOT)
-  if [ -z "$lines" ] ; then
-    echo "==== $PLC_ROOT is *not* mounted"
-  else
-    echo "==== The following mount points remain active"
-    echo "$lines"
-  fi
+    for dir in $PLC_ROOT/proc $PLC_ROOT/data $PLC_ROOT ; do
+       if mounted $dir ; then
+           echo $dir
+       fi
+    done
 }
 
 # Get command
@@ -129,13 +141,9 @@ case "$command" in
        start $*
        ;;
 
-    mount|umount)
+    mount|umount|mountstatus)
         ${command}_plc $*
        ;;
-
-    mountstatus)
-        mount_status $*
-       ;;
   
     *)
        echo "Usage: $0 {start|stop|restart|mount|umount|mountstatus}"
index 70e656f..0a6a188 100644 (file)
@@ -1,13 +1,13 @@
 Vendor: PlanetLab
 Packager: PlanetLab Central <support@planet-lab.org>
-Distribution: PlanetLab 3.3
+Distribution: PlanetLab 4.0
 URL: http://cvs.planet-lab.org/cvs/myplc
 
 Summary: PlanetLab Central (PLC) Portable Installation
 Name: myplc
-Version: 0.4
+Version: 0.5
 Release: 1%{?pldistro:.%{pldistro}}%{?date:.%{date}}
-License: BSD
+License: PlanetLab
 Group: Applications/Systems
 Source0: %{name}-%{version}.tar.gz
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
@@ -73,15 +73,19 @@ if [ -x %{_sysconfdir}/init.d/plc ] ; then
 fi
 
 %post
-chkconfig --add plc
-chkconfig plc on
+if [ -x /sbin/chkconfig ] ; then
+    /sbin/chkconfig --add plc
+    /sbin/chkconfig plc on
+fi
 
 %preun
 # 0 = erase, 1 = upgrade
 if [ $1 -eq 0 ] ; then
-    service plc stop
-    chkconfig plc off
-    chkconfig --del plc
+    %{_sysconfdir}/init.d/plc stop
+    if [ -x /sbin/chkconfig ] ; then
+        /sbin/chkconfig plc off
+       /sbin/chkconfig --del plc
+    fi
 fi
 
 %files