fix bug: /grml.sh and /config.tbz on a GRMLCFG file system need to be processed witho...
[grml-autoconfig.git] / grml-autoconfig
index f663cd5..b5556d1 100755 (executable)
@@ -4,7 +4,6 @@
 # Authors:       grml-team (grml.org), (c) Michael Prokop <mika@grml.org>
 # Bug-Reports:   see http://grml.org/bugs/
 # License:       This file is licensed under the GPL v2.
-# Latest change: Fre Aug 04 12:13:13 CEST 2006 [mika]
 ################################################################################
 
 # http://wiki.debian.org/LSBInitScripts =>
@@ -17,6 +16,7 @@
 # Default-Stop:
 ### END INIT INFO
 
+# {{{ placeholder functions for restart/reload/stop
 if [[ $1 == "restart" ]] ; then
   echo "$0 restart - empty placeholder. Doing nothing but running."
 fi
@@ -29,6 +29,7 @@ if [[ $1 == "stop" ]] ; then
   echo "$0 stop - empty placeholder. Doing nothing but exiting."
   exit 1
 fi
+# }}}
 
 # {{{ path, signals, umask, zsh, colors
 export PATH="/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin"
@@ -43,7 +44,7 @@ setopt no_nomatch # avoid 'no matches found: ...'
 # {{{ source main files
 source /etc/grml/autoconfig            # configuration file
 source /etc/grml/autoconfig.functions  # functions
-source /etc/grml/lsb-functions
+source /etc/grml/lsb-functions         # helper functions for smart display
 # }}}
 
 # {{{ mount important directories
@@ -52,42 +53,47 @@ mount_pts
 mount_sys
 # }}}
 
-# {{{ Read in boot parameters
-CMDLINE="$(cat /proc/cmdline)"
-[ -d /cdrom/bootparams/ ] && CMDLINE="$CMDLINE $(cat /cdrom/bootparams/* | tr '\n' ' ')"
-# }}}
-
 # {{{ main grml-autoconfig
 checkvalue $CONFIG_DEBUG && config_debug
 
 SPLASH=''
-if checkbootparam "splash" ; then
-  SPLASH=1
+if checkbootparam 'textsplash' || checkbootparam 'tsplash'; then
+   SPLASH=1
+fi
+
+# update /etc/mtab if running in live-initramfs mode:
+if [ -z "$INSTALLED" -a -e /live/cow ] ; then
+   if ! grep -q rootfs /etc/mtab ; then
+      for i in rootfs "none /sys sysfs" proc /live/image /live/cow /lib/init/rw /dev/shm /dev/pts ; do
+          grep $i /proc/mounts | grep -v /dev/.static >> /etc/mtab
+      done
+   fi
 fi
 
 if [ -z "$SPLASH" ] ; then
-  stage=5
-  rundebugshell
+   stage=5
+   rundebugshell
 fi
 
 if [ -z "$BOOTDEBUG" ] ; then
-  einfo "Setting kernel ring buffer to level 2."
-  echo "2" > /proc/sys/kernel/printk ; eend $?
+   einfo "Setting kernel ring buffer to level 2."
+   echo "2" > /proc/sys/kernel/printk ; eend $?
 else
-  einfo "Setting kernel ring buffer to level 6. Adjust manually via running dmesg -n \$VALUE."
-  echo "6" > /proc/sys/kernel/printk ; eend $?
+   einfo "Setting kernel ring buffer to level 6. Adjust manually via running dmesg -n \$VALUE."
+   echo "6" > /proc/sys/kernel/printk ; eend $?
 fi
 
-if checkbootparam "forensic" ; then
-   eerror "Bootopion forensic found. Important notice!"
-   eerror " Do *not* boot with something like 'grml forensic ...' but with 'forensic ...' instead!"
-   eerror " To avoid damage to your system a debugshell will be started after a delay of 10 seconds." ; eend 1
-   eerror " If you want to continue booting just exit the shell, but think about what you are doing!" ; eend 1
-   sleep 10
-   rundebugshell
+checkvalue $CONFIG_SYSLOG && config_syslog
+
+if checkbootparam 'forensic' ; then
+   ewarn "Bootopion forensic found. Important notice:" ; eend 0
+   ewarn " Do *NOT* boot with something like 'grml forensic ...' but always use 'forensic ...' instead!" ; eend 0
 fi
 
