Support full automatic installation of Debian via grml-debootstrap
authorMichael Prokop <mika@grml.org>
Mon, 16 Apr 2007 17:34:29 +0000 (19:34 +0200)
committerMichael Prokop <mika@grml.org>
Mon, 16 Apr 2007 17:34:29 +0000 (19:34 +0200)
autoconfig
autoconfig.functions
autoconfig.small
debian/changelog
debian/control
grml-autoconfig

index 45f3d0d..fd02c67 100644 (file)
@@ -3,7 +3,7 @@
 # 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: Mit Apr 04 21:33:40 CEST 2007 [mika]
+# Latest change: Mon Apr 16 19:33:47 CEST 2007 [mika]
 ################################################################################
 
 ################################################################################
@@ -59,6 +59,7 @@ CONFIG_CDROM_PERM='yes'       # for burning on IDE-CD-Roms, k3b (and others) che
 CONFIG_CDROM_SCRIPTS='yes'    # run scripts from /cdrom/scripts
 CONFIG_CONSOLE='yes'          # activate mgetty when using console=... as bootparam
 CONFIG_CREATE_MNT_DIRS='no'   # create /mnt-directories
+CONFIG_DEBOOTSTRAP='yes'      # support automatic installation of Debian via grml-deboostrap
 CONFIG_DEBNET='yes'           # search for /etc/network/interfaces on partitions and set up network afterwards
 CONFIG_DEBS='yes'             # check for bootoption debs for installing .debs
 CONFIG_DEBUG='yes'            # activate start of shells during startup at several stages
index cf78d9d..7960772 100755 (executable)
@@ -4,7 +4,7 @@
 # Authors:       grml-team (grml.org), (c) Klaus Knopper <knopper@knopper.net>, (c) Michael Prokop <mika@grml.org>
 # Bug-Reports:   see http://grml.org/bugs/
 # License:       This file is licensed under the GPL v2.
-# Latest change: Son Apr 15 12:20:14 CEST 2007 [mika]
+# Latest change: Mon Apr 16 19:32:25 CEST 2007 [mika]
 ################################################################################
 
 # {{{ path, variables, signals, umask, zsh
@@ -1065,7 +1065,7 @@ if [ -z "$INSTALLED" ] ; then
           *) continue ;;
           # *) NONEFOUND='1'; continue ;;
         esac
-   
+
         # use a swapfile
         if [ -z "$NOSWAP" ] ; then
            mount -o "$MOUNTOPTS" -t $f $p $m 2>>$DEBUG || continue
@@ -1083,7 +1083,7 @@ if [ -z "$INSTALLED" ] ; then
            fi
            mount -o remount,ro $m 2>>$DEBUG && MOUNTED=1
         fi
-   
+
         # use a image as home
         IMAGE="$(/bin/ls -1d $m/[Gg][Rr][Mm][Ll].[Ii][Mm][Gg] 2>/dev/null)"
         if [ -z "$GRML_IMG" -a -n "$IMAGE" -a -f "$IMAGE" ]; then
@@ -1098,10 +1098,10 @@ if [ -z "$INSTALLED" ] ; then
            fi
         fi
         eend 0
-   
+
         # Umount, if not in use
         [ -n "$MOUNTED" ] && umount -r $m 2>/dev/null
