home *** CD-ROM | disk | FTP | other *** search
- #!/bin/bash
- #
- # Configures a IUCV interface.
- # $Id: hwdown-iucv 1415 2006-02-16 09:16:36Z hare $
- #
-
- SCRIPTNAME=${0##*/}
- HWDESC=$1
-
- # Read in common functions
- . ./scripts/functions
- test -r ./config && . ./config
-
- if test -z "$SYSFS"; then
- message sysfs not mounted, aborting.
- exit 1
- fi
-
- if test -z "$HWD_ID"; then
- message no link partner given, aborting.
- exit 1
- fi
-
- # Check whether the netiucv module is loaded
- _iucv_dir=${SYSFS}/bus/iucv/drivers/netiucv
-
- if [ ! -d "$_iucv_dir" ] ; then
- # Check for older kernels
- _iucv_dir=${SYSFS}/bus/iucv/drivers/NETIUCV
- if [ ! -d "$_iucv_dir" }; then
- message "IUCV device not initialized !"
- exit 1
- fi
- fi
-
- # Check whether this link is already established
- for _dev in ${SYSFS}/bus/iucv/devices/*; do
- if [ -d "$_dev" ] ; then
- read _link < $_dev/user
- if test "$_link" = "$HWD_ID" ; then
- _ifname=${_dev##*/}
- _ifname=${_ifname##net}
- break
- fi
- fi
- done
-
- if test -z "$_ifname" ; then
- message "IUCV device (link partner $HWD_ID) is not established!"
- else
- echo "$_ifname" > $_iucv_dir/remove
-
- if [ ! -d /sys/class/net/$_ifname ]; then
- message "IUCV device (link partner $HWD_ID) deconfigured"
- else
- message "Could not deconfigure IUCV device (link partner $HWD_ID)"
- fi
- fi
-
- # EOF
-
-