source: bootscripts/contrib/lsb-v3/sysconfig/network-devices/ifdown@ 281b7d9

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.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 281b7d9 was 1c48007, checked in by Bruce Dubbs <bdubbs@…>, 16 years ago

Moved bootscripts and udev-config to BOOK
Updated Makefile to automatically generate bootscript and udev-config tarballs
Updated licesnse to be the same as BLFS

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

  • Property mode set to 100644
File size: 2.8 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} ${NETWORK_DEVICES}/ifconfig.${1}/${file}"
24 done
25elif [ -d "${NETWORK_DEVICES}/ifconfig.${1}" ]; then
26 FILES=`echo ${NETWORK_DEVICES}/ifconfig.${1}/*`
27else
28 FILES="${NETWORK_DEVICES}/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 . ${file}
50
51 # Will not process this service if started by boot, and ONBOOT
52 # is not set to yes
53 if [ "${IN_BOOT}" = "1" -a "${ONBOOT}" != "yes" ]; then
54 continue
55 fi
56
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" ]; then
60 continue
61 fi
62
63 # This will run the service script, if SERVICE is set
64 if [ -n "${SERVICE}" -a -x "${NETWORK_DEVICES}/services/${SERVICE}" ]; then
65 if ip link show ${1} > /dev/null 2>&1
66 then
67 IFCONFIG=${file} ${NETWORK_DEVICES}/services/${SERVICE} ${1} down
68 else
69 message="Interface ${1} doesn't exist."
70 log_warning_msg
71 fi
72 else
73 echo -e "${FAILURE}Unable to process ${file}. Either"
74 echo -e "${FAILURE}the SERVICE variable was not set,"
75 echo -e "${FAILURE}or the specified service cannot be executed."
76 message=""
77 log_failure_msg
78 fi
79 )
80done
81
82if [ -z "${2}" ]; then
83 link_status=`ip link show $1`
84 if [ -n "${link_status}" ]; then
85 if echo "${link_status}" | grep -q UP; then
86 message="Bringing down the ${1} interface..."
87 ip link set ${1} down
88 evaluate_retval standard
89 fi
90 fi
91fi
92
93# End $NETWORK_DEVICES/ifdown
Note: See TracBrowser for help on using the repository browser.