#!/bin/sh

post_upgrade() {
	mkdir -p /boot/ipxe/
	cp /usr/lib/ipxe/ipxe.lkrn /boot/ipxe/ipxe.lkrn
}

post_install() {
	# This text is taken from Makefile
cat <<EOF
 > To create a bootable floppy, type
 >    cat bin/ipxe.dsk > /dev/fd0
 > where /dev/fd0 is your floppy drive. This will erase any
 > data already on the disk.
 >
 > To create a bootable USB key, type
 >     cat bin/ipxe.usb > /dev/sdX
 > where /dev/sdX is your USB key, and is *not* a real hard
 > disk on your system. This will erase any data already on
 > the USB key.
 >
 > To create a bootable CD-ROM, burn the ISO image
 > bin/ipxe.iso to a blank CD-ROM.
 >
 > These images contain drivers for all supported cards. You
 > can build more customised images, and ROM images, using
 >     make bin/<rom-name>.<output-format>
EOF

	if [ -x /usr/sbin/grub-mkconfig ] && [ -s /boot/grub/grub.cfg ]; then
		echo ' >'
		echo ' > Run grub-mkconfig now for iPXE in Grub boot menu.'
	fi

	post_upgrade
}

post_remove() {
	rm -f /boot/ipxe/ipxe.lkrn
	rmdir /boot/ipxe/
}
