add ovirt-node-release
[ovirt-node-image.git] / ovirt-pxe
blobd1e2b9160962af754fe63dabf22eadb6c1cd227b
1 #!/bin/bash
3 # Create an Ovirt Host PXE boot
4 # Copyright 2008 Red Hat, Inc.
5 # Written by Chris Lalancette <clalance@redhat.com>
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; version 2 of the License.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU Library General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 ME=$(basename "$0")
21 warn() { printf '%s: %s\n' "$ME" "$*" >&2; }
22 die() { warn "$@"; exit 1; }
24 test $# != 1 && die "Usage: $ME <iso-image>"
26 ISO=$1
27 test ! -r $ISO && die "$ISO is not a readable file"
28 test $( id -u ) -ne 0 && die "$ME must run as root"
30 livecd-iso-to-pxeboot $ISO
32 # append BOOTIF with PXE MAC info
33 f=tftpboot/pxelinux.cfg/default
34 grep -q 'IPAPPEND 2' $f || sed -i '/KERNEL/a \\tIPAPPEND 2' $f
36 # timeout quickly for PXE boots
37 sed -i 's/timeout.*/timeout 50/' $f