source: trunk/debian/package/robocfg/debian/robocfg.init @ 289

Last change on this file since 289 was 289, checked in by amain, 8 years ago

Disable robocfg init script - in preparation of controling the network from /etc/network/interfaces

File size: 2.6 KB
Line 
1#! /bin/sh
2### BEGIN INIT INFO
3# Provides:          robocfg
4# Required-Start:    ifupdown-clean
5# Required-Stop:     
6# Default-Start:     S
7# Default-Stop:     
8# Short-Description: Initialize vlan tagging on b44 ethernet switch with robocfg
9# Description:       Initialize vlan tagging on b44 ethernet switch with robocfg
10#                   
11### END INIT INFO
12
13# Author: Amain (DebWRT) <amain@debwrt.net>
14#
15
16# Old file: switch now managed from /etc/network/interfaces
17
18exit 0
19
20PATH=/sbin:/usr/sbin:/bin:/usr/bin
21DESC="vlan tagging on b44 ethernet switch"
22NAME=robocfg
23SCRIPTNAME=/etc/init.d/$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. /etc/default/robocfg
33if [ ! $ENABLED -eq 1 ]; then exit 0; fi
34
35do_start()
36{
37        if ( ls -l /etc/network/interfaces | grep firstboot >/dev/null ); then
38                log_action_end_msg 1
39                echo "FIRSTBOOT - Please configure network in /etc/network first - robocfg did not configure switch"
40                return
41        fi
42
43        # First set iface eth0 up, otherwist robocfg can't find the hardware
44        /sbin/ifconfig eth0 up
45
46        # Configure switch
47        /usr/sbin/robocfg switch disable                2>/dev/null
48        /usr/sbin/robocfg vlans enable reset            2>/dev/null
49        /usr/sbin/robocfg vlan 100 ports "0 5t"         2>/dev/null
50        /usr/sbin/robocfg vlan 101 ports "1 2 3 4 5t"   2>/dev/null
51        /usr/sbin/robocfg port 0 state enabled stp none 2>/dev/null # on some routers it seems that this iface is not up by default
52        /usr/sbin/robocfg switch enable                 2>/dev/null
53
54        # Configure vlans
55        /sbin/vconfig add eth0 100                      1>/dev/null
56        /sbin/vconfig add eth0 101                      1>/dev/null
57
58        # Configure nice names
59        /sbin/ip link set dev eth0.100 name eth0_wan
60        /sbin/ip link set dev eth0.101 name eth0_lan
61
62        log_action_end_msg 0
63}
64
65do_stop()
66{
67        if ( ls -l /etc/network/interfaces | grep firstboot >/dev/null ); then
68                log_action_end_msg 1
69                echo "FIRSTBOOT - Please configure network in /etc/network first - robocfg did not configure switch"
70                return
71        fi
72
73        /sbin/vconfig rem eth0_wan 1>/dev/null
74        /sbin/vconfig rem eth0_lan 1>/dev/null
75        /usr/sbin/robocfg switch disable vlans enable reset vlan 1 ports "0 5u" vlan 0 ports "1 2 3 4 5u" port 0 state enabled stp none switch enable 2>/dev/null
76}
77
78VERBOSE=yes
79case "$1" in
80  start)
81        log_action_begin_msg "Initializing $DESC: $NAME"
82        do_start
83        ;;
84  stop)
85        log_action_begin_msg "Stopping $DESC: $NAME"
86        do_stop
87        ;;
88  *)
89        echo "Usage: $SCRIPTNAME {start}" >&2
90        exit 3
91        ;;
92esac
Note: See TracBrowser for help on using the repository browser.