-
-# {{{ Check for persistent homedir option and eventually mount /home from there, or use a loopback file.
-config_homedir(){
-if checkbootparam home ; then
- HOMEDIR="$(getbootparam home)"
- MYHOMEDEVICE=""
- MYHOMEMOUNTPOINT=""
- MYHOMEDIR=""
- if [ -n "$HOMEDIR" ]; then
- einfo "Bootoption home detected." && eend 0
- case "$HOMEDIR" in
- /dev/*)
- MYHOMEDEVICE="${HOMEDIR##/dev/}"
- MYHOMEDEVICE="/dev/${MYHOMEDEVICE%%/*}"
- MYHOMEMOUNTPOINT="/mnt/${MYHOMEDEVICE##/dev/}"
- MYHOMEDIR="/mnt/${HOMEDIR##/dev/}"
- ;;
- /mnt/*)
- MYHOMEDEVICE="${HOMEDIR##/mnt/}"
- MYHOMEDEVICE="/dev/${MYHOMEDEVICE%%/*}"
- MYHOMEMOUNTPOINT="/mnt/${MYHOMEDEVICE##/dev/}"
- MYHOMEDIR="$HOMEDIR"
- ;;
- [Aa][Uu][Tt][Oo]|[Ss][Cc][Aa][Nn]|[Ff][Ii][Nn][Dd])
- MYHOMEDIR="$(findfile grml.img)"
- MYHOMEDEVICE="${MYHOMEDIR##/mnt/}"
- MYHOMEDEVICE="/dev/${MYHOMEDEVICE%%/*}"
- MYHOMEMOUNTPOINT="/mnt/${MYHOMEDEVICE##/dev/}"
- ;;
- *)
- eerror "Invalid home= option '$HOMEDIR' specified (must start with /dev/ or /mnt/ or 'scan')." ; eend 1
- eerror "Option ignored." ; eend 1
- ;;
- esac
- fi # -n $HOMEDIR
-
- if [ -n "$MYHOMEDIR" ]; then
- if trymount "$MYHOMEDEVICE" "$MYHOMEMOUNTPOINT"; then
- [ -f "$MYHOMEMOUNTPOINT/grml.img" ] && MYHOMEDIR="$MYHOMEMOUNTPOINT/grml.img"
- while read device mountpoint fs relax; do
- case "$mountpoint" in *$MYHOMEMOUNTPOINT*)
- case "$fs" in
- *[Nn][Tt][Ff][Ss]*)
- umount "$MYHOMEMOUNTPOINT"; eerror "Error: will not mount NTFS filesystem on $MYHOMEDEVICE read/write!" ; eend 1
- break
- ;;
- *[Ff][Aa][Tt]*)
- # Note: This currently won't work with encrypted partitions
- umount "$MYHOMEMOUNTPOINT"; mount -t vfat -o rw,uid=grml,gid=grml,umask=002 "$MYHOMEDEVICE" "$MYHOMEMOUNTPOINT"
- if [ ! -f "$MYHOMEDIR" ]; then
- ewarn "WARNING: FAT32 is not a good filesystem option for /home/grml (missing socket/symlink support)."
- ewarn "WARNING: Better use an ext2 loopback file on this device, and boot with home=$MYHOMEDEVICE/grml.img."
- fi
- ;;
- esac
-
- if mount -o remount,rw "$MYHOMEMOUNTPOINT"; then
- einfo "Mounting ${WHITE}$MYHOMEDIR${NORMAL} as ${WHITE}/home/grml${NORMAL}."
- if [ -f "$MYHOMEDIR" ]; then
- # It's a loopback file, mount it over the /home/grml directory
- trymount "$MYHOMEDIR" /home/grml
- RC="$?"
- [ "$RC" = "0" ] && ERROR="$(mount -o remount,rw /home/grml 2>&1)"
- RC="$?"
- else
- # Do a --bind mount
- ERROR="$(mount --bind "$MYHOMEDIR" /home/grml 2>&1)"
- RC="$?"
- fi # -f $MYHOMEDIR
-
- [ "$RC" = "0" ] && eend 0 || ( eerror "${ERROR}" ; eend 1 )
-
- fi # mount -o remount,rw,...
- break
- ;;
- esac # case "$mountpoint" in *$MYHOMEMOUNTPOINT*)
- done <<EOT
- $(cat /proc/mounts)
-EOT
- fi # if trymount ...
- fi # -n $MYHOMEDIR
-fi # checkbootparam home
-}
-# }}}
-
-# {{{ Check for scripts on CD-ROM
-config_cdrom_scripts(){
-if checkbootparam "script"; then
- for script in /cdrom/scripts/* ; do
- einfo " grml script found on CD, executing ${WHITE}${script}${NORMAL}."
- . $script
- done
-fi
-}
-# }}}
-
-# {{{ Sound
-config_mixer(){
-if ! [ -x /usr/bin/aumix ] ; then
- eerror "aumix binary not available. Can not set sound volumes therefore." ; eend 1
-else
-
- if checkbootparam vol ; then
- VOL="$(getbootparam 'vol' 2>>$DEBUG)"
- if [ -z "$VOL" ] ; then
- eerror "Bootoption vol found but no volume level/parameter given. Using defaults." ; eend 1
- VOL='75' # default
- fi
- else
- VOL='75' # default
- fi
-
- if checkbootparam nosound ; then
- einfo "Muting sound devices on request."
- # some IBM notebooks require the following stuff:
- if [ -x /usr/bin/amixer ] ; then
- if amixer get Front 1>/dev/null 2>>$DEBUG ; then
- amixer set Front unmute 1>/dev/null
- amixer set Front 0% 1>/dev/null
- fi
- fi
- ERROR=$(aumix -w 0 -v 0 -p 0 -m 0 2>&1) ; RC=$?
- if [ -n "$ERROR" ] ; then
- eindent
- eerror "Problem muting sound devices: $ERROR"
- eoutdent
- fi
- eend $RC
- elif [ -z "$INSTALLED" ]; then
- einfo "Setting mixer volumes to level ${WHITE}${VOL}${NORMAL}."
- # some IBM notebooks require the following stuff:
- if [ -x /usr/bin/amixer ] ; then
- if amixer get Front 1>/dev/null 2>>$DEBUG ; then
- amixer set Front unmute 1>/dev/null
- amixer set Front ${VOL}% 1>/dev/null
- fi