/[baselayout]/trunk/net.Linux/ccwgroup.sh
Gentoo

Contents of /trunk/net.Linux/ccwgroup.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2547 - (show annotations) (download) (as text)
Thu Apr 5 11:18:42 2007 UTC (7 years ago) by uberlord
File MIME type: text/x-sh
File size: 1649 byte(s)
    Rewrite the core parts in C. We now provide librc so other programs can
    query runlevels, services and state without using bash. We also provide
    libeinfo so other programs can easily use our informational functions.

    As such, we have dropped the requirement of using bash as the init script
    shell. We now use /bin/sh and have strived to make the scripts as portable
    as possible. Shells that work are bash and dash. busybox works provided
    you disable s-s-d. If you have WIPE_TMP set to yes in conf.d/bootmisc you
    should disable find too.
    zsh and ksh do not work at this time.

    Networking support is currently being re-vamped also as it was heavily bash
    array based. As such, a new config format is available like so
    config_eth0="1.2.3.4/24 5.6.7.8/16"
    or like so
    config_eth0="'1.2.3.4 netmask 255.255.255.0' '5.6.7.8 netmask 255.255.0.0'"

    We will still support the old bash array format provided that /bin/sh IS
    a link it bash.

    ChangeLog for baselayout-1 can be found in our SVN repo.
1 # Copyright 2006-2007 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # Contributed by Roy Marples (uberlord@gentoo.org)
4
5 _config_vars="$_config_vars ccwgroup"
6
7 ccwgroup_depend() {
8 before interface
9 }
10
11 ccwgroup_pre_start() {
12 eval $(_get_array "ccwgroup_${IFVAR}")
13 [ $# = "0" ] && return 0
14
15 if [ ! -d /sys/bus/ccwgroup ] ; then
16 modprobe qeth
17 if [ ! -d /sys/bus/ccwgroup ] ; then
18 eerror "ccwgroup support missing in kernel"
19 return 1
20 fi
21 fi
22
23 einfo "Enabling ccwgroup on ${IFACE}"
24 local x= ccw= first= layer2=
25 for x in "$@" ; do
26 [ -z "${first}" ] && first=${x}
27 ccw="${ccw}${ccw:+,}${x}"
28 done
29 if [ -e /sys/devices/qeth/"${first}" ] ; then
30 echo "0" > /sys/devices/qeth/"${first}"/online
31 else
32 echo "${ccw}" > /sys/bus/ccwgroup/drivers/qeth/group
33 fi
34 eval layer2=\$qeth_layer2_${IFVAR}
35 echo "${layer2:-0}" > /sys/devices/qeth/"${first}"/layer2
36 echo "1" > /sys/devices/qeth/"${first}"/online
37 eend $?
38 }
39
40 ccwgroup_pre_stop() {
41 # Erase any existing ccwgroup to be safe
42 save_options ccwgroup_device ""
43
44 [ ! -L /sys/class/net/"${FACE}"/driver ] && return 0
45 local driver="$(readlink /sys/class/net/"${IFACE}"/driver)"
46 case "${diver}" in
47 */bus/ccwgroup/*) ;;
48 *) return 0 ;;
49 esac
50
51 local device="$(readlink /sys/class/net/"${IFACE}"/device)"
52 device=${device##*/}
53 save_options ccwgroup_device "${device}"
54 }
55
56 ccwgroup_post_stop() {
57 local device="$(get_options ccwgroup_device)"
58 [ -z "${device}" ] && return 0
59
60 einfo "Disabling ccwgroup on ${iface}"
61 echo "0" > /sys/devices/qeth/"${device}"/online
62 echo "1" > /sys/devices/qeth/"${device}"/ungroup
63 eend $?
64 }
65
66 # vim: set ts=4 :

  ViewVC Help
Powered by ViewVC 1.1.20