dmi: check both the AC and ID flags at the same time
[syslinux/sherbszt.git] / tests / build-syslinux
bloba8972c0bcf21e2b26b540ef24cbb316abf22f69e
1 #!/bin/bash
3 # Copyright (C) 2013 Intel Corporation; author Matt Fleming
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation, Inc., 53 Temple Place Ste 330,
8 # Boston MA 02111-1307, USA; either version 2 of the License, or
9 # (at your option) any later version; incorporated herein by reference.
12 usage()
14 echo "Usage: " $0 "[start|stop] <objdir> <outputfile> <config>" > /dev/stderr
17 if [ $# -lt 4 ]; then
18 usage
19 exit 1
22 if [ `id -u` -ne 0 ]; then
23 echo $0 "must be invoked as root" > /dev/stderr
24 exit 1
27 start_func()
29 dd if=/dev/zero of=$2 bs=512 count=$(((32 * 1024 * 1024)/512)) > /dev/null 2>&1
31 tmpdir=`mktemp -d || exit 1`
33 next=`losetup -f`
34 losetup $next $2
36 mkfs.vfat $next > /dev/null 2>&1
38 mount $next $tmpdir
40 mkdir -p $tmpdir/boot/syslinux
41 cp $3 $tmpdir/boot/syslinux/syslinux.cfg
43 for f in `find $1 -name "*.c32"`; do
44 cp $f $tmpdir/boot/syslinux
45 done
47 $1/linux/syslinux --directory /boot/syslinux --install $next > /dev/stderr
48 sync
50 echo $tmpdir $next
53 stop_func()
55 umount $1
56 rm -fr $1
58 losetup -d $2
61 case "$1" in
62 start)
63 shift
64 start_func $*
66 stop)
67 shift
68 stop_func $*
70 esac