source: bootscripts/clfs/sysconfig/network-devices/ifup@ 0928ac4

clfs-1.2 clfs-2.1 clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since 0928ac4 was d66bf46, checked in by Jim Gifford <clfs@…>, 18 years ago

Update bootscripts to follow our standards

  • Property mode set to 100644
File size: 2.8 KB
Line 
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
22if [ -n "${2}" ]; then
23 for file in ${@#$1} # All parameters except $1
24 do
25 FILES="${FILES} ${network_devices}/ifconfig.${1}/${file}"
26 done
27elif [ -d "${network_devices}/ifconfig.${1}" ]; then
28 FILES=`echo ${network_devices}/ifconfig.${1}/*`
29else
30 FILES="${network_devices}/ifconfig.${1}"
31fi
32
33boot_mesg "Bringing up the ${1} interface..."
34boot_mesg_flush
35
36# Process each configruation file
37for 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 TEST="`ip addr show ${1} | grep inet | cut -f1 -d'/' | cut -f2 -d't' | cut -f2 -d' '`"
66 if [ "$TEST" != "" ]; then
67 boot_mesg "Interface ${1} already configured with IP ${TEST}." ${WARNING}
68 echo_warning
69 continue
70 else
71 if ip link show ${1} > /dev/null 2>&1; then
72 link_status=`ip link show ${1} 2> /dev/null | grep ${1}`
73 if [ -n "${link_status}" ]; then
74 if ! echo "${link_status}" | grep -q UP; then
75 ip link set ${1} up
76 fi
77 fi
78 else
79 boot_mesg "Interface ${1} doesn't exist." ${WARNING}
80 echo_warning
81 continue
82 fi
83 fi
84 fi
85 IFCONFIG=${file} ${network_devices}/services/${SERVICE} ${1} up
86 else
87 boot_mesg "Unable to process ${file}. Either" ${FAILURE}
88 boot_mesg " the SERVICE variable was not set,"
89 boot_mesg " or the specified service cannot be executed."
90 echo_failure
91 continue
92 fi
93 )
94done
95
96# End $network_devices/ifup
Note: See TracBrowser for help on using the repository browser.