Warning!

Notice: the grml team is migrating from Mercurial to Git.
Please visit git.grml.org instead!

Support full automatic installation of Debian via grml-debootstrap
authorMichael Prokop <mika@grml.org>
Mon Apr 16 19:34:29 2007 +0200 (19 months ago)
changeset 107ba37da30a492
manifestba37da30a492
parent 10603d3868e8421
child 10826cc28b6fddb
Support full automatic installation of Debian via grml-debootstrap
autoconfig
autoconfig.functions
autoconfig.small
debian/changelog
debian/control
grml-autoconfig
--- a/autoconfig Sun Apr 15 13:47:47 2007 +0200
+++ b/autoconfig Mon Apr 16 19:34:29 2007 +0200
@@ -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_SCRIPTS='yes' # run scri
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
--- a/autoconfig.functions Sun Apr 15 13:47:47 2007 +0200
+++ b/autoconfig.functions Mon Apr 16 19:34:29 2007 +0200
@@ -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
@@ -2096,49 +2096,126 @@ fi
# {{{ 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
+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
+fi
+
+cat>|/usr/bin/grml2hd_noninteractive<<EOF
+#!/bin/sh
+GRML2HD_NONINTERACTIVE='yes' grml2hd
+EOF
+
+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 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
-fi
-
-if stringinstring "BOOT_IMAGE=grml2hd " "$CMDLINE" ; then
- cat>|/usr/bin/grml2hd_noninteractive<<EOF
+ # 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
-GRML2HD_NONINTERACTIVE='yes' grml2hd
+AUTOINSTALL='yes' grml-debootstrap $PARTITIONCMD $GRUBCMD $GROOTCMD $RELEASECMD $MIRRORCMD $PASSWORDCMD
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
- fi
-fi
+
+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
}
# }}}
--- a/autoconfig.small Sun Apr 15 13:47:47 2007 +0200
+++ b/autoconfig.small Mon Apr 16 19:34:29 2007 +0200
@@ -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_SCRIPTS='yes' # run scri
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
--- a/debian/changelog Sun Apr 15 13:47:47 2007 +0200
+++ b/debian/changelog Mon Apr 16 19:34:29 2007 +0200
@@ -1,3 +1,10 @@ grml-autoconfig (0.6.36) unstable; urgen
+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!
--- a/debian/control Sun Apr 15 13:47:47 2007 +0200
+++ b/debian/control Mon Apr 16 19:34:29 2007 +0200
@@ -10,7 +10,7 @@ Architecture: all
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.
--- a/grml-autoconfig Sun Apr 15 13:47:47 2007 +0200
+++ b/grml-autoconfig Mon Apr 16 19:34:29 2007 +0200
@@ -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_bl
checkvalue $CONFIG_GRML2HD && config_grml2hd
+checkvalue $CONFIG_DEBOOTSTRAP && config_debootstrap
+
checkvalue $CONFIG_XSTARTUP && config_x_startup
# }}}