#! /bin/sh

# Remove the bios_grub flag for partitions whose method is not biosgrub, and
# set it for partitions whose method is biosgrub.

. /usr/lib/partman/lib/base.sh

dev=$1
num=$2
id=$3
size=$4
type=$5
fs=$6
path=$7
name=$8

cd $dev

if [ "$fs" = free ]; then
	exit 0
fi

method=
if [ -f "$id/method" ]; then
	method="$(cat "$id/method")"
fi

if [ "$method" = biosgrub ]; then
	state=on
else
	state=off
fi

open_dialog SET_FLAG "$id" bios_grub "$state"
close_dialog
