Subversion Repositories livecd

Rev

Rev 267 | Details | Compare with Previous | Last modification | View Log | RSS feed

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