-[ -n "$SPLASH" ] && /usr/bin/grml-bootsplash "|">/dev/tty7
+if [ -n "$SPLASH" ] ; then
+   /usr/bin/grml-bootsplash "|">/dev/tty14
+   chvt 14
+fi
 
 checkvalue $CONFIG_LANGUAGE && config_language
 
@@ -95,11 +101,13 @@ checkvalue $CONFIG_LOG && config_log
 
 checkvalue $CONFIG_SWSPEAK && config_swspeak
 
+checkvalue $CONFIG_HWSPEAK && config_hwspeak
+
 checkvalue $CONFIG_FWTIMEOUT && config_fwtimeout
 
 checkvalue $CONFIG_FIX_PASSWD && config_fix_passwd
 
-[ -n "$SPLASH" ] && /usr/bin/grml-bootsplash "||">/dev/tty7
+[ -n "$SPLASH" ] && /usr/bin/grml-bootsplash "||">/dev/tty14
 
 checkvalue $CONFIG_HOSTNAME && config_hostname
 
@@ -111,6 +119,8 @@ checkvalue $CONFIG_KERNEL &&  config_kernel
 
 checkvalue $CONFIG_VMWARE &&  config_vmware
 
+checkvalue $CONFIG_QEMU && config_qemu
+
 checkvalue $CONFIG_SMALL && config_small
 
 checkvalue $CONFIG_LD_MOD && config_ld_mod
@@ -119,12 +129,14 @@ checkvalue $CONFIG_TIMEZONE && config_timezone
 
 checkvalue $CONFIG_FAST && config_fast
 
-[ -n "$SPLASH" ] && /usr/bin/grml-bootsplash "|||">/dev/tty7
+[ -n "$SPLASH" ] && /usr/bin/grml-bootsplash "|||">/dev/tty14
 
 checkvalue $CONFIG_ENVIRONMENT && config_environment
 
 checkvalue $CONFIG_SWRAID && config_swraid
 
+checkvalue $CONFIG_LVM && config_lvm
+
 # No kernel messages while probing modules
 echo "0" > /proc/sys/kernel/printk
 
@@ -136,7 +148,7 @@ checkvalue $CONFIG_FIREWIRE_DEV && config_firewire_dev
 
 checkvalue $CONFIG_TESTCD && config_testcd
 
-[ -n "$SPLASH" ] && /usr/bin/grml-bootsplash "||||">/dev/tty7
+[ -n "$SPLASH" ] && /usr/bin/grml-bootsplash "||||">/dev/tty14
 
 checkvalue $CONFIG_DISCOVER && config_discover
 
@@ -152,17 +164,13 @@ checkvalue $CONFIG_MODULES && config_modules
 
 checkvalue $CONFIG_ACPI_APM && config_acpi_apm
 
-[ -n "$SPLASH" ] && /usr/bin/grml-bootsplash "|||||">/dev/tty7
+[ -n "$SPLASH" ] && /usr/bin/grml-bootsplash "|||||">/dev/tty14
 
 checkvalue $CONFIG_PCMCIA && config_pcmcia
 
-# {{{ Read in what hwsetup has found
-[ -f /etc/sysconfig/grml ] && . /etc/sysconfig/grml
-# }}}
-
 checkvalue $CONFIG_KEYBOARD && config_keyboard
 
-[ -n "$SPLASH" ] &&  /usr/bin/grml-bootsplash "||||||">/dev/tty7
+[ -n "$SPLASH" ] &&  /usr/bin/grml-bootsplash "||||||">/dev/tty14
 
 checkvalue $CONFIG_BLIND && config_blind
 
@@ -170,8 +178,6 @@ checkvalue $CONFIG_INTERACTIVE && config_interactive
 
 checkvalue $CONFIG_AGP && config_agp
 
-[ -f /etc/sysconfig/grml ] && . /etc/sysconfig/grml
-
 checkvalue $CONFIG_AUTOMOUNTER && config_automounter
 
 checkvalue $CONFIG_DMA && config_dma
@@ -182,9 +188,7 @@ checkvalue $CONFIG_MOUSE && config_mouse
 
 checkvalue $CONFIG_DHCP && config_dhcp
 
-[ -n "$SPLASH" ] && /usr/bin/grml-bootsplash "|||||||">/dev/tty7
-
-checkvalue $CONFIG_SYSLOG && config_syslog
+[ -n "$SPLASH" ] && /usr/bin/grml-bootsplash "|||||||">/dev/tty14
 
 checkvalue $CONFIG_CPU && config_cpu
 
