Author: glen
Date: Sun Sep 17 18:47:59 2006
New Revision: 7774

Modified:
   rc-scripts/trunk/rc.d/init.d/cpusets
   rc-scripts/trunk/rc.d/init.d/network
   rc-scripts/trunk/rc.d/init.d/sys-chroots
   rc-scripts/trunk/rc.d/init.d/timezone
Log:
Use functions to avoid reexec for restart.

Modified: rc-scripts/trunk/rc.d/init.d/cpusets
==============================================================================
--- rc-scripts/trunk/rc.d/init.d/cpusets        (original)
+++ rc-scripts/trunk/rc.d/init.d/cpusets        Sun Sep 17 18:47:59 2006
@@ -65,20 +65,7 @@
        fi
 }
 
-# find all the interfaces besides loopback.
-# ignore aliases, alternative configurations, and editor backup files
-cpusets_boot=$( (
-       . /etc/rc.d/init.d/functions; \
-       cd /etc/sysconfig/cpusets && ls -1 cpuset* | \
-       egrep 'cpuset-[a-z0-9\.:]+$' | \
-       for i in `cat`; do \
-               ONBOOT=""; . /etc/sysconfig/cpusets/"$i"; is_yes "$ONBOOT" && 
echo "$i"; \
-       done | \
-       awk ' { gsub(/cpuset-/,NIL); print $0 } ') 2> /dev/null)
-
-# See how we were called.
-case "$1" in
-  start)
+start() {
        rc_splash "bootcpusets start"
 
        for i in $cpusets_boot ; do
@@ -91,8 +78,9 @@
        done
 
        touch /var/lock/subsys/cpusets
-       ;;
-  stop)
+}
+
+stop() {
        for i in $cpusets_boot ; do
                show "$(nls -n "Removing cpuset %s" "$i")"
                busy
@@ -108,6 +96,26 @@
        done
 
        rm -f /var/lock/subsys/cpusets
+}
+
+# find all the interfaces besides loopback.
+# ignore aliases, alternative configurations, and editor backup files
+cpusets_boot=$( (
+       . /etc/rc.d/init.d/functions; \
+       cd /etc/sysconfig/cpusets && ls -1 cpuset* | \
+       egrep 'cpuset-[a-z0-9\.:]+$' | \
+       for i in `cat`; do \
+               ONBOOT=""; . /etc/sysconfig/cpusets/"$i"; is_yes "$ONBOOT" && 
echo "$i"; \
+       done | \
+       awk ' { gsub(/cpuset-/,NIL); print $0 } ') 2> /dev/null)
+
+# See how we were called.
+case "$1" in
+  start)
+       start
+       ;;
+  stop)
+       stop
        ;;
   status)
        nls "Configured cpusets:"
@@ -129,8 +137,8 @@
        echo
        ;;
   restart)
-       $0 stop
-       $0 start
+       stop
+       start
        ;;
   *)
        echo "Usage: $0 {start|stop|restart|status}"

Modified: rc-scripts/trunk/rc.d/init.d/network
==============================================================================
--- rc-scripts/trunk/rc.d/init.d/network        (original)
+++ rc-scripts/trunk/rc.d/init.d/network        Sun Sep 17 18:47:59 2006
@@ -130,6 +130,79 @@
        done
 }
 
