X-Git-Url: https://git.grml.org/?p=grml-autoconfig.git;a=blobdiff_plain;f=autoconfig.functions;h=28b785449f7f01146c21b595e6f4f18012b83ed8;hp=921be17b27b9faa83ad35510348e5457cae13cbc;hb=37eee4a042ff38046cb7594420a03af5067efa8d;hpb=025b317e1bc0d351d592482de5ac9824d5f1a767 diff --git a/autoconfig.functions b/autoconfig.functions index 921be17..28b7854 100755 --- a/autoconfig.functions +++ b/autoconfig.functions @@ -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(){