~ubuntu-branches/ubuntu/gutsy/virtualbox-ose/gutsy

« back to all changes in this revision

Viewing changes to src/VBox/Devices/PC/Etherboot-src/util/genliso

  • Committer: Bazaar Package Importer
  • Author(s): Steve Kowalik
  • Date: 2007-09-08 16:44:58 UTC
  • Revision ID: james.westby@ubuntu.com-20070908164458-wao29470vqtr8ksy
Tags: upstream-1.5.0-dfsg2
ImportĀ upstreamĀ versionĀ 1.5.0-dfsg2

Show diffs side-by-side

added added

removed removed

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