#!/bin/sh

# This script sets method "aboot" for all front-of-disk partitions that
# look like they're made for aboot.

. /lib/partman/definitions.sh

for dev in /var/lib/partman/devices/*; do
    [ -d "$dev" ] || continue
    cd $dev
    partitions=
    open_dialog PARTITIONS
    while { read_line num id size type fs path name; [ "$id" ]; }; do
	start=${id%-*}
	if [ "$(($start/1024))" -le "1" -a "$fs" = "unknown" ]
	then
	    [ -d $id ] || mkdir $id
	    echo aboot >$id/method
	fi
    done
    close_dialog

done
