aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Kahn Gillmor <dkg@fifthhorseman.net>2010-12-11 20:25:24 -0500
committerDaniel Kahn Gillmor <dkg@fifthhorseman.net>2010-12-11 20:25:24 -0500
commit4b3500c5b2b6c4c54d3d3108cf70a8a2d1cc9f70 (patch)
treebb8eaf2a79c2f92254fafc247c068e94547add6e
parentb8eabc2469af937cf5475c373761f21388281eda (diff)
downloadkvm-manager-4b3500c5b2b6c4c54d3d3108cf70a8a2d1cc9f70.tar.gz
kvm-manager-4b3500c5b2b6c4c54d3d3108cf70a8a2d1cc9f70.tar.bz2
accept preseed files in di-maker
-rwxr-xr-xdi-maker19
1 files changed, 18 insertions, 1 deletions
diff --git a/di-maker b/di-maker
index 5a6d69c..7ce9131 100755
--- a/di-maker
+++ b/di-maker
@@ -12,6 +12,10 @@ set -e
output="$1"
+# optionally specify the second argument as a preseed file:
+
+preseed="$2"
+
SUITE=${SUITE:-stable}
ARCH=${ARCH:-amd64}
DISTRO=${DISTRO:-debian}
@@ -26,6 +30,15 @@ if [ -e "$output" ] ; then
exit 1
fi
+preseed_args=''
+if [ "$preseed" ] ; then
+ if ! [ -r "$preseed" ] ; then
+ printf "could not read preseed file '%s'\n" "$preseed" >&2
+ exit 1
+ fi
+ checksum=$(md5sum - < "$preseed" | cut -f1 -d\ )
+ preseed_args="preseed/file=/cdrom/preseed.cfg preseed/file/checksum=$checksum"
+fi
WORKDIR=$(mktemp -d)
@@ -47,7 +60,7 @@ esac
KERNEL=linux
INITRAMFS=initrd.gz
BOOTINSTRUCTIONS="
- linux /$KERNEL verbose -- console=ttyS0,115200n8
+ linux /$KERNEL verbose $preseed_args -- console=ttyS0,115200n8
initrd /$INITRAMFS
"
@@ -74,6 +87,10 @@ esac
( cd "$WORKDIR" && wget "$BASEPATH"/{$KERNEL,$INITRAMFS} )
+if [ "$preseed" ]; then
+ cp "$preseed" "${WORKDIR}/preseed.cfg"
+fi
+
mkdir -p "$WORKDIR/boot/grub"