blob: a061aa9e6564c7cb543342a9193075fdfbf2a72d (
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
|
#!/bin/bash
[ $# != 2 ] && echo missing parameters && exit 1
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)
grubcfgpath=$(xorriso -dev $1 -sh_style_result on -find / -type f -name grub.cfg 2>/dev/null | cut -f2- -d '/' | tail -1)
if [ "$vmlinuzpath" != "" ]; then
# Debian, newer Ubuntu, Fedora
kpath=/`dirname $vmlinuzpath`
kname=vmlinuz
else
# Ubuntu
kpath=""
kname=linux
fi
if [ "$kpath" = "/images/pxeboot" ]; then
# Fedora
preseed="kickstart"
else
# Debian
preseed="preseed"
fi
xorriso -dev $1 \
-sh_style_result on \
-osirrox on \
-extract_single $grubcfgpath $grubcfg
chmod u+w $grubcfg
cat <<EOF >>$grubcfg
menuentry 'Install preseeded' --id preseed {
set background_color=black
linux $kpath/$kname auto=true priority=critical $preseed_path --- quiet
initrd $kpath/initrd.gz
}
menuentry 'Install kickstart' --id kickstart {
linux $kpath/$kname inst.stage2=hd:/dev/sr0 ks=cdrom:/ks.cfg ro
initrd $kpath/initrd.img
}
default=$preseed
timeout=5
EOF
xorriso -indev $1 \
-outdev $2 \
-map $grubcfg $grubcfgpath \
-map preseed.cfg /preseed.cfg \
-map anaconda-ks.cfg /ks.cfg \
-boot_image any replay
chmod -R a+rw $out
rm -rf $out
|