1#!/bin/bash 2# 3# Generate a legacy floppy emulation ISO boot image 4# 5# genliso foo.liso foo.lkrn bar.lkrn ... 6# 7# The .liso image filename is the first argument followed by 8# a list of .lkrn images include in .liso image 9 10case $# in 110|1) 12 echo Usage: $0 foo.liso foo.lkrn ... 13 exit 1 14 ;; 15esac 16 17case "`mtools -V`" in 18Mtools\ version\ 3.9.9*|Mtools\ version\ 3.9.1[0-9]*|[mM]tools\ *\ [4-9].*) 19 ;; 20*) 21 echo Mtools version 3.9.9 or later is required 22 exit 1 23 ;; 24esac 25 26out=$1 27shift 28 29dir=`mktemp -d bin/liso.dir.XXXXXX` 30 31img=$dir/boot.img 32mformat -f 1440 -C -i $img :: 33 34cfg=$dir/syslinux.cfg 35cat > $cfg <<EOF 36# These default options can be changed in the genliso script 37SAY gPXE ISO boot image generated by genliso 38TIMEOUT 30 39EOF 40 41first= 42for f 43do 44 if [ ! -r $f ] 45 then 46 echo $f does not exist, skipping 1>&2 47 continue 48 fi 49 # shorten name for 8.3 filesystem 50 b=$(basename $f) 51 g=${b%.lkrn} 52 g=${g//[^a-z0-9]} 53 g=${g:0:8}.krn 54 case "$first" in 55 "") 56 echo DEFAULT $g 57 ;; 58 esac 59 first=$g 60 echo LABEL $b 61 echo "" KERNEL $g 62 mcopy -m -i $img $f ::$g 63done >> $cfg 64 65mcopy -i $img $cfg ::syslinux.cfg 66 67if ! syslinux $img 68then 69 exit 1 70fi 71 72mkisofs -q -o $out -c boot.cat -b boot.img $dir 73 74rm -fr $dir 75