]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/blob - src/initscripts/init.d/net/ifup
OpenSwan-Build-Fix.
[people/teissler/ipfire-2.x.git] / src / initscripts / init.d / net / ifup
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 # Maniacikarus - Maniacikarus@ipfire.org
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)
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
37
38 # Check if an interface is there...
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
55 if [ "${CONFIG_TYPE}" == "0" ] || [ "${CONFIG_TYPE}" == "" ]; then
56 NAME=${name} ADDRESS=${GREEN_ADDRESS} NETMASK=${GREEN_NETMASK} \
57 NETADDRESS=${GREEN_NETADDRESS} BROADCAST=${GREEN_BROADCAST} \
58 DNS1=${DNS1} DNS2=${DNS2} GATEWAY=${DEFAULT_GATEWAY} \
59 /etc/rc.d/init.d/net/common/ipv4-static ${GREEN_DEV} up
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
65
66 elif [ "$name" == "blue" ]; then
67 NAME=${name} ADDRESS=${BLUE_ADDRESS} NETMASK=${BLUE_NETMASK} \
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
72 NAME=${name} ADDRESS=${ORANGE_ADDRESS} NETMASK=${ORANGE_NETMASK} \
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
78 NAME=${name} /etc/rc.d/init.d/net/red/pppoe ${RED_DEV} up
79 elif [ "${RED_TYPE}" == "PPTP" ]; then
80 echo
81 elif [ "${RED_TYPE}" == "DHCP" ]; then
82 NAME=${name} DHCP_HOSTNAME=${RED_DHCP_HOSTNAME} \
83 DNS1=${DNS1} DNS2=${DNS2} \
84 PRINTIP=yes PRINTALL=yes \
85 /etc/rc.d/init.d/net/common/dhcpcd ${RED_DEV} up
86 elif [ "${RED_TYPE}" == "STATIC" ]; then
87 NAME=${name} ADDRESS=${RED_ADDRESS} NETMASK=${RED_NETMASK} \
88 NETADDRESS=${RED_NETADDRESS} BROADCAST=${RED_BROADCAST} \
89 DNS1=${DNS1} DNS2=${DNS2} GATEWAY=${DEFAULT_GATEWAY} \
90 /etc/rc.d/init.d/net/common/ipv4-static ${RED_DEV} up
91 touch /var/ipfire/red/active
92 fi
93
94 /usr/local/bin/dialctrl.pl up
95 /etc/rc.d/init.d/net/red/update
96 fi
97
98 )
99
100 # End $network_devices/ifup