#!/bin/bash [ -z "$DEVPATH" ] && exit 0 [ "$SUBSYSTEM" != "ccw" ] && exit 0 NOLOCALE="yes" . /etc/sysconfig/network-scripts/network-functions # First, determine our channel CHANNEL=${DEVPATH##*/} CONFIG=$(get_config_by_subchannel $CHANNEL) if [ -n "$CONFIG" ]; then cd /etc/sysconfig/network-scripts source_config fi # put LAYER2 option into its own variable set $OPTIONS OPTIONS="" while [ $# -gt 0 ]; do case $1 in layer2=*) LAYER2=${1##layer2=};; *=*) OPTIONS="$OPTIONS $1";; esac shift done # SUBCHANNELS is only set on mainframe ccwgroup devices [ -z "$SUBCHANNELS" -o -z "$NETTYPE" ] && exit 0 DIR="/sys/bus/ccwgroup/drivers/$NETTYPE" i=0 while [ $i -lt 20 ]; do [ -e $DIR ] && break sleep 0.1 i=$(($i+1)) done # driver missing or not loaded [ ! -e $DIR ] && exit 0 SYSDIR="$DIR/${SUBCHANNELS//,*/}" [ -e $SYSDIR ] && exit 0 echo "$SUBCHANNELS" > $DIR/group i=0 while [ $i -lt 20 ]; do [ -e $SYSDIR ] && break sleep 0.1 i=$(($i+1)) done # first set layer2, other options may depend on it [ -n "$LAYER2" ] && echo $LAYER2 > $SYSDIR/layer2 if [ -n "$PORTNAME" ]; then if [ "$NETTYPE" = "lcs" ]; then [ -e $SYSDIR/portno ] && echo "$PORTNAME" > $SYSDIR/portno else [ -e $SYSDIR/portname ] && echo "$PORTNAME" > $SYSDIR/portname fi fi if [ "$NETTYPE" = "ctc" -a -n "$CTCPROT" ]; then echo "$CTCPROT" > $SYSDIR/protocol fi if [ -n "$OPTIONS" ]; then for i in $OPTIONS; do echo "${i//*=/}" > "$SYSDIR/${i//=*/}" done fi [ -e $SYSDIR/online ] && echo 1 > $SYSDIR/online