Subversion Repositories livecd

Rev

Rev 261 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 261 Rev 262
1
#!/bin/bash
1
#!/bin/bash
2
#
2
#
3
# Fix things during bootup - run very first 
3
# Fix things during bootup - run very first 
4
# Executed at the begining of /etc/rc.d/rc.sysinit
4
# Executed at the begining of /etc/rc.d/rc.sysinit
5
#
5
#
6
# Urs Beyerle
6
# Urs Beyerle
7
#
7
#
8
 
8
 
9
### definitions
9
### definitions
10
 
10
 
11
# dir of mounted /$MOUNTDIR/live
11
# dir of mounted /$MOUNTDIR/live
12
MOUNTDIR=livecd
12
MOUNTDIR=livecd
13
 
13
 
14
# source functions
14
# source functions
15
. /$MOUNTDIR/live/liblinuxlive
15
. /$MOUNTDIR/live/liblinuxlive
16
. /etc/init.d/functions
16
. /etc/init.d/functions
17
 
17
 
18
 
18
 
19
### get boot parameters
19
### get boot parameters
20
 
20
 
21
# root on NFS?
21
# root on NFS?
22
NFSROOT=$( cmdline_value nfsroot )
22
NFSROOT=$( cmdline_value nfsroot )
23
 
23
 
24
# kernel modules for blacklist?
24
# kernel modules for blacklist?
25
BLACKLIST=$( cmdline_value blacklist )
25
BLACKLIST=$( cmdline_value blacklist )
26
 
26
 
27
# disable udev hotplug?
27
# disable udev hotplug?
28
NOHOTPLUG=$( cmdline_parameter nohotplug )
28
NOHOTPLUG=$( cmdline_parameter nohotplug )
29
 
29
 
30
 
30
 
31
### create /srv and /selinux
31
### create /srv and /selinux
32
mkdir -p /srv
32
mkdir -p /srv
33
mkdir -p /selinux
33
mkdir -p /selinux
34
 
34
 
35
 
35
 
36
### blacklist file
36
### blacklist file
37
[ -e /etc/hotplug/blacklist ]    && BLACKLIST_FILE=/etc/hotplug/blacklist
37
[ -e /etc/hotplug/blacklist ]    && BLACKLIST_FILE=/etc/hotplug/blacklist
38
[ -e /etc/modprobe.d/blacklist ] && BLACKLIST_FILE=/etc/modprobe.d/blacklist
38
[ -e /etc/modprobe.d/blacklist ] && BLACKLIST_FILE=/etc/modprobe.d/blacklist
39
 
39
 
40
 
40
 
41
### put wireless kernel module on blacklist, if boot over NFS
41
### put wireless kernel module on blacklist, if boot over NFS
42
#   we don't need to load wireless modules, if we boot over network 
42
#   we don't need to load wireless modules, if we boot over network 
43
if [ $NFSROOT ]; then
43
if [ $NFSROOT ]; then
44
 
44
 
45
    echo "Disable probing for wireless modules on diskless client"
45
    echo "Disable probing for wireless modules on diskless client"
46
    cp -a ${BLACKLIST_FILE} ${BLACKLIST_FILE}.ori
46
    cp -a ${BLACKLIST_FILE} ${BLACKLIST_FILE}.ori
47
    echo >> ${BLACKLIST_FILE}
47
    echo >> ${BLACKLIST_FILE}
48
    echo "# Disable wireless modules on diskless client" >> ${BLACKLIST_FILE}
48
    echo "# Disable wireless modules on diskless client" >> ${BLACKLIST_FILE}
49
 
49
 
50
    # for SL4
50
    # for SL4
51
    if [ -e /etc/hotplug/blacklist ]; then
51
    if [ -e /etc/hotplug/blacklist ]; then
52
	find /lib/modules/$( uname -r )/kernel/drivers/net/wireless -type f | grep -v "_" | while read module; do 
52
	find /lib/modules/$( uname -r )/kernel/drivers/net/wireless -type f | grep -v "_" | while read module; do 
53
	    basename $module | cut -d"." -f 1
53
	    basename $module | cut -d"." -f 1
54
	done >> ${BLACKLIST_FILE}
54
	done >> ${BLACKLIST_FILE}
55
    fi
55
    fi
56
 
56
 
57
    # for SL5
57
    # for SL5
58
    if [ -e /etc/modprobe.d/blacklist ]; then
58
    if [ -e /etc/modprobe.d/blacklist ]; then
59
	find /lib/modules/$( uname -r )/kernel/drivers/net/wireless -type f | grep -v "_" | while read module; do 
59
	find /lib/modules/$( uname -r )/kernel/drivers/net/wireless -type f | grep -v "_" | while read module; do 
60
	    echo -n "blacklist "; basename $module | cut -d"." -f 1
60
	    echo -n "blacklist "; basename $module | cut -d"." -f 1
61
	done >> ${BLACKLIST_FILE}
61
	done >> ${BLACKLIST_FILE}
62
    fi
62
    fi
63
fi
63
fi
64
 
64
 
65
 
65
 
66
### blacklist kernel modules
66
### blacklist kernel modules
67
if [ -n $BLACKLIST ]; then
67
if [ -n $BLACKLIST ]; then
68
    cp -a ${BLACKLIST_FILE} ${BLACKLIST_FILE}.ori
68
    cp -a ${BLACKLIST_FILE} ${BLACKLIST_FILE}.ori
-
 
69
    echo                                       >> ${BLACKLIST_FILE}
-
 
70
    echo "# Added by boot parameter of LiveCD" >> ${BLACKLIST_FILE}
69
    for module in `echo "$BLACKLIST" | tr ':' ' '`; do
71
    for module in `echo "$BLACKLIST" | tr ':' ' '`; do
70
	echo $module >> ${BLACKLIST_FILE}
72
	echo "blacklist $module"               >> ${BLACKLIST_FILE}
71
    done
73
    done
72
fi
74
fi
73
 
75
 
74
 
76
 
75
### disable udev hotplug - may make the system unusable
77
### disable udev hotplug - may make the system unusable
76
[ -e /lib/udev/udev_run_hotplugd ] && HOTPLUG_FILE=/lib/udev/udev_run_hotplugd   # SL5
78
[ -e /lib/udev/udev_run_hotplugd ] && HOTPLUG_FILE=/lib/udev/udev_run_hotplugd   # SL5
77
 
79
 
78
if [ $NOHOTPLUG ] && [ $HOTPLUG_FILE ]; then
80
if [ $NOHOTPLUG ] && [ $HOTPLUG_FILE ]; then
79
    mv ${HOTPLUG_FILE} ${HOTPLUG_FILE}.ori
81
    mv ${HOTPLUG_FILE} ${HOTPLUG_FILE}.ori
80
    touch ${HOTPLUG_FILE}
82
    touch ${HOTPLUG_FILE}
81
    chmod 755 ${HOTPLUG_FILE}
83
    chmod 755 ${HOTPLUG_FILE}
82
fi
84
fi