home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / boot / i386 / rescue / etc / sysconfig / hardware / scripts / hwup-qeth < prev    next >
Text File  |  2006-11-29  |  2KB  |  99 lines

  1. #!/bin/bash
  2. #
  3. # hwup-qeth
  4. # $Id: hwup-qeth 1415 2006-02-16 09:16:36Z hare $
  5. #
  6. # Configuration script for OSA/Express devices
  7. # Sets the portname if configured and 
  8. # sets the adapter online
  9. #
  10.  
  11. SCRIPTNAME=${0##*/}
  12. HWDESC=$1
  13.  
  14. # Read in common functions
  15. . ./scripts/functions
  16. test -r ./config && . ./config
  17.  
  18. if test -z "$SYSFS"; then
  19.     message "sysfs not mounted, aborting."
  20.     exit 1
  21. fi
  22.  
  23. if [ -z "$DEVPATH" ]; then
  24.     message "no device path given, aborting."
  25.     exit 1
  26. fi
  27.  
  28. # Read in the configuration file
  29. . ./hwcfg-${HWDESC}
  30.  
  31. # Set sysfs paths
  32. _ccwgroup_dir=${SYSFS}${DEVPATH}
  33.  
  34. # Check whether the channel group is configured
  35. message_n "Configuring device ${_ccwgroup_dir##*/}: "
  36. if test -d "$_ccwgroup_dir" ; then
  37.     read _online < $_ccwgroup_dir/online
  38.     # We do not check for the value of CCW_CHAN_MODE, since we
  39.     # might want to switch back and forth between several modes
  40.     if test "$_online" -eq "0" ; then
  41.     # Set the portname
  42.     if [ "$CCW_CHAN_MODE" ]; then
  43.         message_n "(portname $CCW_CHAN_MODE) "
  44.         echo "$CCW_CHAN_MODE" > $_ccwgroup_dir/portname
  45.     fi
  46.     # Enable IP address takeover
  47.     if [ "$QETH_IPA_TAKEOVER" ]; then
  48.         if [ "$QETH_IPA_TAKEOVER" = "1" ]; then
  49.         message_n "(IP takeover) "
  50.         echo 1 > $_ccwgroup_dir/ipa_takeover/enable
  51.         fi
  52.     fi
  53.     # Activate Layer2 support
  54.     if [ -w "$_ccwgroup_dir/layer2" ] && [ "$QETH_LAYER2_SUPPORT" ]; then
  55.         if [ "$QETH_LAYER2_SUPPORT" = "1" ]; then
  56.         message_n "(Layer2) "
  57.         echo 1 > $_ccwgroup_dir/layer2
  58.         fi
  59.     fi
  60.     # Set additional options
  61.     if [ "$QETH_OPTIONS" ]; then
  62.         for opt in $QETH_OPTIONS; do
  63.         saved_IFS="$IFS"
  64.         IFS='='
  65.         set -- $opt
  66.         opt_name=$1
  67.         opt_val=$2
  68.         IFS="$saved_IFS"
  69.         case "$opt_name" in
  70.             portname|ipa_takeover|layer2)
  71.                     # These options are set above
  72.             debug "invalid option $opt_name"
  73.             ;;
  74.             *)
  75.             if [ "$opt_name" -a "$opt_val" ]; then
  76.                 if [ -w "$_ccwgroup_dir/$opt_name" ]; then
  77.                 message_n "($opt_name) "
  78.                 echo "$opt_val" > $_ccwgroup_dir/$opt_name
  79.                 else
  80.                             # Skip invalid options
  81.                 debug "invalid option $opt_name"
  82.                 fi
  83.             fi
  84.             ;;
  85.         esac
  86.         done
  87.     fi
  88.  
  89.     echo "1" > $_ccwgroup_dir/online
  90.     message "ok."
  91.     else
  92.     message "already online."
  93.     fi
  94. else
  95.     message "not available."
  96. fi
  97.  
  98. #EOF
  99.