#!/bin/sh

. /lib/partman/definitions.sh

dev=$1
id=$2
cd $dev

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

if [ -f $id/filesystem -a '(' "$method" = keep -o "$method" = format ')' ]; then
    fs=$(cat $id/filesystem)
    db_metaget partman/filesystem_long/$fs description || RET=''
    if [ "$RET" ]; then
	description="$RET"
    else
	description="$fs"
    fi
else
    db_metaget partman/method_long/$method description || RET=''
    if [ "$RET" ]; then
	description="$RET"
    else
	description="$method"
    fi
fi

db_metaget partman-target/text/method description
RET=$(stralign -25 "$RET")
printf "method\t%s%s\n" "${RET}" "$description"
