]>
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 | ( | |
bf7c473f MT |
25 | eval $(/usr/local/bin/readhash /var/ipfire/vpn/settings) |
26 | eval $(/usr/local/bin/readhash /var/ipfire/dhcp/settings) | |
9c16cd92 | 27 | eval $(/usr/local/bin/readhash /var/ipfire/ethernet/settings) |
bf7c473f MT |
28 | eval $(/usr/local/bin/readhash /var/ipfire/ppp/settings) |
29 | ||
30 | if [ "$name" == "green" ]; then | |
31 | DEVICE="${GREEN_DEV}" | |
32 | elif [ "$name" == "blue" ]; then | |
33 | DEVICE="${BLUE_DEV}" | |
34 | elif [ "$name" == "orange" ]; then | |
35 | DEVICE="${ORANGE_DEV}" | |
36 | elif [ "$name" == "red" ]; then | |
37 | DEVICE="${RED_DEV}" | |
38 | fi | |
9c16cd92 | 39 | |
9520a3d0 | 40 | # Check if an interface is there... |
9c16cd92 MT |
41 | if ip link show ${DEVICE} > /dev/null 2>&1; then |
42 | link_status=`ip link show ${DEVICE} 2> /dev/null` | |
43 | if [ -n "${link_status}" ]; then | |
44 | if ! echo "${link_status}" | grep -q UP; then | |
45 | ip link set ${DEVICE} up | |
46 | fi | |
47 | fi | |
48 | ||
49 | else | |
50 | boot_mesg "Interface ${DEVICE} doesn't exist." ${FAILURE} | |
51 | echo_failure | |
52 | exit 1 | |
53 | fi | |
54 | ||
55 | # Passing the variables to the script | |
56 | if [ "$name" == "green" ]; then | |
9520a3d0 | 57 | NAME=${name} ADDRESS=${GREEN_ADDRESS} NETMASK=${GREEN_NETMASK} \ |
9c16cd92 MT |
58 | NETADDRESS=${GREEN_NETADDRESS} BROADCAST=${GREEN_BROADCAST} \ |
59 | /etc/rc.d/init.d/net/common/ipv4-static ${GREEN_DEV} up | |
60 | ||
61 | elif [ "$name" == "blue" ]; then | |
9520a3d0 | 62 | NAME=${name} ADDRESS=${BLUE_ADDRESS} NETMASK=${BLUE_NETMASK} \ |
9c16cd92 MT |
63 | NETADDRESS=${BLUE_NETADDRESS} BROADCAST=${BLUE_BROADCAST} \ |
64 | /etc/rc.d/init.d/net/common/ipv4-static ${BLUE_DEV} up | |
65 | ||
66 | elif [ "$name" == "orange" ]; then | |
9520a3d0 | 67 | NAME=${name} ADDRESS=${ORANGE_ADDRESS} NETMASK=${ORANGE_NETMASK} \ |
9c16cd92 MT |
68 | NETADDRESS=${ORANGE_NETADDRESS} BROADCAST=${ORANGE_BROADCAST} \ |
69 | /etc/rc.d/init.d/net/common/ipv4-static ${ORANGE_DEV} up | |
70 | ||
71 | elif [ "$name" == "red" ]; then | |
72 | if [ "${RED_TYPE}" == "PPPOE" ]; then | |
9520a3d0 | 73 | NAME=${name} /etc/rc.d/init.d/net/red/pppoe ${RED_DEV} up |
9c16cd92 MT |
74 | elif [ "${RED_TYPE}" == "PPTP" ]; then |
75 | echo | |
76 | elif [ "${RED_TYPE}" == "DHCP" ]; then | |
77 | NAME=${name} DHCP_HOSTNAME=${RED_DHCP_HOSTNAME} \ | |
bf7c473f | 78 | DNS1=${DNS1} DNS2=${DNS2} \ |
9c16cd92 | 79 | PRINTIP=yes PRINTALL=yes \ |
9520a3d0 | 80 | /etc/rc.d/init.d/net/common/dhcpcd ${RED_DEV} up |
9c16cd92 | 81 | elif [ "${RED_TYPE}" == "STATIC" ]; then |
9520a3d0 | 82 | NAME=${name} ADDRESS=${RED_ADDRESS} NETMASK=${RED_NETMASK} \ |
9c16cd92 MT |
83 | NETADDRESS=${RED_NETADDRESS} BROADCAST=${RED_BROADCAST} \ |
84 | DNS1=${DNS1} DNS2=${DNS2} GATEWAY=${DEFAULT_GATEWAY} | |
9520a3d0 | 85 | /etc/rc.d/init.d/net/common/ipv4-static ${RED_DEV} up |
9c16cd92 | 86 | fi |
bf7c473f MT |
87 | |
88 | /etc/rc.d/init.d/net/red/update | |
89 | fi | |
90 | ||
9c16cd92 MT |
91 | ) |
92 | ||
93 | # End $network_devices/ifup |