]>
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 | |
10 | # | |
11 | # Version : 01.00 | |
12 | # | |
13 | # Notes : the variables are passed to the scripts found | |
14 | # in the services directory | |
15 | # | |
16 | ######################################################################## | |
17 | ||
18 | . /etc/sysconfig/rc | |
19 | . ${rc_functions} | |
20 | ||
21 | boot_mesg "Bringing up the $name interface..." | |
22 | boot_mesg_flush | |
23 | ||
24 | ( | |
25 | eval $(/usr/local/bin/readhash /var/ipfire/ethernet/settings) | |
26 | ||
9520a3d0 | 27 | # Check if an interface is there... |
9c16cd92 MT |
28 | if ip link show ${DEVICE} > /dev/null 2>&1; then |
29 | link_status=`ip link show ${DEVICE} 2> /dev/null` | |
30 | if [ -n "${link_status}" ]; then | |
31 | if ! echo "${link_status}" | grep -q UP; then | |
32 | ip link set ${DEVICE} up | |
33 | fi | |
34 | fi | |
35 | ||
36 | else | |
37 | boot_mesg "Interface ${DEVICE} doesn't exist." ${FAILURE} | |
38 | echo_failure | |
39 | exit 1 | |
40 | fi | |
41 | ||
42 | # Passing the variables to the script | |
43 | if [ "$name" == "green" ]; then | |
9520a3d0 | 44 | NAME=${name} ADDRESS=${GREEN_ADDRESS} NETMASK=${GREEN_NETMASK} \ |
9c16cd92 MT |
45 | NETADDRESS=${GREEN_NETADDRESS} BROADCAST=${GREEN_BROADCAST} \ |
46 | /etc/rc.d/init.d/net/common/ipv4-static ${GREEN_DEV} up | |
47 | ||
48 | elif [ "$name" == "blue" ]; then | |
9520a3d0 | 49 | NAME=${name} ADDRESS=${BLUE_ADDRESS} NETMASK=${BLUE_NETMASK} \ |
9c16cd92 MT |
50 | NETADDRESS=${BLUE_NETADDRESS} BROADCAST=${BLUE_BROADCAST} \ |
51 | /etc/rc.d/init.d/net/common/ipv4-static ${BLUE_DEV} up | |
52 | ||
53 | elif [ "$name" == "orange" ]; then | |
9520a3d0 | 54 | NAME=${name} ADDRESS=${ORANGE_ADDRESS} NETMASK=${ORANGE_NETMASK} \ |
9c16cd92 MT |
55 | NETADDRESS=${ORANGE_NETADDRESS} BROADCAST=${ORANGE_BROADCAST} \ |
56 | /etc/rc.d/init.d/net/common/ipv4-static ${ORANGE_DEV} up | |
57 | ||
58 | elif [ "$name" == "red" ]; then | |
59 | if [ "${RED_TYPE}" == "PPPOE" ]; then | |
9520a3d0 | 60 | NAME=${name} /etc/rc.d/init.d/net/red/pppoe ${RED_DEV} up |
9c16cd92 MT |
61 | elif [ "${RED_TYPE}" == "PPTP" ]; then |
62 | echo | |
63 | elif [ "${RED_TYPE}" == "DHCP" ]; then | |
64 | NAME=${name} DHCP_HOSTNAME=${RED_DHCP_HOSTNAME} \ | |
65 | PRINTIP=yes PRINTALL=yes \ | |
9520a3d0 | 66 | /etc/rc.d/init.d/net/common/dhcpcd ${RED_DEV} up |
9c16cd92 | 67 | elif [ "${RED_TYPE}" == "STATIC" ]; then |
9520a3d0 | 68 | NAME=${name} ADDRESS=${RED_ADDRESS} NETMASK=${RED_NETMASK} \ |
9c16cd92 MT |
69 | NETADDRESS=${RED_NETADDRESS} BROADCAST=${RED_BROADCAST} \ |
70 | DNS1=${DNS1} DNS2=${DNS2} GATEWAY=${DEFAULT_GATEWAY} | |
9520a3d0 | 71 | /etc/rc.d/init.d/net/common/ipv4-static ${RED_DEV} up |
9c16cd92 MT |
72 | fi |
73 | fi | |
74 | ) | |
75 | ||
76 | # End $network_devices/ifup |