Subversion Repositories livecd

Rev

Rev 261 | Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

#!/bin/bash
#
# Fix things during bootup - run very first 
# Executed at the begining of /etc/rc.d/rc.sysinit
#
# Urs Beyerle
#

### definitions

# dir of mounted /$MOUNTDIR/live
MOUNTDIR=livecd

# source functions
. /$MOUNTDIR/live/liblinuxlive
. /etc/init.d/functions


### get boot parameters

# root on NFS?
NFSROOT=$( cmdline_value nfsroot )

# kernel modules for blacklist?
BLACKLIST=$( cmdline_value blacklist )

# disable udev hotplug?
NOHOTPLUG=$( cmdline_parameter nohotplug )


### create /srv and /selinux
mkdir -p /srv
mkdir -p /selinux


### blacklist file
[ -e /etc/hotplug/blacklist ]    && BLACKLIST_FILE=/etc/hotplug/blacklist
[ -e /etc/modprobe.d/blacklist ] && BLACKLIST_FILE=/etc/modprobe.d/blacklist


### put wireless kernel module on blacklist, if boot over NFS
#   we don't need to load wireless modules, if we boot over network 
if [ $NFSROOT ]; then

    echo "Disable probing for wireless modules on diskless client"
    cp -a ${BLACKLIST_FILE} ${BLACKLIST_FILE}.ori
    echo >> ${BLACKLIST_FILE}
    echo "# Disable wireless modules on diskless client" >> ${BLACKLIST_FILE}

    # for SL4
    if [ -e /etc/hotplug/blacklist ]; then
        find /lib/modules/$( uname -r )/kernel/drivers/net/wireless -type f | grep -v "_" | while read module; do 
            basename $module | cut -d"." -f 1
        done >> ${BLACKLIST_FILE}
    fi

    # for SL5
    if [ -e /etc/modprobe.d/blacklist ]; then
        find /lib/modules/$( uname -r )/kernel/drivers/net/wireless -type f | grep -v "_" | while read module; do 
            echo -n "blacklist "; basename $module | cut -d"." -f 1
        done >> ${BLACKLIST_FILE}
    fi
fi


### blacklist kernel modules
if [ -n $BLACKLIST ]; then
    cp -a ${BLACKLIST_FILE} ${BLACKLIST_FILE}.ori
    echo                                       >> ${BLACKLIST_FILE}
    echo "# Added by boot parameter of LiveCD" >> ${BLACKLIST_FILE}
    for module in `echo "$BLACKLIST" | tr ':' ' '`; do
        echo "blacklist $module"               >> ${BLACKLIST_FILE}
    done
fi


### disable udev hotplug - may make the system unusable
[ -e /lib/udev/udev_run_hotplugd ] && HOTPLUG_FILE=/lib/udev/udev_run_hotplugd   # SL5

if [ $NOHOTPLUG ] && [ $HOTPLUG_FILE ]; then
    mv ${HOTPLUG_FILE} ${HOTPLUG_FILE}.ori
    touch ${HOTPLUG_FILE}
    chmod 755 ${HOTPLUG_FILE}
fi