build-cd-image: Add PRESEED_PATH option for alternative pressed file

Signed-off-by: Marc Zyngier <maz@kernel.org>
diff --git a/README b/README
index 3e55846..0da16bf 100644
--- a/README
+++ b/README
@@ -90,7 +90,10 @@
     grub entry for unattended installation, repack the whole thing as
     target.iso. The only VM user is root, password is root. Don't try
     this on a publicly visible box... Depends on the xorriso package
-    being installed.
+    being installed. If the PRESEED_PATH environment variable is
+    defined, feed this to the installer as part of the kernel command
+    line. This is useful to point the installer to a remote preseed
+    file (PRESEED_PATH="url=http://my.remote.box/preseed.cfg").
 
 Example:
 
diff --git a/build-cd-image b/build-cd-image
index f7c8f3d..a061aa9 100755
--- a/build-cd-image
+++ b/build-cd-image
@@ -5,6 +5,8 @@
 out=tmp/cd
 grubcfg=$out/boot/grub/grub.cfg
 
+preseed_path=${PRESEED_PATH-file=/cdrom/preseed.cfg}
+
 mkdir $out
 
 vmlinuzpath=$(xorriso -dev $1 -sh_style_result on -find / -type f -name vmlinuz 2>/dev/null | cut -f2- -d '/' | tail -1)
@@ -37,7 +39,7 @@
 cat <<EOF >>$grubcfg
 menuentry 'Install preseeded' --id preseed {
     set background_color=black
-    linux    $kpath/$kname auto=true priority=critical file=/cdrom/preseed.cfg --- quiet
+    linux    $kpath/$kname auto=true priority=critical $preseed_path --- quiet
     initrd   $kpath/initrd.gz
 }