X-Git-Url: https://git.grml.org/?p=grml-debootstrap.git;a=blobdiff_plain;f=grml-debootstrap;h=cd259fc62f2fca507b6747f50f36ece26360c811;hp=a5c7ca62736d596281c3f944f601957c97fb4a8e;hb=ba9ff1fa9d44a2b64bfc885c7bd9117d9874ce56;hpb=18ee5ea33d13958474b566621d100eb7e4ff5fc4 diff --git a/grml-debootstrap b/grml-debootstrap index a5c7ca6..cd259fc 100755 --- a/grml-debootstrap +++ b/grml-debootstrap @@ -18,10 +18,12 @@ MNTPOINT="/mnt/debootstrap.$$" [ -n "$DEBCONF" ] || DEBCONF='yes' [ -n "$DEBIAN_FRONTEND" ] || DEBIAN_FRONTEND='noninteractive' [ -n "$DEBOOTSTRAP" ] || DEBOOTSTRAP='debootstrap' -[ -n "$DEFAULT_LOCALES" ] || DEFAULT_LOCALES='en_US.UTF-8' [ -n "$DEFAULT_LANGUAGE" ] || DEFAULT_LANGUAGE='en_US:en' +[ -n "$DEFAULT_LOCALES" ] || DEFAULT_LOCALES='en_US.UTF-8' +[ -n "$DISK_IDENTIFIER" ] || DISK_IDENTIFIER='26ada0c0-1165-4098-884d-aafd2220c2c6' [ -n "$EXTRAPACKAGES" ] || EXTRAPACKAGES='yes' [ -n "$FALLBACK_MIRROR" ] || FALLBACK_MIRROR='http://http.debian.net/debian' +[ -n "$FIXED_DISK_IDENTIFIERS" ] || FIXED_DISK_IDENTIFIERS="yes" [ -n "$FORCE" ] || FORCE='' [ -n "$HOSTNAME" ] || HOSTNAME='grml' [ -n "$INITRD" ] || INITRD='yes' @@ -41,7 +43,6 @@ MNTPOINT="/mnt/debootstrap.$$" [ -n "$TUNE2FS" ] || TUNE2FS='tune2fs -c0 -i0' [ -n "$UPGRADE_SYSTEM" ] || UPGRADE_SYSTEM='yes' [ -n "$VMSIZE" ] || VMSIZE="2G" -[ -n "$FIXED_DISK_IDENTIFIERS" ] || FIXED_DISK_IDENTIFIERS="no" # inside the chroot system locales might not be available, so use minimum: export LANG=C @@ -930,8 +931,8 @@ mkfs() { eend 1 bailout 1 else - einfo "Changing disk uuid for $TARGET to fixed (non-random) value using tune2fs" - tune2fs "$TARGET" -U 26ada0c0-1165-4098-884d-aafd2220c2c6 + einfo "Changing disk uuid for $TARGET to fixed (non-random) value $DISK_IDENTIFIER using tune2fs" + tune2fs "$TARGET" -U "$DISK_IDENTIFIER" eend $? fi fi @@ -1103,9 +1104,12 @@ finalize_vm() { umount "${MNTPOINT}"/dev einfo "Adjusting grub.cfg for successful boot sequence." - # ugly but needed to boot grub acordingly - sed -i "s;set root=.*;set root='(hd0,msdos1)';" "${MNTPOINT}"/boot/grub/grub.cfg - sed -i "s;root=[^ ]\+;root=/dev/sda1;" "${MNTPOINT}"/boot/grub/grub.cfg + if [ "$FIXED_DISK_IDENTIFIERS" = "yes" ]; then + sed -i "s;root=[^ ]\+;root=UUID=$DISK_IDENTIFIER;" /boot/grub/grub.cfg + else + sed -i "s;set root=.*;set root='(hd0,msdos1)';" "${MNTPOINT}"/boot/grub/grub.cfg + sed -i "s;root=[^ ]\+;root=/dev/sda1;" "${MNTPOINT}"/boot/grub/grub.cfg + fi umount "${MNTPOINT}" kpartx -d "${ORIG_TARGET}" >/dev/null