X-Git-Url: https://git.grml.org/?p=grml-debootstrap.git;a=blobdiff_plain;f=grml-debootstrap;h=bf97635472200a8a26b74a332006aec150ae2307;hp=653f16cf91c19e06ae31eb9fc3de7632d74b8f02;hb=d07cdbbc8d861f7b38eb31d3b10bf37f37bededb;hpb=4fae346b2e816b3d7f97ea9e42455f104db5adb6 diff --git a/grml-debootstrap b/grml-debootstrap index 653f16c..bf97635 100755 --- a/grml-debootstrap +++ b/grml-debootstrap @@ -11,7 +11,7 @@ set -e # exit on any error # variables {{{ PN="$(basename $0)" -VERSION='0.37' +VERSION='0.39' MNTPOINT="/mnt/debootstrap.$$" # inside the chroot system locales might not be available, so use minimum: @@ -409,11 +409,17 @@ for i in $(cat $TMPFILE) ; do NUM_PARTITIONS=$((${NUM_PARTITIONS}+1)) done +# force metadata version 0.90 for lenny so old grub can boot from this array. +METADATA_VERSION="" +if [ $RELEASE = "lenny" ]; then + METADATA_VERSION="-e0" +fi + ERRORFILE=$(mktemp) set +e # TODO: better error handling? yes | mdadm --create "${TARGET}" --level="${RAIDLEVEL}" \ - --raid-devices="${NUM_PARTITIONS}" ${SELECTED_PARTITIONS} >/dev/null 2>$ERRORFILE + --raid-devices="${NUM_PARTITIONS}" ${METADATA_VERSION} ${SELECTED_PARTITIONS} >/dev/null 2>$ERRORFILE RC=$? set -e @@ -522,14 +528,14 @@ interactive_mode() { welcome_dialog + prompt_for_release + prompt_for_swraid prompt_for_target prompt_for_bootmanager - prompt_for_release - prompt_for_hostname prompt_for_password @@ -644,7 +650,7 @@ bailout(){ [ -x "$MNTPOINT"/etc/init.d/ssh ] && "$MNTPOINT"/etc/init.d/ssh stop [ -x "$MNTPOINT"/etc/init.d/mdadm ] && "$MNTPOINT"/etc/init.d/mdadm stop # ugly, but make sure we really don't leave anything (/proc /proc is intended) - for ARG in /sys -a /proc /proc ; do + for ARG in /sys /proc /proc ; do [ -x "$MNTPOINT"/bin/umount ] && chroot "$MNTPOINT" umount $ARG >/dev/null 2>&1 || true done umount "$MNTPOINT"/dev >/dev/null 2>&1 || true @@ -707,7 +713,11 @@ mkfs() { # make sure /dev/disk/by-uuid/... is up2date, otherwise grub # will fail to detect the uuid in the chroot - blockdev --rereadpt "${TARGET%%[0-9]*}" + if echo "$TARGET" | grep -q "/dev/md" ; then + blockdev --rereadpt "${TARGET}" + else + blockdev --rereadpt "${TARGET%%[0-9]*}" + fi # give the system 2 seconds, otherwise we might run into # race conditions :-/ sleep 2