X-Git-Url: https://git.grml.org/?p=grml-debootstrap.git;a=blobdiff_plain;f=packer%2Fdebian64_provision.sh;h=2a416defa9992e6255cfc7ccd7258f3c746433f6;hp=eff15d18ac3e50a2e2fb72bab53a8ca564fa3666;hb=3314417c2d2dc914523186434b3352637ef7ea12;hpb=5e6671f26a3518388b7320d9dfcbbeefc281a082 diff --git a/packer/debian64_provision.sh b/packer/debian64_provision.sh index eff15d1..2a416de 100644 --- a/packer/debian64_provision.sh +++ b/packer/debian64_provision.sh @@ -67,7 +67,13 @@ virtualbox_setup() { mountpoint "${TARGET}/media/cdrom" >/dev/null && umount "${TARGET}/media/cdrom" mount -t iso9660 $isofile "${TARGET}/media/cdrom/" UTS_RELEASE=$KERNELVERSION LD_PRELOAD=/tmp/fake-uname.so grml-chroot "$TARGET" /media/cdrom/VBoxLinuxAdditions.run --nox11 || true - tail -10 "${TARGET}/var/log/VBoxGuestAdditions.log" + if grep -q "make: .*vboxguest.*Error 2" "${TARGET}/var/log/vboxadd-install.log" ; then + echo "Error: looks like a fatal error happened during installation of VirtualBox Guest Additions." >&2 + exit 1 + fi + [ -r "${TARGET}/var/log/VBoxGuestAdditions.log" ] && tail -10 "${TARGET}/var/log/VBoxGuestAdditions.log" + [ -r "${TARGET}/var/log/vboxadd-install.log" ] && tail -10 "${TARGET}/var/log/vboxadd-install.log" + [ -r "${TARGET}/var/log/vboxadd-setup.log" ] && tail -10 "${TARGET}/var/log/vboxadd-setup.log" umount "${TARGET}/media/cdrom/" # work around bug in VirtualBox 4.3.18 which leaves process behind, @@ -225,6 +231,29 @@ grml_debootstrap_execution() { $GRML_DEBOOTSTRAP --hostname "${DEBIAN_VERSION}" --release "${DEBIAN_VERSION}" --target "${INSTALL_TARGET}" --grub "${GRUB_TARGET}" --password grml --force $GRML_DEB_OPTIONS 2>&1 | tee -a /tmp/grml-debootstrap.log } +apply_nic_workaround() { + # release specific stuff + case "$DEBIAN_VERSION" in + stretch|buster|bullseye|unstable|sid) + ;; + *) + echo "* Debian $DEBIAN_VERSION doesn't require NIC workaround" + return 0 + ;; + esac + + if ! mountpoint "${TARGET}" &>/dev/null ; then + echo "* Mounting target system" + mount "${INSTALL_TARGET}" "${TARGET}" + fi + + echo "* Disabling predictable network interface names for Debian $DEBIAN_VERSION" + ln -s /dev/null "${TARGET}/etc/udev/rules.d/80-net-setup-link.rules" + + echo "* Rebuilding initramfs to include udev configuration change" + chroot "${TARGET}" update-initramfs -u -k all +} + log_system_information() { if ! mountpoint "${TARGET}" &>/dev/null ; then echo "* Mounting target system" @@ -290,6 +319,7 @@ grml_debootstrap_setup grml_debootstrap_execution virtualbox_setup vagrant_setup +apply_nic_workaround log_system_information clean_apt_files automated_tests