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 | #
|
---|
10 | # Version : 00.00
|
---|
11 | #
|
---|
12 | # Notes : the IFCONFIG variable is passed to the scripts found
|
---|
13 | # in the services directory, to indicate what file the
|
---|
14 | # service should source to get environmental variables.
|
---|
15 | #
|
---|
16 | ########################################################################
|
---|
17 |
|
---|
18 | . /etc/sysconfig/rc
|
---|
19 | . ${rc_functions}
|
---|
20 |
|
---|
21 | # Collect a list of configuration files for our interface
|
---|
22 | if [ -n "${2}" ]; then
|
---|
23 | for file in ${@#$1} # All parameters except $1
|
---|
24 | do
|
---|
25 | FILES="${FILES} ${network_devices}/ifconfig.${1}/${file}"
|
---|
26 | done
|
---|
27 | elif [ -d "${network_devices}/ifconfig.${1}" ]; then
|
---|
28 | FILES=`echo ${network_devices}/ifconfig.${1}/*`
|
---|
29 | else
|
---|
30 | FILES="${network_devices}/ifconfig.${1}"
|
---|
31 | fi
|
---|
32 |
|
---|
33 | boot_mesg "Bringing up the ${1} interface..."
|
---|
34 | boot_mesg_flush
|
---|
35 |
|
---|
36 | # Process each configruation file
|
---|
37 | for file in ${FILES}; do
|
---|
38 | # skip backup files
|
---|
39 | if [ "${file}" != "${file%""~""}" ]; then
|
---|
40 | continue
|
---|
41 | fi
|
---|
42 |
|
---|
43 | if [ ! -f "${file}" ]; then
|
---|
44 | boot_mesg "${file} is not a network configuration file or directory." ${WARNING}
|
---|
45 | echo_warning
|
---|
46 | continue
|
---|
47 | fi
|
---|
48 |
|
---|
49 | (
|
---|
50 | . ${file}
|
---|
51 |
|
---|
52 | # Will not process this service if started by boot, and ONBOOT
|
---|
53 | # is not set to yes
|
---|
54 | if [ "${IN_BOOT}" = "1" -a "${ONBOOT}" != "yes" ]; then
|
---|
55 | continue
|
---|
56 | fi
|
---|
57 | # Will not process this service if started by hotplug, and
|
---|
58 | # ONHOTPLUG is not set to yes
|
---|
59 | if [ "${IN_HOTPLUG}" = "1" -a "${ONHOTPLUG}" != "yes" -a "${HOSTNAME}" != "(none)" ]; then
|
---|
60 | continue
|
---|
61 | fi
|
---|
62 |
|
---|
63 | if [ -n "${SERVICE}" -a -x "${network_devices}/services/${SERVICE}" ]; then
|
---|
64 | if [ -z "${CHECK_LINK}" -o "${CHECK_LINK}" = "y" -o "${CHECK_LINK}" = "yes" -o "${CHECK_LINK}" = "1" ]; then
|
---|
65 | if ip link show ${1} > /dev/null 2>&1; then
|
---|
66 | link_status=`ip link show ${1} 2> /dev/null | grep ${1}`
|
---|
67 | if [ -n "${link_status}" ]; then
|
---|
68 | if ! echo "${link_status}" | grep -q UP; then
|
---|
69 | ip link set ${1} up
|
---|
70 | fi
|
---|
71 | fi
|
---|
72 | else
|
---|
73 | boot_mesg "Interface ${1} doesn't exist." ${WARNING}
|
---|
74 | echo_warning
|
---|
75 | continue
|
---|
76 | fi
|
---|
77 | fi
|
---|
78 | IFCONFIG=${file} ${network_devices}/services/${SERVICE} ${1} up
|
---|
79 | else
|
---|
80 | boot_mesg "Unable to process ${file}. Either" ${FAILURE}
|
---|
81 | boot_mesg " the SERVICE variable was not set,"
|
---|
82 | boot_mesg " or the specified service cannot be executed."
|
---|
83 | echo_failure
|
---|
84 | continue
|
---|
85 | fi
|
---|
86 | )
|
---|
87 | done
|
---|
88 |
|
---|
89 | # End $network_devices/ifup
|
---|