]>
Commit | Line | Data |
---|---|---|
9c16cd92 MT |
1 | #!/bin/sh |
2 | ######################################################################## | |
3 | # Begin $network_devices/ifup | |
4 | # | |
5 | # Description : Interface Up | |
6 | # | |
7 | # Authors : Nathan Coulson - nathan@linuxfromscratch.org | |
8 | # Kevin P. Fleming - kpfleming@linuxfromscratch.org | |
9 | # Michael Tremer - mitch@ipfire.org | |
58b1108f | 10 | # Maniacikarus - Maniacikarus@ipfire.org |
9c16cd92 MT |
11 | # |
12 | # Version : 01.00 | |
13 | # | |
14 | # Notes : the variables are passed to the scripts found | |
15 | # in the services directory | |
16 | # | |
17 | ######################################################################## | |
18 | ||
19 | . /etc/sysconfig/rc | |
20 | . ${rc_functions} | |
21 | ||
22 | boot_mesg "Bringing up the $name interface..." | |
23 | boot_mesg_flush | |
24 | ||
25 | ( | |
26 | eval $(/usr/local/bin/readhash /var/ipfire/ethernet/settings) | |
bf7c473f MT |
27 | |
28 | if [ "$name" == "green" ]; then | |
29 | DEVICE="${GREEN_DEV}" | |
30 | elif [ "$name" == "blue" ]; then | |
31 | DEVICE="${BLUE_DEV}" | |
32 | elif [ "$name" == "orange" ]; then | |
33 | DEVICE="${ORANGE_DEV}" | |
34 | elif [ "$name" == "red" ]; then | |
35 | DEVICE="${RED_DEV}" | |
36 | fi | |
9c16cd92 | 37 | |
9520a3d0 | 38 | # Check if an interface is there... |
9c16cd92 MT |
39 | if ip link show ${DEVICE} > /dev/null 2>&1; then |
40 | link_status=`ip link show ${DEVICE} 2> /dev/null` | |
41 | if [ -n "${link_status}" ]; then | |
42 | if ! echo "${link_status}" | grep -q UP; then | |
43 | ip link set ${DEVICE} up | |
44 | fi | |
45 | fi | |
46 | ||
47 | else | |
48 | boot_mesg "Interface ${DEVICE} doesn't exist." ${FAILURE} | |
49 | echo_failure | |
50 | exit 1 | |
51 | fi | |
52 | ||
53 | # Passing the variables to the script | |
54 | if [ "$name" == "green" ]; then | |
58b1108f CS |
55 | if [ "${CONFIG_TYPE}" == "0" ] || [ "${CONFIG_TYPE}" == "" ]; then |
56 | NAME=${name} ADDRESS=${GREEN_ADDRESS} NETMASK=${GREEN_NETMASK} \ | |
9c16cd92 | 57 | NETADDRESS=${GREEN_NETADDRESS} BROADCAST=${GREEN_BROADCAST} \ |
58b1108f | 58 | DNS1=${DNS1} DNS2=${DNS2} GATEWAY=${DEFAULT_GATEWAY} \ |
9c16cd92 | 59 | /etc/rc.d/init.d/net/common/ipv4-static ${GREEN_DEV} up |
58b1108f CS |
60 | else |
61 | NAME=${name} ADDRESS=${GREEN_ADDRESS} NETMASK=${GREEN_NETMASK} \ | |
62 | NETADDRESS=${GREEN_NETADDRESS} BROADCAST=${GREEN_BROADCAST} \ | |
63 | /etc/rc.d/init.d/net/common/ipv4-static ${GREEN_DEV} up | |
64 | fi | |
621b327e | 65 | |
9c16cd92 | 66 | elif [ "$name" == "blue" ]; then |
9520a3d0 | 67 | NAME=${name} ADDRESS=${BLUE_ADDRESS} NETMASK=${BLUE_NETMASK} \ |
9c16cd92 MT |
68 | NETADDRESS=${BLUE_NETADDRESS} BROADCAST=${BLUE_BROADCAST} \ |
69 | /etc/rc.d/init.d/net/common/ipv4-static ${BLUE_DEV} up | |
70 | ||
71 | elif [ "$name" == "orange" ]; then | |
9520a3d0 | 72 | NAME=${name} ADDRESS=${ORANGE_ADDRESS} NETMASK=${ORANGE_NETMASK} \ |
9c16cd92 MT |
73 | NETADDRESS=${ORANGE_NETADDRESS} BROADCAST=${ORANGE_BROADCAST} \ |
74 | /etc/rc.d/init.d/net/common/ipv4-static ${ORANGE_DEV} up | |
75 | ||
76 | elif [ "$name" == "red" ]; then | |
77 | if [ "${RED_TYPE}" == "PPPOE" ]; then | |
9520a3d0 | 78 | NAME=${name} /etc/rc.d/init.d/net/red/pppoe ${RED_DEV} up |
9c16cd92 MT |
79 | elif [ "${RED_TYPE}" == "PPTP" ]; then |
80 | echo | |
81 | elif [ "${RED_TYPE}" == "DHCP" ]; then | |
82 | NAME=${name} DHCP_HOSTNAME=${RED_DHCP_HOSTNAME} \ | |
bf7c473f | 83 | DNS1=${DNS1} DNS2=${DNS2} \ |
9c16cd92 | 84 | PRINTIP=yes PRINTALL=yes \ |
9520a3d0 | 85 | /etc/rc.d/init.d/net/common/dhcpcd ${RED_DEV} up |
9c16cd92 | 86 | elif [ "${RED_TYPE}" == "STATIC" ]; then |
9520a3d0 | 87 | NAME=${name} ADDRESS=${RED_ADDRESS} NETMASK=${RED_NETMASK} \ |
9c16cd92 | 88 | NETADDRESS=${RED_NETADDRESS} BROADCAST=${RED_BROADCAST} \ |
64a42535 | 89 | DNS1=${DNS1} DNS2=${DNS2} GATEWAY=${DEFAULT_GATEWAY} \ |
9520a3d0 | 90 | /etc/rc.d/init.d/net/common/ipv4-static ${RED_DEV} up |
97aa4ba2 | 91 | touch /var/ipfire/red/active |
9c16cd92 | 92 | fi |
bf7c473f | 93 | |
77d211a7 | 94 | /usr/local/bin/dialctrl.pl up |
bf7c473f MT |
95 | /etc/rc.d/init.d/net/red/update |
96 | fi | |
97 | ||
9c16cd92 MT |
98 | ) |
99 | ||
100 | # End $network_devices/ifup |