2 # test bios_grub flag in gpt labels
4 # Copyright (C) 2007-2012 Free Software Foundation, Inc.
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 3 of the License, or
9 # (at your option) any later version.
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 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, see <http://www.gnu.org/licenses/>.
20 . "${srcdir=.}/init.sh"; path_prepend_ ../parted
24 N=4200 # number of sectors
28 end_sector=$(expr $start_sector + $part_sectors - 1)
30 # setup: reasonable params
31 test $end_sector -lt $N || fail=1
33 # setup: create zeroed device
34 dd if=/dev/zero of=$dev bs=${ss}c count=$N 2> /dev/null || fail=1
37 parted -s $dev mklabel gpt > empty 2>&1 || fail=1
39 # ensure there was no output
40 compare /dev/null empty || fail=1
42 # print the table (before adding a partition)
43 parted -m -s $dev unit s print > t 2>&1 || fail=1
44 sed "s,.*/$dev:,$dev:," t > out || fail=1
46 # check for expected output
47 printf "BYT;\n$dev:${N}s:file:$ss:$ss:gpt::;\n" > exp || fail=1
48 compare exp out || fail=1
51 parted -s $dev u s mkpart name1 ${start_sector} ${end_sector} >out 2>&1 \
54 # print the table before modification
55 parted -m -s $dev unit s print > t 2>&1 || fail=1
56 sed "s,.*/$dev:,$dev:," t >> out || fail=1
58 # set the new bios_grub attribute
59 parted -m -s $dev set 1 bios_grub on || fail=1
61 # print the table after modification
62 parted -m -s $dev unit s print > t 2>&1 || fail=1
63 sed "s,.*/$dev:,$dev:," t >> out || fail=1
69 $dev:${N}s:file:$ss:$ss:gpt::;
70 1:${start_sector}s:${end_sector}s:${part_sectors}s::name1:;
72 $dev:${N}s:file:$ss:$ss:gpt::;
73 1:${start_sector}s:${end_sector}s:${part_sectors}s::name1:bios_grub;
77 # check for expected output
78 gen_exp > exp || fail=1
79 compare exp out || fail=1