Ignore:
Timestamp:
Oct 31, 2006, 9:38:50 PM (17 years ago)
Author:
Jim Gifford <clfs@…>
Branches:
clfs-1.2, clfs-2.1, clfs-3.0.0-systemd, clfs-3.0.0-sysvinit, master, systemd, sysvinit
Children:
728f219
Parents:
0928ac4
Message:

Added the ability to have network subinterfaces

File:
1 edited

Legend:

Unmodified
Added
Removed
  • bootscripts/clfs/sysconfig/network-devices/ifdown

    r0928ac4 refc99f2  
    6262                        continue
    6363                fi
    64        
     64               
     65                # This will allow us to assign subinterfaces to our primary
     66                if [ "${INTERFACE}" != "" ]; then
     67                        NET_IF=${INTERFACE}
     68                else
     69                        NET_IF=${1}
     70                fi
     71
    6572                # This will run the service script, if SERVICE is set
    66                 if [ -n "${SERVICE}" -a -x "${network_devices}/services/${SERVICE}" ]; then
    67                         TEST="`ip addr show ${1} | grep inet | cut -f1 -d'/' | cut -f2 -d't' | cut -f2 -d' '`"
    68                         if [ -z "$TEST" ]; then
    69                                 boot_mesg "Interface ${1} already disabled." ${WARNING}
    70                                 echo_warning
     73                if [ "${INTERFACE}" = "" ]; then
     74                        if [ -n "${SERVICE}" -a -x "${network_devices}/services/${SERVICE}" ]; then
     75                                TEST="`ip addr show ${NET_IF} | grep inet | grep ${NET_IF} | cut -f1 -d'/' | cut -f2 -d't' | cut -f2 -d' '`"
     76                                if [ -z "$TEST" ]; then
     77                                        boot_mesg "Interface ${NET_IF} already disabled." ${WARNING}
     78                                        echo_warning
     79                                        continue
     80                                else
     81                                        if ip link show ${NET_IF} > /dev/null 2>&1; then
     82                                                IFCONFIG=${file} ${network_devices}/services/${SERVICE} ${NET_IF} down
     83                                        else
     84                                                boot_mesg "Interface ${NET_IF} doesn't exist." ${WARNING}
     85                                                echo_warning
     86                                        fi
     87                                fi
     88                        else
     89                                boot_mesg -n "Unable to process ${file}.  Either" ${FAILURE}
     90                                boot_mesg -n " the SERVICE variable was not set,"
     91                                boot_mesg " or the specified service cannot be executed."
     92                                echo_failure
    7193                                continue
    72                         else
    73                                 if ip link show ${1} > /dev/null 2>&1; then
    74                                         IFCONFIG=${file} ${network_devices}/services/${SERVICE} ${1} down
    75                                 else
    76                                         boot_mesg "Interface ${1} doesn't exist." ${WARNING}
    77                                         echo_warning
    78                                 fi
    7994                        fi
    80                 else
    81                         boot_mesg -n "Unable to process ${file}.  Either" ${FAILURE}
    82                         boot_mesg -n " the SERVICE variable was not set,"
    83                         boot_mesg " or the specified service cannot be executed."
    84                         echo_failure
    85                         continue
    8695                fi
    8796        )
    8897done
    8998
    90 if [ -z "${2}" ]; then
    91         link_status=`ip link show ${1} 2> /dev/null | grep ${1}`
    92         if [ -n "${link_status}" ]; then
    93                 if echo "${link_status}" | grep -q UP; then
    94                         boot_mesg "Bringing down the ${1} interface..."
    95                         ip link set ${1} down
    96                         evaluate_retval
    97                 fi
     99if [ "${INTERFACE}" = "" ]; then
     100        if [ -z "${2}" ]; then
     101                boot_mesg "Bringing down the ${1} interface..."
     102                ip link set ${1} down
     103                evaluate_retval
    98104        fi
    99105fi
Note: See TracChangeset for help on using the changeset viewer.