Skip to content

Commit 143f2b9

Browse files
committedOct 17, 2013
Adds ubuntu preseed ISO creation script
1 parent 621cdc2 commit 143f2b9

File tree

2 files changed

+51
-0
lines changed

2 files changed

+51
-0
lines changed
 

‎create-ubuntu-preseed-iso.sh

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
SO_DEST_TMP=`mktemp -d`#!/bin/bash
2+
set -e
3+
4+
if [ $# -ne 2 ]; then
5+
echo "Usage: $0 <source_ISO> <dest_ISO>"
6+
exit 1
7+
fi
8+
9+
if [ $EUID -ne 0 ]; then
10+
echo "This script must be run as root" 1>&2
11+
exit 1
12+
fi
13+
14+
ISO_SRC=$1
15+
ISO_DEST=$2
16+
17+
ISO_SRC_TMP=`mktemp -d`
18+
ISO_DEST_TMP=`mktemp -d`
19+
20+
echo "Mounting $ISO_SRC..."
21+
mount -o ro,loop $ISO_SRC $ISO_SRC_TMP
22+
23+
# Preserve the ISO label
24+
ISO_LABEL=`blkid -o value $ISO_SRC | awk 'NR == 1'`
25+
26+
echo "Copying $ISO_SRC contents..."
27+
cp -a -r $ISO_SRC_TMP/. $ISO_DEST_TMP
28+
29+
umount $ISO_SRC_TMP
30+
rmdir $ISO_SRC_TMP
31+
32+
echo $ISO_DEST_TMP
33+
34+
ISOLINUXCFG=$ISO_DEST_TMP/isolinux/isolinux.cfg
35+
36+
cat << EOF > $ISOLINUXCFG
37+
# D-I config version 2.0
38+
prompt 0
39+
timeout 0
40+
41+
default preseed
42+
label preseed
43+
menu label ^Preseed
44+
kernel /install/vmlinuz
45+
append file=/floppy/preseed.cfg debian-installer/locale=en_US console-setup/layoutcode=us keyboard-configuration/modelcode=pc105 keyboard-configuration/layoutcode=us vga=788 initrd=/install/initrd.gz quiet --
46+
EOF
47+
48+
echo "Creating $ISO_DEST..."
49+
mkisofs -o $ISO_DEST -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -R -J -V "$ISO_LABEL" -T -quiet $ISO_DEST_TMP
50+
rm -rf $ISO_DEST_TMP
51+

‎preseed.flp

0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)
Please sign in to comment.