source: bootscripts/lfs/sysconfig/network-devices/ifup@ 2aa9e74

clfs-1.2 clfs-2.1 clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since 2aa9e74 was 163a6701, checked in by Jim Gifford <clfs@…>, 19 years ago

r720@server (orig r718): jim | 2005-11-18 08:06:26 -0800
Added bootscripts to cross-lfs svn

  • Property mode set to 100644
File size: 2.5 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 if ip link show ${1} > /dev/null 2>&1; then
66 link_status=`ip link show ${1} 2> /dev/null`
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 )
87done
88
89# End $network_devices/ifup
Note: See TracBrowser for help on using the repository browser.