aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBill Nottingham <notting@redhat.com>2006-09-27 19:59:05 +0000
committerBill Nottingham <notting@redhat.com>2006-09-27 19:59:05 +0000
commit225f7786a51745535128be4925eced71b2fa94f1 (patch)
tree6b2b59d0b5de909cf417e133d59c7d42cbfa7116 /src
parentb3d12d60e2ef7e1795b8b1177c1d28208bc06acd (diff)
downloadinitscripts-225f7786a51745535128be4925eced71b2fa94f1.tar
initscripts-225f7786a51745535128be4925eced71b2fa94f1.tar.gz
initscripts-225f7786a51745535128be4925eced71b2fa94f1.tar.bz2
initscripts-225f7786a51745535128be4925eced71b2fa94f1.tar.xz
initscripts-225f7786a51745535128be4925eced71b2fa94f1.zip
move ccwgroup initialization to a udev rule (#199139, #199655, #169161)
Diffstat (limited to 'src')
-rw-r--r--src/Makefile1
-rwxr-xr-xsrc/ccw_init42
2 files changed, 43 insertions, 0 deletions
diff --git a/src/Makefile b/src/Makefile
index 8228d6c3..5a6e171f 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -27,6 +27,7 @@ install:
install -m 755 ppp-watch $(ROOT)/sbin/ppp-watch
install -m 755 consoletype $(ROOT)/sbin/consoletype
install -m 755 rename_device $(ROOT)/lib/udev/rename_device
+ install -m 755 ccw_init $(ROOT)/lib/udev/ccw_init
install -m 644 initlog.1 $(ROOT)$(mandir)/man1
install -m 644 genhostid.1 $(ROOT)$(mandir)/man1
install -m 644 doexec.1 $(ROOT)$(mandir)/man1
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