home *** CD-ROM | disk | FTP | other *** search
- #!/bin/bash
- #
- # hwup-qeth
- # $Id: hwup-qeth 1415 2006-02-16 09:16:36Z hare $
- #
- # Configuration script for OSA/Express devices
- # Sets the portname if configured and
- # sets the adapter online
- #
-
- 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 [ -z "$DEVPATH" ]; then
- message "no device path given, aborting."
- exit 1
- fi
-
- # Read in the configuration file
- . ./hwcfg-${HWDESC}
-
- # Set sysfs paths
- _ccwgroup_dir=${SYSFS}${DEVPATH}
-
- # Check whether the channel group is configured
- message_n "Configuring device ${_ccwgroup_dir##*/}: "
- if test -d "$_ccwgroup_dir" ; then
- read _online < $_ccwgroup_dir/online
- # We do not check for the value of CCW_CHAN_MODE, since we
- # might want to switch back and forth between several modes
- if test "$_online" -eq "0" ; then
- # Set the portname
- if [ "$CCW_CHAN_MODE" ]; then
- message_n "(portname $CCW_CHAN_MODE) "
- echo "$CCW_CHAN_MODE" > $_ccwgroup_dir/portname
- fi
- # Enable IP address takeover
- if [ "$QETH_IPA_TAKEOVER" ]; then
- if [ "$QETH_IPA_TAKEOVER" = "1" ]; then
- message_n "(IP takeover) "
- echo 1 > $_ccwgroup_dir/ipa_takeover/enable
- fi
- fi
- # Activate Layer2 support
- if [ -w "$_ccwgroup_dir/layer2" ] && [ "$QETH_LAYER2_SUPPORT" ]; then
- if [ "$QETH_LAYER2_SUPPORT" = "1" ]; then
- message_n "(Layer2) "
- echo 1 > $_ccwgroup_dir/layer2
- fi
- fi
- # Set additional options
- if [ "$QETH_OPTIONS" ]; then
- for opt in $QETH_OPTIONS; do
- saved_IFS="$IFS"
- IFS='='
- set -- $opt
- opt_name=$1
- opt_val=$2
- IFS="$saved_IFS"
- case "$opt_name" in
- portname|ipa_takeover|layer2)
- # These options are set above
- debug "invalid option $opt_name"
- ;;
- *)
- if [ "$opt_name" -a "$opt_val" ]; then
- if [ -w "$_ccwgroup_dir/$opt_name" ]; then
- message_n "($opt_name) "
- echo "$opt_val" > $_ccwgroup_dir/$opt_name
- else
- # Skip invalid options
- debug "invalid option $opt_name"
- fi
- fi
- ;;
- esac
- done
- fi
-
- echo "1" > $_ccwgroup_dir/online
- message "ok."
- else
- message "already online."
- fi
- else
- message "not available."
- fi
-
- #EOF
-