summaryrefslogtreecommitdiff
path: root/tests/build-pxelinux
blob: 50c9de8c067aff0049d5f2f90fa8bd49d0b71760 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/bash
#
#   Copyright (C) 2013 Intel Corporation; author Matt Fleming
#
#   This program is free software; you can redistribute it and/or modify
#   it under the terms of the GNU General Public License as published by
#   the Free Software Foundation, Inc., 53 Temple Place Ste 330,
#   Boston MA 02111-1307, USA; either version 2 of the License, or
#   (at your option) any later version; incorporated herein by reference.
#

usage()
{
    echo "Usage: " $0 "[start|stop] <srcdir> <config>" > /dev/stderr
}

if [ $# -lt 3 ]; then
    usage
    exit 1
fi

start_func()
{
    tmpdir=`mktemp -d || exit 1`
    echo $tmpdir

    mkdir -p $tmpdir/tftpboot/pxelinux.cfg
    cp $2 $tmpdir/tftpboot/pxelinux.cfg/default 

    # This doesn't work if we built with O=/tmp/foobar
    #make -p -s -C $1 bios netinstall INSTALLROOT=$tmpdir > /dev/stderr
    for f in `find $1/bios -name "*.c32" -o -name "*.0"`; do
	cp $f $tmpdir/tftpboot/
    done
}

stop_func()
{
    rm -fr $1
}

case "$1" in
    start)
	shift
	start_func $*
	;;
    stop)
	shift
	stop_func $*
	;;
esac