+start() {
+       if is_yes "$VSERVER"; then
+               touch /var/lock/subsys/network
+               exit 0
+       fi
+
+       rc_splash "bootnetwork start"
+       network_init
+
+       for i in $interfaces_boot $interfaces_vlan_boot $interfaces_sit_boot ; 
do
+               run_cmd -a "$(nls 'Bringing up interface %s' "$i")" /sbin/ifup 
$i boot
+       done
+
+       for i in $interfaces_br_boot ; do
+               run_cmd -a "$(nls 'Bringing up bridge interface %s' "$i")" 
/sbin/ifup $i boot
+       done
+
+       for i in $tunnels; do
+               run_cmd -a "$(nls 'Setting tunnel %s' "$i")" /sbin/tnlup $i boot
+               run_cmd -a "$(nls 'Bringing up tunnel interface %s' "$i")" 
/sbin/ifup tnlcfg-$i boot
+       done
+
+       network_postinit
+
+       touch /var/lock/subsys/network
+}
+
+stop() {
+       if is_yes "$VSERVER"; then
+               rm -f /var/lock/subsys/network
+               exit 0
+       fi
+
+       # If we go to runlevel 0, 1 or 6 then umount all network fs
+       if [ "$RUNLEVEL" = "6" -o "$RUNLEVEL" = "0" -o "$RUNLEVEL" = "1" ]; then
+               if [ -x /etc/rc.d/init.d/netfs -a -f /var/lock/subsys/netfs ];
+               then
+                       /etc/rc.d/init.d/netfs stop
+               else
+                       netmtab=$(awk '{ if ($3 ~ /^(nfs|smbfs|ncpfs|cifs)$/ ) 
print $3}' /proc/mounts)
+                       if (echo "$netmtab" | grep -q nfs); then
+                               run_cmd "Unmounting NFS filesystems" umount 
-fat nfs
+                       fi
+                       if (echo "$netmtab" | grep -q smbfs); then
+                               run_cmd "Unmounting SMB filesystems" umount -at 
smbfs
+                       fi
+                       if (echo "$netmtab" | grep -q ncpfs); then
+                               run_cmd "Unmounting NCP filesystems" umount -at 
ncpfs
+                       fi
+                       if (echo "$netmtab" | grep -q cifs); then
+                               run_cmd "Unmounting CIFS filesystems" umount 
-at cifs
+                       fi
+               fi
+       fi
+
+       for i in $tunnels; do
+               run_cmd -a "$(nls 'Shutting down tunnel interface %s' "$i")" 
/sbin/ifdown tnlcfg-$i boot
+               run_cmd -a "$(nls 'Removing tunnel %s' "$i")" /sbin/tnldown $i 
boot
+       done
+
+       for i in $interfaces_br_boot ; do
+               run_cmd -a "$(nls 'Shutting down bridge interface %s' "$i")" 
/sbin/ifdown $i boot
+       done
+
+       for i in $interfaces_sit_boot $interfaces_vlan_boot $interfaces_boot ; 
do
+               run_cmd -a "$(nls 'Shutting down interface %s' "$i")" 
/sbin/ifdown $i boot
+       done
+
+       network_deinit
+
+       rm -f /var/lock/subsys/network
+}
+
 ifcfg_files="$(network_interface_configs 'ifcfg-*')"
 bootprio=$(grep '^BOOTPRIO=' $ifcfg_files)
 
@@ -200,75 +273,10 @@
 # See how we were called.
 case "$1" in
   start)
-       if is_yes "$VSERVER"; then
-               touch /var/lock/subsys/network
-               exit 0
-       fi
-
-       rc_splash "bootnetwork start"
-       network_init
-
-       for i in $interfaces_boot $interfaces_vlan_boot $interfaces_sit_boot ; 
do
-               run_cmd -a "$(nls 'Bringing up interface %s' "$i")" /sbin/ifup 
$i boot
-       done
-
-       for i in $interfaces_br_boot ; do
-               run_cmd -a "$(nls 'Bringing up bridge interface %s' "$i")" 
/sbin/ifup $i boot
-       done
-
-       for i in $tunnels; do
-               run_cmd -a "$(nls 'Setting tunnel %s' "$i")" /sbin/tnlup $i boot
-               run_cmd -a "$(nls 'Bringing up tunnel interface %s' "$i")" 
/sbin/ifup tnlcfg-$i boot
-       done
-
-       network_postinit
-
-       touch /var/lock/subsys/network
+       start
        ;;
   stop)
