From a6a742628b560f9d5097008940547391831762c0 Mon Sep 17 00:00:00 2001 From: Guilhem Moulin Date: Fri, 24 Jan 2014 02:17:56 +0100 Subject: Enable generation of HDD images. This is only useful for older BIOSes, that don't support hybrid ISO which can otherwise be burnt onto USB key as well. --- Makefile | 10 ++++++--- preseed.sh | 70 +++++++++++++++++++++++++++++++++++++++++++++++---------- virtualenv/virt | 2 ++ 3 files changed, 67 insertions(+), 15 deletions(-) diff --git a/Makefile b/Makefile index d207c86..e8f4e44 100644 --- a/Makefile +++ b/Makefile @@ -3,18 +3,22 @@ CC += -m$(shell dpkg-architecture -qDEB_HOST_ARCH_BITS $(patsubst %,-a%, ${ARCH} DEB_ARCH = $(shell dpkg-architecture -qDEB_HOST_ARCH $(patsubst %,-a%, ${ARCH})) VERSION = 7.3.0 +IMAGE_TYPE ?= iso ISOIMG = debian-${VERSION}-${DEB_ARCH}-netinst.iso -PRESEEDED = $(patsubst %.iso,%-preseeded.iso, ${ISOIMG}) +PRESEEDED = $(patsubst %.iso,%-preseeded.${IMAGE_TYPE}, ${ISOIMG}) UDEBS = $(shell ./src/getname.sh) CHECKSUMS = MD5 SHA1 SHA256 SHA512 # Preseed -iso-preseed: +preseed: make dist/${DEB_ARCH}/${PRESEEDED} dist/${DEB_ARCH}/${PRESEEDED}: preseed.cfg $(wildcard ./include/*) dist/${DEB_ARCH}/${ISOIMG} ${UDEBS} ./preseed.sh $@ dist/${DEB_ARCH}/${ISOIMG} ${UDEBS} +sig: dist/${DEB_ARCH}/${PRESEEDED} + gpg --detach-sign $^ + # Get, verify iso-get: dist/${DEB_ARCH}/${ISOIMG} iso-checksum: $(patsubst %,iso-checksum-%, ${CHECKSUMS}) @@ -43,4 +47,4 @@ clean: @for d in src/*-udeb/; do rm -fv $${d%-udeb/}_*.build $${d%-udeb/}_*.changes $${d%-udeb/}_*.udeb; cd $$d && dh_clean && cd -; done @rm -fv $(patsubst %,dist/${DEB_ARCH}/%SUMS, ${CHECKSUMS}) $(patsubst %,dist/${DEB_ARCH}/%SUMS.sign, ${CHECKSUMS}) -.PHONY: clean cleanall iso-get iso-checksum iso-preseed udebs +.PHONY: clean cleanall iso-get iso-checksum preseed udebs diff --git a/preseed.sh b/preseed.sh index 729f97e..2bfdf3a 100755 --- a/preseed.sh +++ b/preseed.sh @@ -12,6 +12,17 @@ set -ue newiso=$(readlink -f "$1") [ -e "$newiso" ] && rm -f "$newiso" +# Generate a (hybrid) ISO or an HDD image? The latter should only be +# useful for older BIOSes that don't support hybrid ISOs. +case "$newiso" in + *.iso) type=iso;; + *.tar) type=hdd; archive=;; + *.tar.gz|*.tgz) type=hdd; archive=z;; + *.tar.bz|*.tar.bz2|*.tbz|*.tbz2) type=hdd; archive=j;; + *.tar.xz|*.txz) type=hdd; archive=J;; + *) echo "Error: $newiso: Unknown file type" >&2; exit 1;; +esac + iso="$2" test -r "$iso" || exit 1 shift; shift @@ -85,18 +96,53 @@ while read sum file; do done < ./md5sum.txt > "$md5sums" mv "$md5sums" "$isoeditdir/md5sum.txt" -if [ -f ./boot/grub/efi.img ]; then - efi_opts="--efi-boot boot/grub/efi.img -append_partition 2 0x01 ./boot/grub/efi.img" -else - efi_opts= +if [ $type = hdd ]; then + # Generate a HDD image + mv ./isolinux ./syslinux + mv ./syslinux/isolinux.cfg ./syslinux/syslinux.cfg + mv ./syslinux/isolinux.bin ./syslinux/syslinux.bin + sed -i 's/\bisolinux\b/syslinux/g' ./syslinux/*.cfg + # Dereference links, which are not compatible with FAT devices + tar --exclude='./debian' --hard-dereference --dereference \ + -c ${archive:+-$archive} \ + -f "$newiso" ./ + + ## To burn the archive onto a USB stick: + # device=/dev/disk/by-id/... # FIXME + # mountpoint=/mnt/usbkey # FIXME + # + # device=$(readlink -f "$device") + # parted $device mklabel msdos + # parted $device mkpart primary 1 1G + # parted $device set 1 boot on + # mkdosfs ${device}1 + # + # install-mbr $device + # syslinux -i ${device}1 + # + # mount ${device}1 $mountpoint + # tar -x -C "$mountpoint" -f "$image" --no-same-owner + # umount "$mountpoint" + +elif [ $type = iso ]; then + # Generate a hybrid ISO image + if [ -f ./boot/grub/efi.img ]; then + efi_opts="--efi-boot boot/grub/efi.img -append_partition 2 0x01 ./boot/grub/efi.img" + else + efi_opts= + fi + + xorriso -as mkisofs -r \ + -checksum_algorithm_iso all \ + -isohybrid-mbr /usr/lib/syslinux/isohdpfx.bin \ + -b isolinux/isolinux.bin -c isolinux/boot.cat \ + -partition_offset 16 \ + -no-emul-boot -boot-load-size 4 -boot-info-table -eltorito-alt-boot $efi_opts \ + -o "$newiso" \ + ./ + + # To burn the ISO onto a USB stick, see + # http://www.debian.org/CD/faq/#write-usb fi -xorriso -as mkisofs -r \ - -checksum_algorithm_iso all \ - -isohybrid-mbr /usr/lib/syslinux/isohdpfx.bin \ - -b isolinux/isolinux.bin -c isolinux/boot.cat \ - -partition_offset 16 \ - -no-emul-boot -boot-load-size 4 -boot-info-table -eltorito-alt-boot $efi_opts \ - -o "$newiso" \ - ./ rm -rf "$isoeditdir" diff --git a/virtualenv/virt b/virtualenv/virt index 2bcbe4b..4d86b6a 100755 --- a/virtualenv/virt +++ b/virtualenv/virt @@ -109,6 +109,8 @@ install() { --disk "$disk",cache=writeback,bus=sata \ --network network="$network" \ --graphics spice +# --import \ +# --disk path=/dev/sdc,bus=usb,perms=ro \ # Attribute the next available IP. You may also want to add a domain # section, e.g., , and prepend -- cgit v1.2.3