}
# }}}
-# For burning on IDE-CD-Roms, k3b (and others) check for special permissions {{{
-config_cdrom_perm(){
-CDROMS=""
-for DEVICE in /proc/ide/hd?; do
- [ "$(cat $DEVICE/media 2>/dev/null)" = "cdrom" ] && CDROMS="$CDROMS /dev/${DEVICE##*/}"
-done
-[ -n "$CDROMS" ] && { chown root.cdrom $CDROMS; chmod 666 $CDROMS; } 2>/dev/null
-}
-# }}}
-
# {{{ Bring up loopback interface now
config_local_net(){
if [ -z "$INSTALLED" ] ; then
}
# }}}
-# firewire devices {{{
-# the raw1394 driver does not yet export info into SYSFS,
-# so let's create raw1394 device manually
-# http://www.michael-prokop.at/blog/index.php?p=352
-config_firewire_dev(){
-if checkbootparam 'nofirewiredev' ; then
- ewarn "Skipping creating some firewire devices as requested on boot commandline." ; eend 0
-else
-#if [ "${KERNEL%-*}" == "2.6.11" ] ; then
- einfo "Creating some firewire devices (fix kernel 2.6-bug)."
-# cd /dev && MAKEDEV video1394 raw1394
- [ -r /dev/raw1394 ] || mknod /dev/raw1394 c 171 0
- [ -r /dev/video1394 ] || mknod -m 666 /dev/video1394 c 171 16
-# mknod -m 666 /dev/dv1394 c 171 32 # for NTSC
- [ -r /dev/dv1394 ] || mknod -m 666 /dev/dv1394 c 171 34 # for PAL
- chown -R root:video /dev/raw1394 /dev/video1394 /dev/dv1394
- chmod -R 664 /dev/raw1394 /dev/video1394 /dev/dv1394 ; eend $?
-fi
-#fi
-}
-# }}}
-
# {{{ copy passwd-lockfile to ramdisk (fix unionfs-behaviour)
# otherwise we will get: passwd: Authentication token lock busy
config_fix_passwd(){
}
# }}}
-# {{{ hardware detection via discover
-config_discover(){
-if checkbootparam 'nodisc' ; then
- ewarn "Skipping hardware detection via discover as requested on boot commandline." ; eend 0
-else
- if [ -x /sbin/discover ] ; then
- einfo "Discovering hardware. Trying to load the following modules in background:"
- eindent
- einfo "$(discover --data-path=linux/module/name --data-path=linux/modules/options --format="%s %s" --data-version=`uname -r` --enable-bus all | sort -u | xargs echo)"
- eoutdent
- /sbin/discover-modprobe -v >>$DEBUG 2>&1 &
- eend 0
- else
- eerror "Application discover not available. Information: udev should handle hardware recognition." ; eend 0
- fi
-fi
-}
-# }}}
-
-# {{{ hardware detection via hwinfo
-config_hwinfo(){
-if checkbootparam 'hwinfo' >>$DEBUG 2>&1; then
- einfo "Discovering hardware via hwinfo:"
- MODULES=$(su grml hwinfo | grep "Cmd: \"modprobe" | awk '{print $5}' | sed 's/"//')
- echo -n " Loading modules: "
- for i in `echo $MODULES` ; do echo -n $i && modprobe $i ; done
- eend 0
-fi
-}
-# }}}
-
-# {{{ disable hotplug agents on request
-config_hotplug_agent(){
-if checkbootparam 'noagent' ; then
- AGENT="$(getbootparam 'noagent' 2>>$DEBUG)"
- AGENTLIST=$(echo "$AGENT" | sed 's/,/\\n/g')
- AGENTNL=$(echo "$AGENT" | sed 's/,/ /g')
- einfo "Disabling hotplug-agent(s) $AGENTNL"
- for agent in $(echo -e $AGENTLIST) ; do
- mv /etc/hotplug/${agent}.rc /etc/hotplug/${agent}.norc
- done
- [ "$?" == "0" ] ; eend $?
-fi
-}
-# }}}
-
-# {{{ blacklist of hotplug-modules
-config_hotplug_blacklist(){
-if checkbootparam 'black' ; then
- BLACK="$(getbootparam 'black' 2>>$DEBUG)"
- BLACKLIST=$(echo "$BLACK" | sed 's/,/\\n/g')
- BLACKNL=$(echo "$BLACK" | sed 's/,/ /g')
- einfo "Blacklisting $BLACKNL via /etc/hotplug/blacklist.d/hotplug-light"
- echo -e "$BLACKLIST" >> /etc/hotplug/blacklist.d/hotplug-light
- echo -e "$BLACKLIST" >> /etc/hotplug/blacklist
- eend 0
-fi
-}
-# }}}
-
-# {{{ run hotplug
-config_hotplug(){
-if checkbootparam 'nohotplug' ; then
- ewarn "Skipping running hotplug as requested on boot commandline." ; eend 0
-else
- if [ -r /etc/init.d/hotplug ] ; then
- einfo "Starting hotplug system in background."
- /etc/init.d/hotplug start >>$DEBUG 2>>$DEBUG &
- eend 0
- elif [ -r /etc/init.d/hotplug-light ] ; then
- einfo "Starting hotplug-light system in background."
- /etc/init.d/hotplug-light start >>$DEBUG 2>>$DEBUG &
- eend 0
- else
- ewarn "No hotplug system found. Should be handled by udev. Skipping execution." ; eend 0
- fi
-fi
-}
-# }}}
-
# {{{ blacklist specific module [ used in /etc/init.d/udev ]
config_blacklist(){
if checkbootparam 'blacklist' ; then
}
# }}}
-# {{{ PCMCIA Check/Setup
-# This needs to be done before other modules are being loaded (by hwsetup)
-config_pcmcia(){
-if checkbootparam 'nopcmcia'; then
- ewarn "Skipping PCMCIA detection as requested on boot commandline." ; eend 0
-else
- if /usr/sbin/laptop-detect ; then
- einfo "Detected Laptop - checking for PCMCIA." && eend 0
- modprobe pcmcia_core >>$DEBUG 2>&1
- # Try Cardbus or normal PCMCIA socket drivers
- modprobe yenta_socket >>$DEBUG 2>&1 || modprobe i82365 >>$DEBUG 2>&1 || modprobe pd6729 >>$DEBUG 2>&1 || modprobe tcic >>$DEBUG 2>&1
- if [ "$?" = "0" ]; then
- modprobe ds >>$DEBUG 2>&1
- if [ -d /proc/bus/pccard ] ; then
- if [ -x /sbin/cardmgr ] ; then
- einfo "PCMCIA found, starting cardmgr."
- cardmgr >>$DEBUG 2>&1 && sleep 6 && eend 0
- else
- eerror "No cardmgr found. Make sure package pcmciautils is installed, it should handle it instead." ; eend 1
- fi
- fi
- fi
- fi
-fi
-}
-# }}}
-
# {{{ run software synthesizer via speakup
config_swspeak(){
if checkbootparam 'swspeak' ; then
}
# }}}
-# {{{ automount(er)
-config_automounter(){
-if checkbootparam 'automounter' ; then
- RUNLEVEL="$(runlevel)"
- AUTOMOUNTER=""
- [ -x /etc/init.d/autofs ] && [ "$RUNLEVEL" != "N 1" ] && [ "$RUNLEVEL" != "N S" ] && AUTOMOUNTER="yes"
-
-addautomount(){
-# /dev/ice options
- d="${1##*/}"
- if [ -n "$AUTOMOUNTER" ]; then
- [ -d "/mnt/$d" -a ! -L "/mnt/$d" ] && rmdir /mnt/$d
- [ -d "/mnt/auto/$d" ] || mkdir -p "/mnt/auto/$d"
- [ -L "/mnt/$d" ] || ln -s "/mnt/auto/$d" "/mnt/$d"
- anew="$d -fstype=auto,$2 :$i"
- grep -q "$anew" "/etc/auto.mnt" || echo "$anew" >> /etc/auto.mnt
- AUTOMOUNTS="$AUTOMOUNTS $d"
- new="$1 /mnt/auto/$d auto users,noauto,exec,$2 0 0"
- else
- [ -d /mnt/$d ] && mkdir -p /mnt/$d
- new="$1 /mnt/$d auto users,noauto,exec,$2 0 0"
- fi
- grep -q "$new" "/etc/fstab" || echo "$new" >> /etc/fstab
-}
-
- AUTOMOUNTS="floppy cdrom"
-# Add new devices to /etc/fstab and /etc/auto.mnt
- for i in /dev/cdrom?*; do
- if [ -L $i ]; then
- addautomount "$i" "ro"
- fi
- done
-fi
-
-if [ -n "$AUTOMOUNTER" ]; then
-# Check for floppy dir, reinstall with automounter
- [ -d /mnt/floppy -a ! -L /mnt/floppy ] && rmdir /mnt/floppy
- [ -d /mnt/auto/floppy ] || mkdir -p /mnt/auto/floppy
- [ -L /mnt/floppy ] || ln -s /mnt/auto/floppy /mnt/floppy
- [ -d /mnt/cdrom -a ! -L /mnt/cdrom ] && rmdir /mnt/cdrom
- [ -d /mnt/auto/cdrom ] || mkdir -p /mnt/auto/cdrom
- [ -L /mnt/cdrom ] || ln -s /mnt/auto/cdrom /mnt/cdrom
- rm -f /etc/fstab.new
-# Replace paths from bootfloppy
- sed 's|/mnt/cdrom|/mnt/auto/cdrom|g;s|/mnt/floppy|/mnt/auto/floppy|g' /etc/fstab > /etc/fstab.new
- mv -f /etc/fstab.new /etc/fstab
-# Start automounter now
- einfo "Starting automounter for ${AUTOMOUNTS}."
- /etc/init.d/autofs start >>$DEBUG ; eend $?
-fi
-}
-# }}}
-
# {{{ Collect partitions from /proc/partitions first for enabling DMA
check_partitions(){
partitions=""
checkbootparam 'anyswap' && export ANYSWAP='yes' || export ANYSWAP=""
fi
-if checkbootparam 'nofstab' || checkbootparam 'forensic' ; then
- ewarn "Skipping /etc/fstab creation as requested on boot commandline." ; eend 0
-else
- einfo "Scanning for harddisk partitions and creating /etc/fstab. (Disable this via boot option: nofstab)"
- iszsh && setopt nonomatch
- if [ -x /usr/sbin/rebuildfstab ] ; then
- config_userfstab || fstabuser=grml
- /usr/sbin/rebuildfstab -r -u $fstabuser -g $fstabuser ; eend $?
- else
- ewarn "Command rebuildfstab not found. Install package grml-rebuildfstab." ; eend 1
- fi
-fi # checkbootparam nofstab/forensic
-
# Scan for swap, config, homedir - but only in live-mode
if [ -z "$INSTALLED" ] ; then
[ -z "$NOSWAP" ] && einfo "Searching for swap partition(s) as requested."
}
# }}}
-# {{{ keyboard add-ons
-config_setkeycodes(){
-if checkbootparam 'setkeycodes' ; then
- einfo "Setting keycodes as requested via bootparameter 'setkeycodes'."
- # MS MM keyboard add-on
- # fix
- setkeycodes e001 126 &>/dev/null
- setkeycodes e059 127 &>/dev/null
- # fn keys
- setkeycodes e03b 59 &>/dev/null
- setkeycodes e008 60 &>/dev/null
- setkeycodes e007 61 &>/dev/null
- setkeycodes e03e 62 &>/dev/null
- setkeycodes e03f 63 &>/dev/null
- setkeycodes e040 64 &>/dev/null
- setkeycodes e041 65 &>/dev/null
- setkeycodes e042 66 &>/dev/null
- setkeycodes e043 67 &>/dev/null
- setkeycodes e023 68 &>/dev/null
- setkeycodes e057 87 &>/dev/null
- setkeycodes e058 88 &>/dev/null
- # hp keycodes
- setkeycodes e00a 89 e008 90 &>/dev/null
- eend 0
-fi
-}
-# }}}
-
# {{{ wondershaper
config_wondershaper(){
if checkbootparam 'wondershaper' ; then
SERVICE="$(getbootparam 'services' 2>>$DEBUG)"
SERVICELIST=$(echo "$SERVICE" | sed 's/,/\\n/g')
SERVICENL=$(echo "$SERVICE" | sed 's/,/ /g')
- einfo "Starting service(s) ${SERVICENL} in background."
for service in $(echo -e $SERVICELIST) ; do
- /etc/init.d/${service} start >>$DEBUG &
+ # support running (custom) init scripts in non-blocking mode
+ # if they contain the keyword "DO_NO_RUN_IN_BACKGROUND".
+ if grep -q 'DO_NO_RUN_IN_BACKGROUND' "/etc/init.d/${service}" 2>>$DEBUG ; then
+ einfo "Starting service ${service}."
+ /etc/init.d/${service} start >>$DEBUG
+ else
+ einfo "Starting service ${service} in background."
+ /etc/init.d/${service} start >>$DEBUG &
+ fi
done
- [ "$?" == "0" ] ; eend $?
+ eend $?
fi
}
# }}}
# foo, even if a GRMLCFG partition is present.
DCSDIR=""
DCSMP="/mnt/grml"
+# autoconfig, see issue673
+GRMLCFG="$(getbootparam 'autoconfig' 2>>$DEBUG)"
+[ -n "$GRMLCFG" ] || GRMLCFG="GRMLCFG"
if checkbootparam 'noautoconfig' || checkbootparam 'forensic' ; then
- ewarn "Skipping running automount of device(s) labeled GRMLCFG as requested." ; eend 0
+ ewarn "Skipping running automount of device(s) labeled $GRMLCFG as requested." ; eend 0
else
if [ -z "$INSTALLED" ] ; then
if checkbootparam 'myconfig' ; then
eerror "Error: No device for bootoption myconfig provided." ; eend 1
fi # [ -z "$DCSDEVICE" ]
elif checkvalue $CONFIG_MYCONFIG; then # checkbootparam myconfig
- einfo "Searching for device(s) labeled with GRMLCFG. (Disable this via boot option: noautoconfig)" ; eend 0
+ einfo "Searching for device(s) labeled with $GRMLCFG. (Disable this via boot option: noautoconfig)" ; eend 0
eindent
# We do need the following fix so floppy disk is available to blkid in any case :-/
if [ -r /dev/fd0 ] ; then
blkid /dev/fd0 >>$DEBUG 2>&1
fi
fi
- DCSDEVICE=$(blkid -t LABEL=GRMLCFG | head -1 | awk -F: '{print $1}')
+ DCSDEVICE=$(blkid -t LABEL=$GRMLCFG | head -1 | awk -F: '{print $1}')
if [ -n "$DCSDEVICE" ]; then
DCSMP="/mnt/grmlcfg"
fi
iszsh && setopt localoptions shwordsplit
DEBS="$(getbootparam 'debs' 2>>$DEBUG)"
if [ -z "$DEBS" ] ; then
- DEBS="*"
+ DEBS="*.deb"
fi
if ! echo $DEBS | grep -q '/'; then
# backwards compatibility: if no path is given get debs from debs/
fi
fi
fi
-# umount $DCSMP if it was mounted by finddcsdir
-# this doesn't really belong here
-grep -q '$DCSMP' /proc/mounts && umount $DCSMP
+}
+# }}}
+
+# {{{ confing_umount_dcsdir
+config_umount_dcsdir(){
+ # umount $DCSMP if it was mounted by finddcsdir
+ grep -q "$DCSMP" /proc/mounts && umount "$DCSMP"
}
# }}}
}
# }}}
+config_virtualbox_shared_folders() {
+if [ -r /proc/acpi/battery/BAT0/info ] && grep -q 'OEM info:.*innotek' /proc/acpi/battery/BAT0/info ; then
+ einfo "VirtualBox detected, trying to set up Shared Folders."
+ if ! modprobe -l | grep -q vboxsf.ko ; then
+ ewarn "vboxsf driver not present, not setting up VirtualBox Shared Folders."
+ eend 0
+ elif ! [ -x /usr/sbin/VBoxService ] ; then
+ ewarn "virtualbox-guest-utils not installed, not setting up VirtualBox Shared Folders."
+ eend 0
+ else
+ eindent
+
+ einfo "Loading vboxsf driver."
+ lsmod | grep -q vboxsf || modprobe vboxsf
+ eend $?
+
+ einfo "Adjusting /dev/vboxguest."
+ chown root:vboxsf /dev/vboxguest
+ chmod 660 /dev/vboxguest
+ eend $?
+
+ if [ -n "$CONFIG_FSTAB_USER" ] ; then
+ fstabuser="$CONFIG_FSTAB_USER"
+ else
+ fstabuser=$(getent passwd 1000 | cut -d: -f1)
+ fi
+ einfo "Adding $fstabuser to group vboxsf."
+ adduser grml vboxsf &>/dev/null
+ eend $?
+
+ einfo "Starting VBoxService."
+ VBoxService >/dev/null &
+ eend $?
+
+ eoutdent
+ fi
+fi
+}
+
# {{{ Support customization
config_distri(){
if checkbootparam 'distri'; then