Changeset 1253 for trunk/packages


Ignore:
Timestamp:
Oct 25, 2008, 4:54:19 PM (16 years ago)
Author:
price
Message:

shorten sipb-xen-iptables initscript with std-init.sh

Location:
trunk/packages/sipb-xen-iptables/debian
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/packages/sipb-xen-iptables/debian/changelog

    r1055 r1253  
     1sipb-xen-iptables (3) unstable; urgency=low
     2
     3  * shorten initscript with std-init.sh
     4
     5 -- Greg Price <price@mit.edu>  Sat, 25 Oct 2008 15:35:09 -0400
     6
    17sipb-xen-iptables (2) unstable; urgency=low
    28
  • trunk/packages/sipb-xen-iptables/debian/sipb-xen-iptables.init

    r1055 r1253  
    1010### END INIT INFO
    1111
    12 # Author: SIPB Xen Project <sipb-xen@mit.edu>
     12NAME=sipb-xen-iptables
     13DESC="Load the sipb-xen iptables rules"
     14RULES=/usr/share/sipb-xen-iptables/iptables.rules
     15GEN_FILES=$RULES
     16PATH=/sbin:/usr/sbin:/bin:/usr/bin
    1317
    14 # Do NOT "set -e"
     18dpkg -s "$NAME" >/dev/null 2>/dev/null || exit 0
    1519
    16 # PATH should only include /usr/* if it runs after the mountnfs.sh script
    17 PATH=/sbin:/usr/sbin:/bin:/usr/bin
    18 DESC="Load the sipb-xen iptables rules"
    19 NAME=sipb-xen-iptables
    20 RULES=/usr/share/sipb-xen-iptables/iptables.rules
     20. /lib/init/gen-files.sh
     21. /lib/init/std-init.sh
    2122
    22 # Read configuration variable file if it is present
    23 [ -r /etc/default/$NAME ] && . /etc/default/$NAME
    24 
    25 # Load the VERBOSE setting and other rcS variables
    26 . /lib/init/vars.sh
    27 
    28 # Define LSB log_* functions.
    29 # Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
    30 . /lib/lsb/init-functions
    31 
    32 #
    33 # Function that starts the daemon/service
    34 #
    3523do_start()
    3624{
    37         # Return
    38         #   0 if daemon has been started
    39         #   1 if daemon was already running
    40         #   2 if daemon could not be started
    41         for i in /usr/share/sipb-xen-iptables/iptables.rules
    42         do mako-render $i.mako > $i
    43         done
    44        
     25        gen_files
    4526        /sbin/iptables-restore < $RULES
    4627}
    4728
    48 #
    49 # Function that stops the daemon/service
    50 #
    5129do_stop()
    5230{
    53         # Return
    54         #   0 if daemon has been stopped
    55         #   1 if daemon was already stopped
    56         #   2 if daemon could not be stopped
    57         #   other if a failure occurred
    5831        return 0
    5932}
    6033
    61 case "$1" in
    62   start)
    63         [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
    64         do_start
    65         case "$?" in
    66                 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
    67                 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
    68         esac
    69         ;;
    70   stop)
    71         [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
    72         do_stop
    73         case "$?" in
    74                 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
    75                 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
    76         esac
    77         ;;
    78   #reload|force-reload)
    79         #
    80         # If do_reload() is not implemented then leave this commented out
    81         # and leave 'force-reload' as an alias for 'restart'.
    82         #
    83         #log_daemon_msg "Reloading $DESC" "$NAME"
    84         #do_reload
    85         #log_end_msg $?
    86         #;;
    87   restart|force-reload)
    88         #
    89         # If the "reload" option is implemented then remove the
    90         # 'force-reload' alias
    91         #
    92         log_daemon_msg "Restarting $DESC" "$NAME"
    93         do_stop
    94         case "$?" in
    95           0|1)
    96                 do_start
    97                 case "$?" in
    98                         0) log_end_msg 0 ;;
    99                         1) log_end_msg 1 ;; # Old process is still running
    100                         *) log_end_msg 1 ;; # Failed to start
    101                 esac
    102                 ;;
    103           *)
    104                 # Failed to stop
    105                 log_end_msg 1
    106                 ;;
    107         esac
    108         ;;
    109   *)
    110         #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
    111         echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
    112         exit 3
    113         ;;
    114 esac
    115 
    116 :
     34std_init "$1"
Note: See TracChangeset for help on using the changeset viewer.