-   
+
       done <<EOT
       $(cat /etc/fstab)
 EOT
 # {{{ grml2hd: automatic installation
 config_grml2hd(){
 
+if stringinstring "BOOT_IMAGE=grml2hd " "$CMDLINE" ; then
+
 if checkbootparam "user" ; then
-  NEWUSER=''
-  NEWUSER="$(getbootparam 'user' 2>>$DEBUG)"
-  sed -i "s/^NEWUSER=.*/NEWUSER=$NEWUSER/" /etc/grml2hd/config || export GRML2HD_FAIL=1
+   NEWUSER=''
+   NEWUSER="$(getbootparam 'user' 2>>$DEBUG)"
+   sed -i "s/^NEWUSER=.*/NEWUSER=$NEWUSER/" /etc/grml2hd/config || export GRML2HD_FAIL=1
 fi
 
 if checkbootparam "filesystem" ; then
-  FILESYSTEM=''
-  FILESYSTEM="$(getbootparam 'filesystem' 2>>$DEBUG)"
-  sed -i "s/^FILESYSTEM=.*/FILESYSTEM=$FILESYSTEM/" /etc/grml2hd/config || export GRML2HD_FAIL=1
+   FILESYSTEM=''
+   FILESYSTEM="$(getbootparam 'filesystem' 2>>$DEBUG)"
+   sed -i "s/^FILESYSTEM=.*/FILESYSTEM=$FILESYSTEM/" /etc/grml2hd/config || export GRML2HD_FAIL=1
 fi
 
 if checkbootparam "partition" ; then
-  PARTITION=''
-  PARTITION="$(getbootparam 'partition' 2>>$DEBUG)"
-  # notice: the following checks whether the given partition is available, if not the skip
-  # execution of grml2hd as it might result in data loss...
-  if [ -r $PARTITION ] ; then
-    sed -i "s#^PARTITION=.*#PARTITION=$PARTITION#" /etc/grml2hd/config || export GRML2HD_FAIL=1
-  else
-    ewarn "Partition $PARTITION does not exist. Skipping execution of grml2hd therefore." ; eend 1
-  fi
+   PARTITION=''
+   PARTITION="$(getbootparam 'partition' 2>>$DEBUG)"
+   # notice: the following checks whether the given partition is available, if not the skip
+   # execution of grml2hd as it might result in data loss...
+   if [ -r $PARTITION ] ; then
+      sed -i "s#^PARTITION=.*#PARTITION=$PARTITION#" /etc/grml2hd/config || export GRML2HD_FAIL=1
+   else
+      ewarn "Partition $PARTITION does not exist. Skipping execution of grml2hd therefore." ; eend 1
+   fi
 fi
 
 if checkbootparam "mbr" ; then
-  BOOT_PARTITION=''
-  BOOT_PARTITION="$(getbootparam 'mbr' 2>>$DEBUG)"
-  sed -i "s#^BOOT_PARTITION=.*#BOOT_PARTITION=$BOOT_PARTITION#" /etc/grml2hd/config || export GRML2HD_FAIL=1
+   BOOT_PARTITION=''
+   BOOT_PARTITION="$(getbootparam 'mbr' 2>>$DEBUG)"
+   sed -i "s#^BOOT_PARTITION=.*#BOOT_PARTITION=$BOOT_PARTITION#" /etc/grml2hd/config || export GRML2HD_FAIL=1
 fi
 
-if stringinstring "BOOT_IMAGE=grml2hd " "$CMDLINE" ; then
-  cat>|/usr/bin/grml2hd_noninteractive<<EOF
+cat>|/usr/bin/grml2hd_noninteractive<<EOF
 #!/bin/sh
 GRML2HD_NONINTERACTIVE='yes' grml2hd
 EOF
-  chmod 755 /usr/bin/grml2hd_noninteractive
-  einfo "Bootparameter grml2hd found. Running automatic installation via grml2hd using /etc/grml2hd/config." && eend 0
-  if [ -z "$GRML2HD_FAIL" ] ; then
-    screen /usr/bin/grml2hd_noninteractive ; einfo "Invoking a shell, just exit to continue booting..." ; /bin/zsh
-  else
-    ewarn "There was an error adjusting /etc/grml2hd/config. Skipping execution of grml2hd for security reasons." ; eend 1
+
+chmod 755 /usr/bin/grml2hd_noninteractive
+einfo "Bootoption grml2hd found. Running automatic installation via grml2hd using /etc/grml2hd/config." && eend 0
+if [ -z "$GRML2HD_FAIL" ] ; then
+   screen /usr/bin/grml2hd_noninteractive ; einfo "Invoking a shell, just exit to continue booting..." ; /bin/zsh
+else
+   ewarn "There was an error adjusting /etc/grml2hd/config. Skipping execution of grml2hd for security reasons." ; eend 1
+fi
+
+fi # if stringinstring "BOOT_IMAGE=grml2hd ...
+}
+# }}}
+
+# {{{ debootstrap: automatic installation
+config_debootstrap(){
+
+if stringinstring "BOOT_IMAGE=debian2hd " "$CMDLINE" ; then
+
+if ! [ -x /usr/sbin/grml-debootstrap ] ; then
+   eerror "Bootoption debian2hd found, but grml-debootstrap is not available." ; eend 1
+   eerror "Dropping you to a shell, just exit it to continue booting." ; eend 1
+   /bin/zsh
+fi
+
+if checkbootparam "partition" ; then
+  PARTITION=''
+  PARTITION="$(getbootparam 'partition' 2>>$DEBUG)"
+  # notice: the following checks whether the given partition is available, if not the skip
+  # execution of grml-debootstrap as it might result in data loss...
+  if ! [ -r $PARTITION ] ; then
+     ewarn "Partition $PARTITION does not exist. Skipping execution of grml-debootstrap therefore." ; eend 1
   fi
 fi
+
+if checkbootparam "grub" ; then
+  GRUB=''
+  GRUB="$(getbootparam 'grub' 2>>$DEBUG)"
+fi
+
+if checkbootparam "groot" ; then
+  GROOT=''
+  GROOT="$(getbootparam 'groot' 2>>$DEBUG)"
+fi
+
+if checkbootparam "release" ; then
+  RELEASE=''
+  RELEASE="$(getbootparam 'release' 2>>$DEBUG)"
+fi
+
+if checkbootparam "mirror" ; then
+  MIRROR=''
+  MIRROR="$(getbootparam 'mirror' 2>>$DEBUG)"
+fi
+
+if checkbootparam "password" ; then
+  PASSWORD=''
+  PASSWORD="$(getbootparam 'password' 2>>$DEBUG)"
+fi
+
+# now check which options are available
+if [ -n "PARTITION" ] ; then
+   PARTITIONCMD="--target $PARTITION"
+else
+   PARTITIONCMD=''
+   ewarn "Partion not set via bootoption. Skipping execution of grml-debootstrap therefore."; eend 1
+fi
+[ -n "$GRUB" ]     && GRUBCMD="--grub $GRUB"               || GRUBCMD=''
+[ -n "$GROOT" ]    && GROOTCMD="--groot $GROOT"            || GROOTCMD=''
+[ -n "$RELEASE" ]  && RELEASECMD="--release $RELEASE"      || RELEASECMD=''
+[ -n "$MIRROR" ]   && MIRRORCMD="--mirror $MIRROR"         || MIRRORCMD=''
+[ -n "$PASSWORD" ] && PASSWORDCMD="--password $PASSWORD" ] || PASSWORDCMD=''
+
+# and finally write script and execute it
+cat>|/usr/bin/grml-debootstrap_noninteractive<<EOF
+#!/bin/sh
+AUTOINSTALL='yes' grml-debootstrap $PARTITIONCMD $GRUBCMD $GROOTCMD $RELEASECMD $MIRRORCMD $PASSWORDCMD
+EOF
+
+chmod 750  /usr/bin/grml-debootstrap_noninteractive
+einfo "Bootoption debian2hd found. Running automatic installation via grml-debootstrap." && eend 0
+
+screen /usr/bin/grml-debootstrap_noninteractive ; einfo "Invoking a shell, just exit to continue booting..." ; /bin/zsh
+
+fi # stringinstring "BOOT_IMAGE=debian2hd
 }
 # }}}
 
