source: trunk/packages/invirt-iptables/debian/invirt-iptables.init @ 2911

Last change on this file since 2911 was 2905, checked in by gdb, 15 years ago

Make sed not hang when there are no firewall files

  • Property svn:executable set to *
File size: 821 bytes
RevLine 
[2861]1#! /bin/sh
2### BEGIN INIT INFO
3# Provides:          invirt-iptables
4# Required-Start:    $local_fs $remote_fs
5# Required-Stop:     $local_fs $remote_fs
6# Default-Start:     2 3 4 5
7# Default-Stop:      0 1 6
8# Short-Description: Invirt iptables rules
9# Description:       
10### END INIT INFO
11
12NAME=invirt-iptables
13DESC="Invirt iptables rules"
[2862]14RULES=/etc/invirt-iptables/rules.d
[2861]15PATH=/sbin:/usr/sbin:/bin:/usr/bin
16
17dpkg -s "$NAME" >/dev/null 2>/dev/null || exit 0
18
19. /lib/init/std-init.sh
20
21do_start()
22{
23        echo 1 > /proc/sys/net/ipv4/ip_forward
24
[2905]25        list=$(run-parts --list "$RULES")
26
27        if [ ! -z "$list" ]; then
28            for table in $(sed -ne 's/^*//p' $list); do
29                iptables -t "$table" -F
30            done
31            cat $list | iptables-restore -n
32        fi
[2861]33}
34
35do_reload()
36{
37        do_start
38}
39
40do_stop()
41{
42        return 0
43}
44
45std_init "$1"
Note: See TracBrowser for help on using the repository browser.