632d366e4104e7ef6dc27b5b71dabd17f7f10cc6
[libguestfs.git] / clone / test-virt-sysprep.sh
1 #!/bin/bash -
2 # libguestfs virt-sysprep test script
3 # Copyright (C) 2011 Red Hat Inc.
4 #
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; either version 2 of the License, or
8 # (at your option) any later version.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18
19 export LANG=C
20 set -e
21
22 rm -f test.img guestfish
23
24 qemu-img create -f qcow2 -o backing_file=../images/fedora.img test.img
25
26 # Provide alternate 'virt-inspector' and 'guestmount' binaries
27 # that run the just-built programs.
28
29 cat <<'EOF' > virt-inspector
30 #!/bin/sh -
31 ../run ../inspector/virt-inspector "$@"
32 EOF
33 chmod +x virt-inspector
34 cat <<'EOF' > guestmount
35 #!/bin/sh -
36 ../run ../fuse/guestmount "$@"
37 EOF
38 chmod +x guestmount
39
40 PATH=.:$PATH
41
42 ./virt-sysprep -a test.img
43
44 rm -f test.img virt-inspector guestmount