12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- #!/bin/sh
- ########################################################################
- # Begin /sbin/ifup
- #
- # Description : Interface Up
- #
- # Authors : Nathan Coulson - nathan@linuxfromscratch.org
- # Kevin P. Fleming - kpfleming@linuxfromscratch.org
- # Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
- #
- # Version : LFS 7.0
- #
- # Notes : The IFCONFIG variable is passed to the SERVICE script
- # in the /lib/boot directory, to indicate what file the
- # service should source to get environmental variables.
- #
- ########################################################################
- file=/etc/sysconfig/ifconfig.${1}
- # Skip backup files
- [ "${file}" = "${file%""~""}" ] || exit 0
- . /lib/boot/functions
- boot_mesg "Bringing up the ${1} interface..."
- boot_mesg_flush
- if [ ! -r "${file}" ]; then
- boot_mesg "${file} is missing or cannot be accessed." ${WARNING}
- echo_warning
- exit 1
- fi
- . $file
- if [ "$IFACE" = "" ]; then
- boot_mesg "${file} does not define an interface [IFACE]." ${FAILURE}
- echo_failure
- exit 1
- fi
- # Do not process this service if started by boot, and ONBOOT
- # is not set to yes
- if [ "${IN_BOOT}" = "1" -a "${ONBOOT}" != "yes" ]; then
- echo_skipped
- exit 0
- fi
- if [ -n "${SERVICE}" -a -x "/lib/boot/${SERVICE}" ]; then
- if [ -z "${CHECK_LINK}" -o \
- "${CHECK_LINK}" = "y" -o \
- "${CHECK_LINK}" = "yes" -o \
- "${CHECK_LINK}" = "1" ]; then
- # Bring up the interface
- if ip link show ${IFACE} > /dev/null 2>&1; then
- link_status=`ip link show ${IFACE}`
- if [ -n "${link_status}" ]; then
- if ! echo "${link_status}" | grep -q UP; then
- ip link set ${IFACE} up
- fi
- fi
- else
- boot_mesg "Interface ${IFACE} doesn't exist." ${WARNING}
- echo_warning
- fi
- fi
- IFCONFIG=${file} /lib/boot/${SERVICE} ${IFACE} up
- else
- boot_mesg "Unable to process ${file}. Either" ${FAILURE}
- boot_mesg "the SERVICE variable was not set"
- boot_mesg "or the specified service cannot be executed."
- echo_failure
- exit 1
- fi
- # End /sbin/ifup
|