index 7877c39..0ae1dbe 100644 (file)
@@ -3,7 +3,7 @@
 # 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: Mit Apr 04 21:33:42 CEST 2007 [mika]
+# Latest change: Mon Apr 16 19:33:45 CEST 2007 [mika]
 ################################################################################
 
 ################################################################################
@@ -59,6 +59,7 @@ CONFIG_CDROM_PERM='yes'       # for burning on IDE-CD-Roms, k3b (and others) che
 CONFIG_CDROM_SCRIPTS='yes'    # run scripts from /cdrom/scripts
 CONFIG_CONSOLE='yes'          # activate mgetty when using console=... as bootparam
 CONFIG_CREATE_MNT_DIRS='no'   # create /mnt-directories
+CONFIG_DEBOOTSTRAP='yes'      # support automatic installation of Debian via grml-deboostrap
 CONFIG_DEBNET='yes'           # search for /etc/network/interfaces on partitions and set up network afterwards
 CONFIG_DEBS='yes'             # check for bootoption debs for installing .debs
 CONFIG_DEBUG='yes'            # activate start of shells during startup at several stages
index 494a018..7113af1 100644 (file)
@@ -1,3 +1,10 @@
+grml-autoconfig (0.6.37) unstable; urgency=low
+
+  * Support full automatic installation of Debian via grml-debootstrap
+    via config_debootstrap().
+
+ -- Michael Prokop <mika@grml.org>  Mon, 16 Apr 2007 19:27:13 +0200
+
 grml-autoconfig (0.6.36) unstable; urgency=low
 
   * Fix tty6-check, thanks for the code review - Matthias Lederhofer!
index 68b7b41..872f48d 100644 (file)
@@ -10,7 +10,7 @@ Package: grml-autoconfig
 Architecture: all
 Conflicts: grml-etc (<= 0.4-7)
 Depends: ${shlibs:Depends}, ${misc:Depends}, acpid | apmd, laptop-detect, hotplug | hotplug-light | udev (>= 0.080-1), zsh, gpm, syslog-ng, console-terminus, pump, grml-rebuildfstab (>= 0.3-1), grml-etc-core (>= 0.1-3), grml-scripts (>= 0.8-14), gawk, rungetty, rsync
-Recommends: hwinfo, alsa-utils, mdadm, powernowd, aumix, locales
+Recommends: hwinfo, alsa-utils, mdadm, powernowd, aumix, locales, grml2hd, grml-debootstrap (>= 0.8)
 Description: main bootup process of a grml system
  grml-autoconfig is the main part of the bootup process of the
  grml system. This includes the hardware recognition system.
index 433a8e0..c59dcc3 100755 (executable)
@@ -4,7 +4,7 @@
 # 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: Mit Apr 04 21:34:05 CEST 2007 [mika]
+# Latest change: Mon Apr 16 19:34:17 CEST 2007 [mika]
 ################################################################################
 
 # http://wiki.debian.org/LSBInitScripts =>
@@ -260,6 +260,8 @@ checkvalue $CONFIG_BLANKING && config_blanking
 
 checkvalue $CONFIG_GRML2HD && config_grml2hd
 
+checkvalue $CONFIG_DEBOOTSTRAP && config_debootstrap
+
 checkvalue $CONFIG_XSTARTUP && config_x_startup
 # }}}