scripts/multi-dist-iso/isolinux/mkcd.sh

103 lines
3.2 KiB
Bash
Executable File

#!/bin/bash
DEBIAN_MIRROR="http://ftp2.de.debian.org"
UBUNTU_MIRROR="http://de.archive.ubuntu.com"
sarge_i386_URL="${DEBIAN_MIRROR}/debian/dists/sarge/main/installer-i386/current/images/hd-media/boot.img.gz"
sarge_i386_FILE=../debian/sarge/i386_img.gz
sarge_i386_NAME="Debian 3.1 Sarge (i386)"
sarge_i386_SHORT="sarge"
etch_i386_URL="${DEBIAN_MIRROR}/debian/dists/etch/main/installer-i386/current/images/hd-media/boot.img.gz"
etch_i386_FILE=../debian/etch/i386_img.gz
etch_i386_NAME="Debian 4.0 Etch (i386)"
etch_i386_SHORT="etch"
etch_amd64_URL="${DEBIAN_MIRROR}/debian/dists/etch/main/installer-amd64/current/images/hd-media/boot.img.gz"
etch_amd64_FILE=../debian/etch/amd64_img.gz
etch_amd64_NAME="Debian 4.0 Etch (amd64)"
etch_amd64_SHORT="etch64"
edgy_i386_URL="${UBUNTU_MIRROR}/ubuntu/dists/edgy/main/installer-i386/current/images/netboot/boot.img.gz"
edgy_i386_FILE=../ubuntu/edgy/i386_img.gz
edgy_i386_NAME="Ubuntu 6.10 Edgy Eft (i386)"
edgy_i386_SHORT="edgy"
edgy_amd64_URL="${UBUNTU_MIRROR}/ubuntu/dists/edgy/main/installer-amd64/current/images/netboot/boot.img.gz"
edgy_amd64_FILE=../ubuntu/edgy/amd64_img.gz
edgy_amd64_NAME="Ubuntu 6.10 Edgy Eft (amd64)"
edgy_amd64_SHORT="edgy64"
feisty_i386_URL="${UBUNTU_MIRROR}/ubuntu/dists/feisty/main/installer-i386/current/images/netboot/boot.img.gz"
feisty_i386_FILE=../ubuntu/feisty/i386_img.gz
feisty_i386_NAME="Ubuntu 7.04 Feisty Fawn (i386)"
feisty_i386_SHORT="feisty"
feisty_amd64_URL="${UBUNTU_MIRROR}/ubuntu/dists/feisty/main/installer-amd64/current/images/netboot/boot.img.gz"
feisty_amd64_FILE=../ubuntu/feisty/amd64_img.gz
feisty_amd64_NAME="Ubuntu 7.04 Feisty Fawn (amd64)"
feisty_amd64_SHORT="feisty64"
DISTLIST="sarge_i386 etch_i386 etch_amd64 edgy_i386 edgy_amd64 feisty_i386 feisty_amd64"
# -------------------
CFG="isolinux.cfg"
TXT="isolinux.txt"
echo "DISPLAY $TXT" > $CFG
echo "PROMPT 1" >> $CFG
echo "KBDMAP german.kbd" >> $CFG
echo -e "\nAvailable bootdisks:" > $TXT
for dist in $DISTLIST; do
eval URL=\${${dist}_URL}
eval FILE=\${${dist}_FILE}
eval NAME=\${${dist}_NAME}
eval SHORT=\${${dist}_SHORT}
[ -e "$FILE" ] || {
DIR=$(dirname $FILE)
mkdir -p $DIR $DIR/temp.org $DIR/temp.new
# fetch & decompress big original
ORGFILE=${FILE%.gz}.org.gz
wget -O $ORGFILE $URL
gunzip $ORGFILE
# mount & get used size
mount -o loop ${ORGFILE%.gz} $DIR/temp.org || exit
SIZE=$(du -s $DIR/temp.org | awk '{ x=$1+512; printf "%.0f", x/1024; }')
# create dosfs with min size
dd if=/dev/zero of=${FILE%.gz} bs=1M count=$SIZE
mkdosfs ${FILE%.gz}
# mount & copy
mount -o loop ${FILE%.gz} $DIR/temp.new || exit
cp -a $DIR/temp.org/* $DIR/temp.new
# cleanup
umount $DIR/temp.org || exit
umount $DIR/temp.new || exit
rm -rf ${ORGFILE%.gz} $DIR/temp.org $DIR/temp.new
# make it bootable (needs syslinux + mtools)
syslinux ${FILE%.gz}
gzip ${FILE%.gz}
}
echo -e "\nLABEL $SHORT" >> $CFG
echo " KERNEL memdisk" >> $CFG
echo " APPEND initrd=${FILE#..}" >> $CFG
printf "%-10s - %s\n" "$SHORT" "$NAME" >> $TXT
done
[ -e "isolinux.bin" ] || cp /usr/lib/syslinux/isolinux.bin .
[ -e "memdisk" ] || cp /usr/lib/syslinux/memdisk .
mkisofs -b isolinux/isolinux.bin -c isolinux/boot.cat \
-no-emul-boot -boot-load-size 4 -boot-info-table \
-l -N -o /tmp/multi-dist-$(date "+%Y-%m-%d").iso ..