#!/bin/bash . samizdat-paths.sh linux_kernel_commandline='boot=samizdat components quiet nbdroot=192.168.10.1/samizdat.btrfs nbddev=/dev/nbd0 ip=dhcp' grub_config() { cat </dev/null || true mkdir -p "${destdir}"/grub/i386-pc/ cp -r /usr/lib/grub/i386-pc/* "${destdir}"/grub/i386-pc/ rm "${destdir}"/grub/i386-pc/*.img || true grub_config > "${destdir}"/load_cfg grub-mkimage -O i386-pc -d /usr/lib/grub/i386-pc/ -o "${destdir}"/core.img -c "${destdir}"/load_cfg --prefix=/grub iso9660 biosdisk cat /usr/lib/grub/i386-pc/cdboot.img "${destdir}"/core.img > "${destdir}"/grub/i386-pc/eltorito.img cat /usr/lib/grub/i386-pc/boot.img "${destdir}"/core.img > "${destdir}"/embedded.img rm -r "$real_destdir" 2>/dev/null || true mv -T "$destdir" "$real_destdir"