blob: 7c979d0d14fc896d26ad2ab79b46413695b7575e (
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
#!/bin/bash
# Author: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
# Date: 2009-10-08
# License: GPL v3+
# usage:
# di-maker ISOFILE [FILE ...]
# make a new debian installer ISO, packing any additionally-supplied files into the initramfs directly
set -e
# depends on grub2
# specify the first argument as the new installer image:
output="$1"
# remaining arguments should be files to re-pack into the initrd
shift
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
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
KERNEL=linux
INITRAMFS=initrd.gz
BOOTINSTRUCTIONS="
linux /$KERNEL verbose -- console=ttyS0,115200n8
initrd /$INITRAMFS
"
case "$ARCH" in
kfreebsd-*)
# FIXME: this discards the requested SUITE, and just pulls the
# latest d-i, because dkg is lazy
SUITE=sid
KERNEL=kfreebsd.gz
BASEPATH="http://d-i.debian.org/daily-images/$ARCH/daily/monolithic/"
BOOTINSTRUCTIONS='
# this set came from mini.iso
kfreebsd /kfreebsd.gz
kfreebsd_module /initrd.gz type=mfs_root
set kFreeBSD.vfs.root.mountfrom=ufs:/dev/md0
set kFreeBSD.hw.ata.ata_dma=0 # needed for qemu hard disk # TODO: delete
set kFreeBSD.hw.ata.atapi_dma=0 # needed for qemu cd # TODO: 1
# this set came from http://jdc.parodius.com/freebsd/pxeboot_serial_install_7.html
set kFreeBSD.comconsole_speed="115200"
set kFreeBSD.console="comconsole"
'
esac
if ! [ -e "$output" ] ; then
( cd "$WORKDIR" && wget "$BASEPATH"/{$KERNEL,$INITRAMFS} )
else
isoinfo -R -i "$output" -x "/$KERNEL" > "$WORKDIR/$KERNEL"
isoinfo -R -i "$output" -x "/$INITRAMFS" > "$WORKDIR/$INITRAMFS"
fi
if [ "$#" -gt 0 ]; then
unpackdir=$(mktemp -d)
fstate=$(mktemp)
gzip -d < "$WORKDIR/$INITRAMFS" | (cd "$unpackdir" && fakeroot -i "$fstate" -s "$fstate" cpio --extract)
cp "$@" "$unpackdir/"
(cd "$unpackdir" && find . | fakeroot -i "$fstate" -s "$fstate" cpio --create -H newc | gzip ) > "$WORKDIR/$INITRAMFS"
rm -rf "$unpackdir"
fi
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 $ARCH (created $(date -R))" {
$BOOTINSTRUCTIONS
}
EOF
absoutput="$(pwd)/$output"
## 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"
(cd "$WORKDIR" && grub-mkrescue --output="$absoutput" .)
|