- echo -n "${CYAN}Do you want to (re)configure your graphics (X11) subsystem?${NORMAL} [Y/n] "
- read a
- [ "$a" != "n" ] && xorgcfg -textmode ; eend $?
- echo " ${GREEN}Interactive configuration finished. Everything else should be fine for now.${NORMAL}"
-fi
-eend 0
-}
-# }}}
-
-# {{{ AGP
-config_agp(){
-if checkbootparam forceagp ; then
-# Probe for AGP. Hope this can fail safely
- stringinfile "AGP" "/proc/pci" 2>>$DEBUG && { modprobe agpgart || modprobe agpgart agp_try_unsupported=1; } >>$DEBUG 2>&1 && einfo "AGP bridge detected." ; eend 0
-fi
-}
-# }}}
-
-# {{{ 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"
- stringinfile "$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
- stringinfile "$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=""
-IDEDISKS=""
-while read major minor blocks partition relax; do
- partition="${partition##*/}"
- [ -z "$partition" -o ! -e "/dev/$partition" ] && continue
- case "$partition" in
- hd?) IDEDISKS="$IDEDISKS $partition";; # IDE Harddisk, entire disk
- sd?) ;; # SCSI Harddisk, entire disk
-# [hs]d*) partitions="$partitions /dev/$partition";; # IDE or SCSI disk partition
- [hs]d*|ub*) partitions="$partitions /dev/$partition";; # IDE, USB or SCSI disk partition
- esac
-done <<EOT
-$(awk 'BEGIN{old="__start"}{if($0==old){exit}else{old=$0;if($4&&$4!="name"){print $0}}}' /proc/partitions)
-EOT
-}
-check_partitions 1>/dev/null 2>&1 # avoid output "check_partitions:3: read-only file system"
-# }}}
-
-# {{{ Enable DMA for all IDE drives now if not disabled
-# Notice: Already done by linuxrc, but make sure it's done also on harddisk-installed systems
-config_dma(){
-if checkbootparam "nodma"; then
- ewarn "Skipping DMA accelleration as requested on boot commandline." ; eend 0
-else
- for d in $(cd /proc/ide 2>>$DEBUG && echo hd[a-z]); do
- if test -d /proc/ide/$d; then
- if egrep -q 'using_dma[ \t]+0' /proc/ide/$d/settings 2>>$DEBUG; then
- MODEL="$(cat /proc/ide/$d/model 2>>$DEBUG)"
- test -z "$MODEL" && MODEL="[GENERIC IDE DEVICE]"
- einfo "Enabling DMA acceleration for: ${WHITE}$d ${YELLOW}[${MODEL}]${NORMAL}"
- echo "using_dma:1" >/proc/ide/$d/settings
- eend 0
- fi
- fi
- done
-fi
-}
-# }}}
-
-# {{{ Start creating /etc/fstab with HD partitions and USB SCSI devices now
-config_fstab(){
-
-NOSWAP="yes" # we do not use swap by default!
-if checkbootparam "swap" -o checkbootparam "anyswap" ; then
- NOSWAP=''
-fi
-
-if checkbootparam "nofstab" -o checkbootparam "forensic" ; then
- ewarn "Skipping /etc/fstab creation as requested on boot commandline." ; eend 0
-else
- checkbootparam "anyswap" && export ANYSWAP='yes' || export ANYSWAP=""
- 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
- if [ -e /var/run/rebuildfstab.pid ]; then
- # Another instance of rebuildfstab, probably from hotplug, is still running, so just wait.
- sleep 8
- fi
-fi
-# Scan for swap, config, homedir
-if [ -z "$NOSWAP" ]; then
- einfo "Searching for swap partition(s) as requested."
-fi
-GRML_IMG=""
-GRML_SWP=""
-HOMEDIR="$(getbootparam home)"
-if [ -n "$partitions" ]; then
- while read p m f relax; do
- case "$p" in *fd0*|*proc*|*sys*|*\#*) continue;; esac
- partoptions="users,exec"
- fnew=""
- case "$f" in swap)
- eindent
- if [ -n "$NOSWAP" ]; then
- if [ -z "$INSTALLED" ] ; then
- ewarn "Ignoring swap partition ${WHITE}$p${NORMAL}. (Force usage via boot option 'swap', or execute grml-swapon)" ; eend 0
- fi
- else
- case "$(dd if=$p bs=1 count=6 skip=4086 2>/dev/null)" in
- S1SUSP|S2SUSP|pmdisk|[zZ]*)
- if [ -n "$ANYSWAP" ] ; then
- einfo "Using swap partition ${WHITE}${p}${NORMAL} [bootoption anyswap found]."
- swapon $p 2>>$DEBUG ; eend $?
- else
- ewarn "Suspend signature on ${WHITE}${p}${NORMAL} found, not using as swap. (Force usage via boot option: anyswap)"
- fi
- ;;
- *)
- if [[ "$p" == LABEL* ]] ; then
- p=$(blkid -t $p | awk -F: '{print $1}')
- fi
- if grep -q $p /proc/swaps ; then
- ewarn "Not using swap partition ${WHITE}${p}${NORMAL} as it is already in use." ; eend 0
- else
- einfo "Using swap partition ${WHITE}${p}${NORMAL}."
- swapon $p 2>>$DEBUG ; eend $?
- fi
- ;;
- esac
- fi
- eoutdent
- continue
- ;;
- esac
-# Create mountdir if not already present, but don't try to create stuff like /proc/bus/usb
-# Notice: grml-rebuildfstab >= 0.3-1 handles this now
-# case "$m" in *none*|*proc*|*sys*|'') continue ;; esac
-# [ -d "$m" ] || mkdir -p "$m"
-# WARNING: NTFS RW mounts are only safe since Kernel 2.6.11
- [ "$f" = "ntfs" -a "${KERNEL%.*}" != "2.6" ] && continue
- MOUNTOPTS="ro"
- case "$f" in
- vfat|msdos|ntfs) MOUNTOPTS="$MOUNTOPTS,uid=${fstabuser},gid=${fstabuser}" ;;
- ext2|ext3|reiserfs|jfs|reiser4|xfs) MOUNTOPTS="$MOUNTOPTS,noatime" ;;
- *) continue ;;
- # *) NONEFOUND='1'; continue ;;
- esac
- mount -o "$MOUNTOPTS" -t $f $p $m 2>>$DEBUG || continue
- # Activate swapfile, if exists
- SWAPFILE="$(/bin/ls -1d $m/[Gg][Rr][Mm][Ll].[Ss][Ww][Pp] 2>/dev/null)"
- if [ -z "$NOSWAP" -a -n "$SWAPFILE" -a -f "$SWAPFILE" ]; then
- mount -o remount,rw $m
- if swapon "$SWAPFILE" 2>>$DEBUG ; then
- einfo "Using GRML swapfile ${SWAPFILE}."
- fnew="$SWAPFILE swap swap defaults 0 0"
- stringinfile "$fnew" "/etc/fstab" || echo "$fnew" >> /etc/fstab
- GRML_SWP="$GRML_SWP $SWAPFILE"
- eend 0
- fi
- mount -o remount,ro $m 2>>$DEBUG
- fi
- IMAGE="$(/bin/ls -1d $m/[Gg][Rr][Mm][Ll].[Ii][Mm][Gg] 2>/dev/null)"
- if [ -z "$INSTALLED" -a -z "$GRML_IMG" -a -n "$IMAGE" -a -f "$IMAGE" ]; then
- if [ -n "$HOMEDIR" ]; then
- if [ "$HOMEDIR" != "scan" -a "$HOMEDIR" != "$IMAGE" -a "$HOMEDIR" != "${IMAGE%/*.*}" ]; then
- continue
- fi
- fi
- if type -a grml-image >/dev/null 2>&1 && grml-image "$IMAGE" </dev/console >/dev/console 2>&1; then
- GRML_IMG="$IMAGE"
- mount -o remount,ro $m 2>>$DEBUG
- fi
- fi
- eend 0
- # Umount, if not in use
- umount -r $m 2>/dev/null
- done <<EOT
-$(cat /etc/fstab)
-EOT
-fi