3 # Create an Ovirt Host USB device (stateless)
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.
21 warn
() { printf "$ME: $@\n" >&2; }
22 die
() { warn
"$@"; exit 1; }
24 test $# != 2 && die
"Usage: $ME <usbdevice> <iso-image>"
29 test ! -r $ISO && die
"$ISO is not a readable file"
30 test ! -b $USBDEVICE && die
"$USBDEVICE is not a valid block device"
31 test $
( id
-u ) -ne 0 && die
"$ME must run as root"
33 # clear out the old partition table
34 dd if=/dev
/zero of
=$USBDEVICE bs
=4096 count
=1
35 printf 'n\np\n1\n\n\nt\n6\na\n1\nw\n' | fdisk
$USBDEVICE
36 mkdosfs
-n ovirt
${USBDEVICE}1
37 cat /usr
/lib
/syslinux
/mbr.bin
> $USBDEVICE
38 livecd-iso-to-disk
$ISO ${USBDEVICE}1