From: Michael Prokop Date: Sat, 24 Oct 2009 00:48:20 +0000 (+0200) Subject: Adjust grub handling and support INSTALL_NOTES X-Git-Tag: v0.31~4 X-Git-Url: https://git.grml.org/?p=grml-debootstrap.git;a=commitdiff_plain;h=d7a46c09d601e1993dc8a383da309c3fa0775ba6;hp=a3c10e584dd26528ca76e201ab8a0e6b061db3ac Adjust grub handling and support INSTALL_NOTES --- diff --git a/chroot-script b/chroot-script index 7a26927..ab1dc90 100755 --- a/chroot-script +++ b/chroot-script @@ -417,6 +417,7 @@ grub() { fi $UPDATEGRUB -y + # grub1: if [ -f /boot/grub/menu.lst ] ; then sed -i "s/^# groot=.*/# groot=(${GROOT})/g" /boot/grub/menu.lst case "$TARGET" in @@ -437,6 +438,62 @@ grub() { sed -i "s/^savedefault.*/# &/g" /boot/grub/menu.lst $UPDATEGRUB -y fi + + # grub2: + if [ -f /etc/default/grub ] ; then + # create a copy of the original: + cp /etc/default/grub /etc/default/grub.orig + + case "$TARGET" in + # do NOT use uuid with SW-RAID + /dev/md*) + GRUB_CMDLINE="root=${TARGET} ro ${BOOT_APPEND}" + ;; + *) + if [ -n "$TARGET_UUID" ] ; then + GRUB_CMDLINE="root=UUID=${TARGET_UUID} ro ${BOOT_APPEND}" + else + GRUB_CMDLINE="root=${TARGET} ro ${BOOT_APPEND}" + fi + ;; + esac + + cat > /etc/default/grub << EOF + # Note: this file has been generated by chroot-script of grml-debootstrap. + # This configuration file is a workaround being necessary as the device.map + # generated by the live system might not correspond with your harddisk + # installation. + # + # Please restore the original Debian configuration executing the following + # commands when running your harddisk installation: + # + # grub-mkdevicemap + # mv /etc/default/grub.orig /etc/default/grub + # update-grub + # +GRUB_DEFAULT=0 +GRUB_TIMEOUT=5 +GRUB_DISTRIBUTOR=Debian +GRUB_DISABLE_LINUX_UUID=true +GRUB_CMDLLINE_LINUX="$GRUB_CMDLINE" +EOF + + [ -n "$INSTALL_NOTES" ] && echo " + +The grub2 configuration has been adjusted so you should +be able to boot into your Debian installation now. +After rebooting into your Debian installation please execute: + + grub-mkdevicemap + mv /etc/default/grub.orig /etc/default/grub + update-grub + +to finalise configuration. This instructions are available +in the header of /etc/default/grub as well. +" >> $INSTALL_NOTES + + $UPDATEGRUB -y + fi fi } # }}} diff --git a/config b/config index eab9188..ae40677 100644 --- a/config +++ b/config @@ -164,4 +164,8 @@ TIMEZONE='Europe/Vienna' # generate initrd via update-initramfs? INITRD='yes' +# this file contains information that has been caught during +# installation and will be displayed at the end of the installation +INSTALL_NOTES='/etc/debootstrap/install_notes' + ## END OF FILE ################################################################# diff --git a/debian/changelog b/debian/changelog index c01cab4..381c4ed 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,10 +1,12 @@ grml-debootstrap (0.31) unstable; urgency=low - * Adjust grubdevice() handling and install grub-pc package for + * Adjust grub handling and install grub-pc package for supporting grub2. [Closes: issue747] * Use cdn.debian.net as default mirror. + * Support config variable INSTALL_NOTES to catch information during + installation which is reported at the end of the installation process. - -- Michael Prokop Sat, 24 Oct 2009 02:05:26 +0200 + -- Michael Prokop Sat, 24 Oct 2009 02:47:00 +0200 grml-debootstrap (0.30) unstable; urgency=low diff --git a/grml-debootstrap b/grml-debootstrap index dbf9759..b59784f 100755 --- a/grml-debootstrap +++ b/grml-debootstrap @@ -356,7 +356,7 @@ grubdevice() { if which grub >/dev/null 2>&1 ; then echo 'quit' | grub --device-map="$device_map" >/dev/null 2>&1 elif which grub-mkdevicemap >/dev/null 2>&1 ; then - grub-mkdevicemap --device-map="$device_map" >/dev/null 2>&1 + grub-mkdevicemap --no-floppy --device-map="$device_map" >/dev/null 2>&1 else echo "Error: neither grub nor grub-mkdevicemap command found." >&2 return 1 @@ -804,18 +804,19 @@ preparechroot() { touch $CHROOT_VARIABLES chmod 600 $CHROOT_VARIABLES # make sure nobody except root can read it echo "# Configuration of ${PN}" > $CHROOT_VARIABLES - [ -n "$ARCH" ] && echo "ARCH=$ARCH" >> $CHROOT_VARIABLES - [ -n "$GROOT" ] && echo "GROOT=$GROOT" >> $CHROOT_VARIABLES - [ -n "$GRUB" ] && echo "GRUB=$GRUB" >> $CHROOT_VARIABLES - [ -n "$HOSTNAME" ] && echo "HOSTNAME=$HOSTNAME" >> $CHROOT_VARIABLES - [ -n "$ISODIR" ] && echo "ISODIR=$ISO" >> $CHROOT_VARIABLES - [ -n "$ISO" ] && echo "ISO=$ISO" >> $CHROOT_VARIABLES - [ -n "$MIRROR" ] && echo "MIRROR=$MIRROR" >> $CHROOT_VARIABLES + [ -n "$ARCH" ] && echo "ARCH=$ARCH" >> $CHROOT_VARIABLES + [ -n "$GROOT" ] && echo "GROOT=$GROOT" >> $CHROOT_VARIABLES + [ -n "$GRUB" ] && echo "GRUB=$GRUB" >> $CHROOT_VARIABLES + [ -n "$HOSTNAME" ] && echo "HOSTNAME=$HOSTNAME" >> $CHROOT_VARIABLES + [ -n "$INSTALL_NOTES" ] && echo "INSTALL_NOTES=$INSTALL_NOTES" >> $CHROOT_VARIABLES + [ -n "$ISODIR" ] && echo "ISODIR=$ISO" >> $CHROOT_VARIABLES + [ -n "$ISO" ] && echo "ISO=$ISO" >> $CHROOT_VARIABLES + [ -n "$MIRROR" ] && echo "MIRROR=$MIRROR" >> $CHROOT_VARIABLES [ -n "$KEEP_SRC_LIST" ] && echo "KEEP_SRC_LIST=$KEEP_SRC_LIST" >> $CHROOT_VARIABLES - [ -n "$PACKAGES" ] && echo "PACKAGES=$PACKAGES" >> $CHROOT_VARIABLES - [ -n "$ROOTPASSWORD" ] && echo "ROOTPASSWORD=$ROOTPASSWORD" >> $CHROOT_VARIABLES - [ -n "$TARGET" ] && echo "TARGET=$TARGET" >> $CHROOT_VARIABLES - [ -n "$TARGET_UUID" ] && echo "TARGET_UUID=$TARGET_UUID" >> $CHROOT_VARIABLES + [ -n "$PACKAGES" ] && echo "PACKAGES=$PACKAGES" >> $CHROOT_VARIABLES + [ -n "$ROOTPASSWORD" ] && echo "ROOTPASSWORD=$ROOTPASSWORD" >> $CHROOT_VARIABLES + [ -n "$TARGET" ] && echo "TARGET=$TARGET" >> $CHROOT_VARIABLES + [ -n "$TARGET_UUID" ] && echo "TARGET_UUID=$TARGET_UUID" >> $CHROOT_VARIABLES cp $VERBOSE $CONFFILES/chroot-script $MNTPOINT/bin/chroot-script chmod 755 $MNTPOINT/bin/chroot-script @@ -829,6 +830,11 @@ preparechroot() { sed -i "s#GRUB=.*#GRUB=\"$GRUB\"#" $MNTPOINT/etc/debootstrap/config sed -i "s#GROOT=.*#GROOT=\"$GROOT\"#" $MNTPOINT/etc/debootstrap/config + # install notes: + if [ -n "$INSTALL_NOTES" ] ; then + [ -r "$INSTALL_NOTES" ] && cp "$INSTALL_NOTES" $MNTPOINT/etc/debootstrap/ + fi + # package selection: cp $VERBOSE ${_opt_packages:-$CONFFILES/packages} \ $MNTPOINT/etc/debootstrap/packages @@ -991,6 +997,12 @@ if echo "$MNTPOINT" | grep -q '/mnt/debootstrap\.' ; then fi # }}} +# display installation notes {{{ +if [ -n "$INSTALL_NOTES" ] ; then + [ -r "$INSTALL_NOTES" ] && cat "$INSTALL_NOTES" +fi +# }}} + # end dialog of autoinstallation {{{ if [ -n "$AUTOINSTALL" ] ; then dialog --title "$PN" --msgbox \