aboutsummaryrefslogtreecommitdiffstats
path: root/src/ccw_init
blob: beeaf8bfc7485984fc04613e7d1febce8dfc90fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/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

# SUBCHANNELS is only set on mainframe ccwgroup devices
[ -z "$SUBCHANNELS" -o -z "$NETTYPE" ] && exit 0
DIR="/sys/bus/ccwgroup/drivers/$NETTYPE"
SYSDIR="$DIR/${SUBCHANNELS//,*/}"
[ ! -e $DIR/group ] && exit 0
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