source: bootscripts/lfs/sysconfig/network-devices/ifdown@ a21a3c7

10.0 10.0-rc1 10.1 10.1-rc1 11.0 11.0-rc1 11.0-rc2 11.0-rc3 11.1 11.1-rc1 11.2 11.2-rc1 11.3 11.3-rc1 12.0 12.0-rc1 12.1 12.1-rc1 6.5 6.6 6.7 6.8 7.0 7.1 7.2 7.3 7.4 7.5 7.5-systemd 7.6 7.6-systemd 7.7 7.7-systemd 7.8 7.8-systemd 7.9 7.9-systemd 8.0 8.1 8.2 8.3 8.4 9.0 9.1 arm bdubbs/gcc13 ml-11.0 multilib renodr/libudev-from-systemd s6-init trunk xry111/arm64 xry111/arm64-12.0 xry111/clfs-ng xry111/lfs-next xry111/loongarch xry111/loongarch-12.0 xry111/loongarch-12.1 xry111/mips64el xry111/pip3 xry111/rust-wip-20221008 xry111/update-glibc
Last change on this file since a21a3c7 was a21a3c7, checked in by Bruce Dubbs <bdubbs@…>, 15 years ago

Ignore error in ifdown script when determining status

git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@8887 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689

  • Property mode set to 100644
File size: 2.5 KB
Line 
1#!/bin/sh
2########################################################################
3# Begin $network_devices/ifdown
4#
5# Description : Interface Down
6#
7# Authors : Nathan Coulson - nathan@linuxfromscratch.org
8# Kevin P. Fleming - kpfleming@linuxfromscratch.org
9#
10# Version : 00.01
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}; do # All parameters except $1
24 FILES="${FILES} ${network_devices}/ifconfig.${1}/${file}"
25 done
26elif [ -d "${network_devices}/ifconfig.${1}" ]; then
27 FILES=`echo ${network_devices}/ifconfig.${1}/*`
28else
29 FILES="${network_devices}/ifconfig.${1}"
30fi
31
32# Reverse the order configuration files are processed in
33for file in ${FILES}; do
34 FILES2="${file} ${FILES2}"
35done
36FILES=${FILES2}
37
38# Process each configuration file
39for file in ${FILES}; do
40 # skip backup files
41 if [ "${file}" != "${file%""~""}" ]; then
42 continue
43 fi
44
45 if [ ! -f "${file}" ]; then
46 boot_mesg "${file} is not a network configuration file or directory." ${WARNING}
47 echo_warning
48 continue
49 fi
50 (
51 . ${file}
52
53 # Will not process this service if started by boot, and ONBOOT
54 # is not set to yes
55 if [ "${IN_BOOT}" = "1" -a "${ONBOOT}" != "yes" ]; then
56 continue
57 fi
58
59 # Will not process this service if started by hotplug, and
60 # ONHOTPLUG is not set to yes
61 if [ "${IN_HOTPLUG}" = "1" -a "${ONHOTPLUG}" != "yes" ]; then
62 continue
63 fi
64
65 # This will run the service script, if SERVICE is set
66 if [ -n "${SERVICE}" -a -x "${network_devices}/services/${SERVICE}" ]; then
67 if ip link show ${1} > /dev/null 2>&1
68 then
69 IFCONFIG=${file} ${network_devices}/services/${SERVICE} ${1} down
70 else
71 boot_mesg "Interface ${1} doesn't exist." ${WARNING}
72 echo_warning
73 fi
74 else
75 boot_mesg -n "Unable to process ${file}. Either" ${FAILURE}
76 boot_mesg -n " the SERVICE variable was not set,"
77 boot_mesg " or the specified service cannot be executed."
78 echo_failure
79 continue
80 fi
81 )
82done
83
84if [ -z "${2}" ]; then
85 link_status=`ip link show $1 2>/dev/null`
86 if [ -n "${link_status}" ]; then
87 if echo "${link_status}" | grep -q UP; then
88 boot_mesg "Bringing down the ${1} interface..."
89 ip link set ${1} down
90 evaluate_retval
91 fi
92 fi
93fi
94
95# End $network_devices/ifdown
Note: See TracBrowser for help on using the repository browser.