@@ -196,13 +200,17 @@ checkvalue $CONFIG_EXTRACT  && config_extract
 
 checkvalue $CONFIG_HOMEDIR && config_homedir
 
-checkvalue $CONFIG_MYCONFIG && config_myconfig
+checkvalue $CONFIG_FINDDCSDIR && config_finddcsdir
 
 checkvalue $CONFIG_DEBS && config_debs
 
-[ -n "$SPLASH" ] && /usr/bin/grml-bootsplash "||||||||">/dev/tty7
+checkvalue $CONFIG_SCRIPTS && config_scripts
+
+checkvalue $CONFIG_CONFIG && config_config
 
-checkvalue $CONFIG_CDROM_SCRIPTS && config_cdrom_scripts
+checkvalue $CONFIG_PARTCONF && config_partconf
+
+[ -n "$SPLASH" ] && /usr/bin/grml-bootsplash "||||||||">/dev/tty14
 
 # device symlinks {{{
   [ -r /mnt/floppy ] || mkdir /mnt/floppy
@@ -218,17 +226,19 @@ checkvalue $CONFIG_WONDERSHAPER && config_wondershaper
 
 checkvalue $CONFIG_GPM && config_gpm
 
-[ -n "$SPLASH" ] && /usr/bin/grml-bootsplash "|||||||||">/dev/tty7
+[ -n "$SPLASH" ] && /usr/bin/grml-bootsplash "|||||||||">/dev/tty14
 
 checkvalue $CONFIG_SERVICES && config_services
 
 checkvalue $CONFIG_NETCONFIG && config_netconfig
 
+checkvalue $CONFIG_NETSCRIPT && config_netscript
+
 checkvalue $CONFIG_NETIPV6 && config_ipv6
 
 checkvalue $CONFIG_DEBNET && config_debnet
 
-[ -n "$SPLASH" ] && /usr/bin/grml-bootsplash "||||||||||">/dev/tty7
+[ -n "$SPLASH" ] && /usr/bin/grml-bootsplash "||||||||||">/dev/tty14
 
 checkvalue $CONFIG_CONSOLE && config_console
 
@@ -244,32 +254,47 @@ checkvalue $CONFIG_CREATE_MNT_DIRS && create_mnt_dirs
 
 checkvalue $CONFIG_915RESOLUTION && config_915resolution
 
-checkvalue $CONFIG_AUTOMOUNT && config_automount
+checkvalue $CONFIG_IPW3945 && config_ipw3945
+
+checkvalue $CONFIG_MYPATH && config_mypath
 
 checkvalue $CONFIG_DISTCC && config_distcc
 
+checkvalue $CONFIG_DISTRI && config_distri
+
 checkvalue $CONFIG_BLANKING && config_blanking
 
-[ -n "$SPLASH" ] && /usr/bin/grml-bootsplash "|||||||||||">/dev/tty7
+if [ -n "$SPLASH" ] ; then
+   /usr/bin/grml-bootsplash "|||||||||||">/dev/tty14
+   chvt 1
+fi
+
+checkvalue $CONFIG_TOHD && config_tohd
 
 checkvalue $CONFIG_GRML2HD && config_grml2hd
 
+checkvalue $CONFIG_DEBOOTSTRAP && config_debootstrap
+
 checkvalue $CONFIG_XSTARTUP && config_x_startup
 # }}}
 
 # {{{ debug
 if [ -z "$SPLASH" ] ; then
-  stage=6
-  rundebugshell
+   stage=6
+   rundebugshell
 fi
-# }}}
 
 if [ -n "$BOOTDEBUG" ] ; then
-  CMDLINE="$(cat /proc/cmdline)"
-  [ -d /cdrom/bootparams/ ] && CMDLINE="$CMDLINE $(cat /cdrom/bootparams/*)"
-  einfo "Bootoption debug detected. Printing kernel command line:"
-  echo "$CMDLINE"
+   # set only if not already set
+   if [ -z "$CMDLINE" ] ; then
+     CMDLINE="$(cat /proc/cmdline)"
+     [ -d /cdrom/bootparams/ ] && CMDLINE="$CMDLINE $(cat /cdrom/bootparams/*)"
+     [ -d /live/image/bootparams/ ] && CMDLINE="$CMDLINE $(cat /live/image/bootparams/*)"
+   fi
+   einfo "Bootoption debug detected. Printing kernel command line:"
+   echo "$CMDLINE"
 fi
+# }}}
 
 # {{{ Re-enable signals
 trap 2 3 11