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