Support tohd=... bootoption v0.8.16
authorMichael Prokop <mika@grml.org>
Sat, 15 Nov 2008 12:21:55 +0000 (13:21 +0100)
committerMichael Prokop <mika@grml.org>
Sat, 15 Nov 2008 12:21:55 +0000 (13:21 +0100)
autoconfig
autoconfig.functions
autoconfig.small
debian/changelog
grml-autoconfig

index bef518a..2721a5e 100644 (file)
@@ -107,6 +107,7 @@ CONFIG_SWSPEAK='yes'          # run software synthesizer via speakup
 CONFIG_TESTCD='yes'           # CD checker
 CONFIG_TIME='yes'             # set clock, check for bootparam utc/gmt [only in live-mode]
 CONFIG_TIMEZONE='yes'         # get bootparam 'tz' and set it as /etc/localtime [only in live-mode]
+CONFIG_TOHD='yes'             # bootoption tohd=...
 CONFIG_USERFSTAB='yes'        # check for username of uid 1000
 CONFIG_VMWARE='yes'           # vmware specific stuff (use xorg.conf.vmware)
 CONFIG_WELCOME='yes'          # play welcome sound (audio)
index 921be17..28b7854 100755 (executable)
@@ -2319,6 +2319,47 @@ fi
 }
 # }}}
 
+# {{{ tohd= bootoption
+config_tohd()
+{
+  if checkbootparam "tohd" ; then
+     local TARGET="$(getbootparam 'tohd' 2>>$DEBUG)"
+     if [ -z "$TARGET" ] ; then
+        eerror "Error: tohd specified without any partition, can not continue." ; eend 1
+        eerror "Please use something like tohd=/dev/sda9." ; eend 1
+        return 1
+     fi
+
+     if ! [ -b "$TARGET" ] ; then
+        eerror "Error: $TARGET is not a valid block device, sorry." ; eend 1
+        return 1
+     fi
+
+     if grep -q $TARGET /proc/mounts ; then
+       eerror "$TARGET already mounted, skipping execution of tohd therefore."
+       eend 1
+       return 1
+     fi
+
+     local MOUNTDIR=$(mktemp -d)
+
+     if mount -o rw "$TARGET" "$MOUNTDIR" ; then
+        einfo "Copyring live system to $TARGET - this might take a while"
+        rsync -a --progress /live/image/live $MOUNTDIR
+       sync
+       umount "$MOUNTDIR"
+        eend $?
+       einfo "Booting with \"grml bootfrom=$TARGET\" should work now." ; eend 0
+     else
+        eerror "Error when trying to mount $TARGET, sorry."; eend 1
+        return 1
+     fi
+
+     rmdir "$MOUNTDIR"
+  fi
+}
+# }}}
+
 # {{{ grml2hd: automatic installation
 config_grml2hd(){
 
index 65d589c..176b1ae 100644 (file)
@@ -107,6 +107,7 @@ CONFIG_SWSPEAK='no'           # run software synthesizer via speakup
 CONFIG_TESTCD='yes'           # CD checker
 CONFIG_TIME='yes'             # set clock, check for bootparam utc/gmt [only in live-mode]
 CONFIG_TIMEZONE='yes'         # get bootparam 'tz' and set it as /etc/localtime [only in live-mode]
+CONFIG_TOHD='yes'             # bootoption tohd=...
 CONFIG_USERFSTAB='yes'        # check for username of uid 1000
 CONFIG_VMWARE='no'            # vmware specific stuff (use xorg.conf.vmware)
 CONFIG_WELCOME='yes'          # play welcome sound (audio)
index fe39ff4..1c6d9d6 100644 (file)
@@ -1,3 +1,9 @@
+grml-autoconfig (0.8.16) unstable; urgency=low
+
+  * Support tohd=... bootoption.
+
+ -- Michael Prokop <mika@grml.org>  Sat, 15 Nov 2008 13:20:22 +0100
+
 grml-autoconfig (0.8.15) unstable; urgency=low
 
   * Use us instead of en-utf8 as default locale (this is what we
index 92dd414..efe0061 100755 (executable)
@@ -276,6 +276,8 @@ if [ -n "$SPLASH" ] ; then
    chvt 1
 fi
 
+checkvalue $CONFIG_TOHD && config_tohd
+
 checkvalue $CONFIG_GRML2HD && config_grml2hd
 
 checkvalue $CONFIG_DEBOOTSTRAP && config_debootstrap