Author: glen                         Date: Wed May 13 13:43:53 2009 GMT
Module: packages                      Tag: HEAD
---- Log message:
- add try-restart
- use nice progname
- pass $PROGRAM_ARGS to program not msg_ function

---- Files affected:
packages/acpid:
   acpid.init (1.23 -> 1.24) 

---- Diffs:

================================================================
Index: packages/acpid/acpid.init
diff -u packages/acpid/acpid.init:1.23 packages/acpid/acpid.init:1.24
--- packages/acpid/acpid.init:1.23      Fri May  1 01:24:41 2009
+++ packages/acpid/acpid.init   Wed May 13 15:43:47 2009
@@ -23,51 +23,65 @@
 # Start daemons.
 start() {
        if [ ! -f /var/lock/subsys/acpid ]; then
-               if [ ! -d /proc/acpi/button ]; then
-                       modprobe -s ospm_button
-                       modprobe -s button
-               fi
-               if [ "$(kernelverser)" -lt "002006" ] && is_yes 
"$MODPROBE_OSPM_SYSTEM"; then
-                       modprobe -s ospm_system
-               fi
-               # Load additional modules:
-               if [ -n "$LAPTOP_MODULES" ]; then
-                       for i in $LAPTOP_MODULES; do
-                               modprobe -s $i
-                       done
-               fi
-               if [ -n "$VARIOUS_MODULES" ]; then
-                       for i in $VARIOUS_MODULES; do
-                               modprobe -s $i
-                       done
-               fi
-               # Determine if it's ASUS or TOSHIBA laptop
-               if is_yes "$ASUS_LAPTOP"; then
-                       modprobe -s asus_acpi
-               elif is_yes "$TOSHIBA_LAPTOP"; then
-                       modprobe -s toshiba_acpi
-               elif is_yes "$IBM_LAPTOP"; then
-                       modprobe -s ibm_acpi
-               fi
-               # starting:
-               msg_starting acpid $PROGRAM_ARGS
-               daemon /usr/sbin/acpid
-               RETVAL=$?
-               [ $RETVAL -eq 0 ] && touch /var/lock/subsys/acpid
-       else
-               msg_already_running acpid
+               msg_already_running "ACPI Event Daemon"
+               return
+       fi
+       
+       if [ ! -d /proc/acpi/button ]; then
+               modprobe -s ospm_button
+               modprobe -s button
+       fi
+       if [ "$(kernelverser)" -lt "002006" ] && is_yes 
"$MODPROBE_OSPM_SYSTEM"; then
+               modprobe -s ospm_system
+       fi
+       # Load additional modules:
+       if [ -n "$LAPTOP_MODULES" ]; then
+               for i in $LAPTOP_MODULES; do
+                       modprobe -s $i
+               done
        fi
+       if [ -n "$VARIOUS_MODULES" ]; then
+               for i in $VARIOUS_MODULES; do
+                       modprobe -s $i
+               done
+       fi
+       # Determine if it's ASUS or TOSHIBA laptop
+       if is_yes "$ASUS_LAPTOP"; then
+               modprobe -s asus_acpi
+       elif is_yes "$TOSHIBA_LAPTOP"; then
+               modprobe -s toshiba_acpi
+       elif is_yes "$IBM_LAPTOP"; then
+               modprobe -s ibm_acpi
+       fi
+
+       # starting:
+       msg_starting "ACPI Event Daemon"
+       daemon /usr/sbin/acpid $PROGRAM_ARGS
+       RETVAL=$?
+       [ $RETVAL -eq 0 ] && touch /var/lock/subsys/acpid
 }
 
 # Stop daemons.
 stop() {
-       if [ -f /var/lock/subsys/acpid ]; then
-               msg_stopping acpid
-               killproc acpid
-               rm -f /var/lock/subsys/acpid >/dev/null 2>&1
-       else
-               msg_not_running acpid
+       if [ ! -f /var/lock/subsys/acpid ]; then
+               msg_not_running "ACPI Event Daemon"
+               return
        fi
+
+       msg_stopping "ACPI Event Daemon"
+       killproc acpid
+       rm -f /var/lock/subsys/acpid >/dev/null 2>&1
+}
+
+condrestart() {
+       if [ ! -f /var/lock/subsys/acpid ]; then
+               msg_not_running "ACPI Event Daemon"
+               RETVAL=$1
+               return
+       fi
+
+       stop
+       start
 }
 
 RETVAL=0
@@ -83,13 +97,16 @@
        stop
        start
        ;;
+  try-restart)
+       condrestart 0
+       ;;
   reload|force-reload)
        if [ -f /var/lock/subsys/acpid ]; then
-               msg_reloading acpid
+               msg_reloading "ACPI Event Daemon"
                killproc acpid -HUP
                RETVAL=$?
        else
-               msg_not_running acpid
+               msg_not_running "ACPI Event Daemon"
                exit 7
        fi
        ;;
@@ -97,7 +114,7 @@
        status acpid
        ;;
   *)
-       msg_usage "$0 {start|stop|restart|reload|force-reload|status}"
+       msg_usage "$0 
{start|stop|restart|try-restart|reload|force-reload|status}"
        exit 3
 esac
 
================================================================

---- CVS-web:
    
http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/acpid/acpid.init?r1=1.23&r2=1.24&f=u

_______________________________________________
pld-cvs-commit mailing list
[email protected]
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to