source: lsb-bootscripts/sbin/ifdown@ 63a2c2d

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 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 63a2c2d was 63a2c2d, checked in by DJ Lucas <dj@…>, 13 years ago

Moved BOOK/bootscripts/contrib/lsb-v3 to BOOK/lsb-bootscripts.

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

  • Property mode set to 100644
File size: 2.9 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. /lib/lsb/init-functions
19
20# Collect a list of configuration files for our interface
21if [ -n "${2}" ]; then
22 for file in ${@#$1}; do # All parameters except $1
23 FILES="${FILES} /run/network/ifconfig.${1}/${file}"
24 done
25elif [ -d "/run/network/ifconfig.${1}" ]; then
26 FILES=`echo /run/network/ifconfig.${1}/*`
27else
28 FILES="/run/network/ifconfig.${1}"
29fi
30
31# Reverse the order configuration files are processed in
32for file in ${FILES}; do
33 FILES2="${file} ${FILES2}"
34done
35FILES=${FILES2}
36
37# Process each configuration file
38for file in ${FILES}; do
39 # skip backup files
40 if [ "${file}" != "${file%""~""}" ]; then
41 continue
42 fi
43
44 if [ ! -f "${file}" ]; then
45 message="${file} is not a network configuration file or directory."
46 log_warning_msg
47 fi
48 (
49 if [ ! -d "${file}" ]; then
50 . ${file}
51 fi
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 "/lib/network-services/${SERVICE}" ]; then
67 if ip link show ${1} > /dev/null 2>&1
68 then
69 IFCONFIG=${file} /lib/network-services/${SERVICE} ${1} down &&
70 if [ -f "${file}" ]; then
71 rm ${file}
72 fi
73 else
74 message="Interface ${1} doesn't exist."
75 log_warning_msg
76 fi
77 else
78 echo -e "${FAILURE}Unable to process ${file}. Either"
79 echo -e "${FAILURE}the SERVICE variable was not set,"
80 echo -e "${FAILURE}or the specified service cannot be executed."
81 message=""
82 log_failure_msg
83 fi
84 )
85done
86
87if [ -z "${2}" ]; then
88 link_status=`ip link show $1`
89 if [ -n "${link_status}" ]; then
90 if echo "${link_status}" | grep -q UP; then
91 message="Bringing down the ${1} interface..."
92 ip link set ${1} down
93 evaluate_retval standard
94 fi
95 fi
96fi
97
98# End $NETWORK_DEVICES/ifdown
Note: See TracBrowser for help on using the repository browser.