blob: 4252fb9580c27302c7e8dea64168bb9dfd5ffe96 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
#!/bin/bash
# Author: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
# Date: 2009-10-08
# License: GPL v3+
set -e
# depends on grub2
# specify the first argument as the new installer image:
output="$1"
SUITE=${SUITE:-stable}
ARCH=${ARCH:-amd64}
DISTRO=${DISTRO:-debian}
if [ -z "$output" ] ; then
printf "you must specify a file name for the image to be built" >&2
exit 1
fi
if [ -e "$output" ] ; then
printf "file '%s' already exists" "$output" >&2
exit 1
fi
WORKDIR=$(mktemp -d)
cleanup() {
rm -rf "$WORKDIR"
}
trap cleanup EXIT
case "$DISTRO" in
debian)
BASEPATH="http://ftp.nl.debian.org/debian/dists/$SUITE/main/installer-$ARCH/current/images/netboot/debian-installer/$ARCH"
;;
ubuntu)
BASEPATH="http://archive.ubuntu.com/ubuntu/dists/$SUITE/main/installer-$ARCH/current/images/netboot/ubuntu-installer/$ARCH"
;;
esac
( cd "$WORKDIR" && wget "$BASEPATH"/{linux,initrd.gz} )
mkdir -p "$WORKDIR/boot/grub"
cat > "$WORKDIR/boot/grub/grub.cfg" <<EOF
serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1
terminal_output serial
terminal_input serial
menuentry "$SUITE d-i (created $(date -R))" {
linux /linux verbose -- console=ttyS0,115200n8
initrd /initrd.gz
}
EOF
## no longer using genisoimage with grub2:
# genisoimage -R -input-charset utf-8 -b boot/grub/stage2_eltorito -no-emul-boot --boot-load-size 4 -boot-info-table "$WORKDIR"
grub-mkrescue --overlay="$WORKDIR" "$output"
|