From 2dc0038155b978eb70be482313cc8535dadc436d Mon Sep 17 00:00:00 2001 From: Judd Vinet Date: Tue, 15 Nov 2005 02:51:52 +0000 Subject: added variables for autoloading modules, cleaned up rc.conf a bit --- hwdetect | 39 +++++++++++++++++++++++++-------------- network | 2 +- rc.conf | 38 ++++++++++++++++++++++++++------------ rc.sysinit | 6 ++++-- 4 files changed, 56 insertions(+), 29 deletions(-) diff --git a/hwdetect b/hwdetect index cb3bf1a..450e438 100755 --- a/hwdetect +++ b/hwdetect @@ -33,11 +33,18 @@ usage () { [ "$1" == "" ] && usage +: >/tmp/modules-plain +: >/tmp/modules-sorted +: >/tmp/moduleslist +: >/tmp/modprobe +: >/tmp/modules + # find pci aliases find /sys/devices/ -name "modalias" | grep pci > /tmp/modules # delete pci devices that are blacklisted -for i in "${BLACKLIST[@]}"; do +for i in $PCI_BLACKLIST; do + [ "$i" ] || continue sed -i -e "/$i/d" /tmp/modules done @@ -66,21 +73,25 @@ done sort -u /tmp/modules-plain >> /tmp/modules-sorted sed -ne "s#^insmod.*/\(.*\)\.ko.*#\1#p" /tmp/modules-sorted >> /tmp/moduleslist -listex() { - ln=$1 ; shift - if [ $# -gt 0 ]; then - ex=$1 ; shift - if [ "`echo $ln | grep -v $ex`" ]; then - listex "$ln" $* - fi - else - echo $ln | sed -ne "s#^/.*/\(.*\)\.ko.*#\1#p" - fi -} +# delete modules that are blacklisted +for i in $BLACKLIST; do + [ "$i" ] || continue + sed -i -e "/^$i$/d" /tmp/moduleslist +done + listmods() { key=$1 ; shift - for ln in `grep "$key" /tmp/modules-sorted | sed 's|^insmod ||g' | sort -u`; do - listex "$ln" $* + ex= + while [ "$1" ]; do + [ "$ex" ] && ex="$ex|$1" || ex="$1" + shift + done + for ln in `grep "$key" /tmp/modules-sorted | sed 's|^insmod ||g'`; do + if [ "$ex" ]; then + echo $ln | egrep -v "$ex" | sed -ne "s#^/.*/\(.*\)\.ko.*#\1#p" + else + echo $ln | sed -ne "s#^/.*/\(.*\)\.ko.*#\1#p" + fi done } showlist() { diff --git a/network b/network index 2510b58..c23c949 100755 --- a/network +++ b/network @@ -32,7 +32,7 @@ ifup() return 1 fi # don't bring up an interface that's already up - [ "`/sbin/ifconfig ${1} 2>/dev/null | grep UP`" ] && return 1 + [ "`/sbin/ifconfig ${1} 2>/dev/null | grep UP`" ] && return 0 eval iwcfg="\$wlan_${1}" if [ "$iwcfg" != "" ]; then /usr/sbin/iwconfig $iwcfg diff --git a/rc.conf b/rc.conf index 8b00ca2..049cd4f 100644 --- a/rc.conf +++ b/rc.conf @@ -3,7 +3,9 @@ # # -# Localization +# ----------------------------------------------------------------------- +# LOCALIZATION +# ----------------------------------------------------------------------- # # LOCALE: available languages can be listed with the 'locale -a' command # HARDWARECLOCK: set to "UTC" or "localtime" @@ -21,20 +23,29 @@ CONSOLEFONT= CONSOLEMAP= USECOLOR="yes" +# +# ----------------------------------------------------------------------- +# HARDWARE +# ----------------------------------------------------------------------- +# +# Scan hardware and load required modules at bootup +MOD_AUTOLOAD="yes" +# Module Blacklist - modules in this list will never be loaded by hwdetect +MOD_BLACKLIST=() +# +# Modules to load at boot-up (in this order) +# - prefix a module with a ! to disable it +# +MODULES=(!usbserial) # Scan for LVM volume groups at startup, required if you use LVM USELVM="no" # -# Networking +# ----------------------------------------------------------------------- +# NETWORKING +# ----------------------------------------------------------------------- # HOSTNAME="myhost" - -# -# Module to load at boot-up (in this order) -# (prefix a module with a ! to disable it) -# -MODULES=(!usbserial !ide-scsi) - # # Interfaces to start at boot-up (in this order) # Declare each interface then list in INTERFACES @@ -45,7 +56,6 @@ MODULES=(!usbserial !ide-scsi) lo="lo 127.0.0.1" eth0="eth0 192.168.0.2 netmask 255.255.255.0 broadcast 192.168.0.255" INTERFACES=(lo eth0) - # # Routes to start at boot-up (in this order) # Declare each route then list in ROUTES @@ -53,7 +63,6 @@ INTERFACES=(lo eth0) # gateway="default gw 192.168.0.1" ROUTES=(!gateway) - # # Enable these network profiles at boot-up. These are only useful # if you happen to need multiple network configurations (ie, laptop users) @@ -64,11 +73,16 @@ ROUTES=(!gateway) # #NET_PROFILES=(main) +# +# ----------------------------------------------------------------------- +# DAEMONS +# ----------------------------------------------------------------------- # # Daemons to start at boot-up (in this order) # - prefix a daemon with a ! to disable it # - prefix a daemon with a @ to start it up in the background # -DAEMONS=(syslog-ng hotplug !pcmcia network netfs crond) +DAEMONS=(syslog-ng !hotplug !pcmcia network netfs crond) + # End of file diff --git a/rc.sysinit b/rc.sysinit index b8af6aa..b28b679 100755 --- a/rc.sysinit +++ b/rc.sysinit @@ -121,8 +121,6 @@ umount /proc && mount -t proc none /proc /bin/mount -a -t nonfs,nosmbfs,nocifs,noncpfs,nosysfs,nousbfs stat_done -status "Detecting Required Modules" /sbin/hwdetect -load-modules - stat_busy "Configuring System Clock" if [ "$HARDWARECLOCK" = "UTC" ]; then /sbin/hwclock --utc --hctosys @@ -216,6 +214,10 @@ fi # Load modules from the MODULES array defined in rc.conf if [ -f /proc/modules ]; then stat_busy "Loading Modules" + if [ "$MOD_AUTOLOAD" = "yes" -o "$MOD_AUTOLOAD" = "YES" ]; then + export BLACKLIST="${MOD_BLACKLIST[*]}" + /sbin/hwdetect -load-modules + fi for mod in "${MODULES[@]}"; do if [[ `echo $mod | grep '^[^\!]' | wc -l` -eq 1 ]]; then /sbin/modprobe $mod -- cgit v1.2.3