-       if is_yes "$VSERVER"; then
-               rm -f /var/lock/subsys/network
-               exit 0
-       fi
-
-       # If we go to runlevel 0, 1 or 6 then umount all network fs
-       if [ "$RUNLEVEL" = "6" -o "$RUNLEVEL" = "0" -o "$RUNLEVEL" = "1" ]; then
-               if [ -x /etc/rc.d/init.d/netfs -a -f /var/lock/subsys/netfs ];
-               then
-                       /etc/rc.d/init.d/netfs stop
-               else
-                       netmtab=$(awk '{ if ($3 ~ /^(nfs|smbfs|ncpfs|cifs)$/ ) 
print $3}' /proc/mounts)
-                       if (echo "$netmtab" | grep -q nfs); then
-                               run_cmd "Unmounting NFS filesystems" umount 
-fat nfs
-                       fi
-                       if (echo "$netmtab" | grep -q smbfs); then
-                               run_cmd "Unmounting SMB filesystems" umount -at 
smbfs
-                       fi
-                       if (echo "$netmtab" | grep -q ncpfs); then
-                               run_cmd "Unmounting NCP filesystems" umount -at 
ncpfs
-                       fi
-                       if (echo "$netmtab" | grep -q cifs); then
-                               run_cmd "Unmounting CIFS filesystems" umount 
-at cifs
-                       fi
-               fi
-       fi
-
-       for i in $tunnels; do
-               run_cmd -a "$(nls 'Shutting down tunnel interface %s' "$i")" 
/sbin/ifdown tnlcfg-$i boot
-               run_cmd -a "$(nls 'Removing tunnel %s' "$i")" /sbin/tnldown $i 
boot
-       done
-
-       for i in $interfaces_br_boot ; do
-               run_cmd -a "$(nls 'Shutting down bridge interface %s' "$i")" 
/sbin/ifdown $i boot
-       done
-
-       for i in $interfaces_sit_boot $interfaces_vlan_boot $interfaces_boot ; 
do
-               run_cmd -a "$(nls 'Shutting down interface %s' "$i")" 
/sbin/ifdown $i boot
-       done
-
-       network_deinit
-
-       rm -f /var/lock/subsys/network
+       stop
        ;;
   status)
        nls "Configured devices:"
@@ -282,8 +290,8 @@
        /sbin/ip link show | awk -F":" ' (/UP/) { print $2 }' | xargs
        ;;
   restart)
-       $0 stop
-       $0 start
+       stop
+       start
        ;;
   *)
        echo "Usage: $0 {start|stop|restart|status}"

Modified: rc-scripts/trunk/rc.d/init.d/sys-chroots
==============================================================================
--- rc-scripts/trunk/rc.d/init.d/sys-chroots    (original)
+++ rc-scripts/trunk/rc.d/init.d/sys-chroots    Sun Sep 17 18:47:59 2006
@@ -25,11 +25,7 @@
 
 [ -z "$runlevel" -o -z "$previous" -o "$runlevel" = "$previous" ] && exit 0
 
-RETVAL=0
-# See how we were called.
-case "$CMD" in
-  start)
-       # Start daemons.
+start() {
        if [ "$previous" = "N" ]; then
                runlevel=5
                previous=0
@@ -122,8 +118,9 @@
        else
                msg_already_running "System chroots services"
        fi
-       ;;
-  stop)
+}
+
+stop() {
        # Stop daemons.
        if [ "$previous" = "N" ]; then
                runlevel=0
@@ -147,10 +144,20 @@
        else
                msg_not_running "System chroots services"
        fi
+}
+
+RETVAL=0
+# See how we were called.
+case "$CMD" in
+  start)
+       start
+       ;;
+  stop)
+       stop
        ;;
   restart)
-       $0 stop
-       $0 start
+       stop
+       start
        exit $?
        ;;
   status)

Modified: rc-scripts/trunk/rc.d/init.d/timezone
==============================================================================
--- rc-scripts/trunk/rc.d/init.d/timezone       (original)
+++ rc-scripts/trunk/rc.d/init.d/timezone       Sun Sep 17 18:47:59 2006
@@ -27,9 +27,7 @@
 
 [ -L /etc/localtime -a "`resolvesymlink /etc/localtime`" = "$ZONE_FILE" ] && 
exit 0
 
-# See how we were called.
-case "$1" in
-  start)
+start() {
        rm -f /etc/localtime
        if [ -f "$ZONE_FILE" ]; then
                if [ -n "$ZONE_INFO_AREA" ]; then
@@ -40,17 +38,25 @@
                run_cmd "$MESSAGE" cp -af $ZONE_FILE /etc/localtime
                RETVAL=$?
        fi
-       ;;
-  stop)
+}
+
+stop() {
        run_cmd "Unsetting time zone information" rm -f /etc/localtime
        RETVAL=$?
+}
+
+RETVAL=0
+# See how we were called.
+case "$1" in
+  start)
+       start
        ;;
-  restart)
-       $0 stop
-       $0 start
+  stop)
+       stop
        ;;
-  reload)
-       $0 restart
+  restart|reload)
+       stop
+       start
        ;;
   *)
        echo "Usage: $0 {start|stop|restart|reload}"
_______________________________________________
pld-cvs-commit mailing list
[email protected]
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to