aboutsummaryrefslogtreecommitdiffstats
path: root/src/ccw_init
diff options
context:
space:
mode:
Diffstat (limited to 'src/ccw_init')
-rwxr-xr-xsrc/ccw_init42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/ccw_init b/src/ccw_init
new file mode 100755
index 00000000..707ae009
--- /dev/null
+++ b/src/ccw_init
@@ -0,0 +1,42 @@
+#!/bin/bash
+
+[ -z "$DEVPATH" ] && exit 0
+[ "$SUBSYSTEM" != "ccw" ] && exit 0
+
+. /etc/init.d/functions
+
+. /etc/sysconfig/network-scripts/network-functions
+
+# First, determine our channel
+
+CHANNEL=${DEVPATH##*/}
+
+CONFIG=$(get_config_by_subchannel $CHANNEL)
+
+cd /etc/sysconfig/network-scripts
+
+source_config
+
+# SUBCHANNELS is only set on mainframe ccwgroup devices
+[ -z "$SUBCHANNELS" -o -z "$NETTYPE" ] && return
+DIR="/sys/bus/ccwgroup/drivers/$NETTYPE"
+SYSDIR="$DIR/${SUBCHANNELS//,*/}"
+[ ! -e $DIR/group ] && return
+echo "$SUBCHANNELS" > $DIR/group
+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