3 # Copyright (C) 2011 Red Hat Inc.
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.
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.
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.
19 # https://bugzilla.redhat.com/show_bug.cgi?id=602997
20 # Fix part-get-bootable to work with missing/unordered partitions.
25 guestfish=../fish/guestfish
27 rm -f test.img test.output
29 $guestfish > test.output <<EOF
32 part-init /dev/sda mbr
33 # Create an unordered layout.
34 # This places part 2 in front of part 1.
35 part-add /dev/sda p 1001 2000
36 part-add /dev/sda p 1 1000
38 part-set-bootable /dev/sda 1 true
39 part-get-bootable /dev/sda 1
40 part-get-bootable /dev/sda 2
43 if [ "$(cat test.output)" != "true
45 echo "rhbz602997.sh: Unexpected output from test:"
47 echo "[end of output]"
51 $guestfish > test.output <<EOF
54 part-init /dev/sda mbr
55 part-add /dev/sda p 1 1000
56 part-add /dev/sda p 1001 2000
57 part-add /dev/sda p 2001 3000
60 part-get-bootable /dev/sda 3
64 if [ "$(cat test.output)" != "false" ]; then
65 echo "rhbz602997.sh: Unexpected output from test:"
67 echo "[end of output]"
71 rm -f test.img test.output