#!/bin/bash

. /lib/partman/definitions.sh

dev="$1"

any_linux_on_dev() {
    cd $dev
    open_dialog PARTITIONS
    while { read_line num id size type fs path name; [ "$id" ]; }; do
	if [ "$fs" = "ext2" ] || [ "$fs" = "ext3" ] || [ "$fs" = "reiserfs" ]; then
	    has_linux_part="yes"
	fi
	if [ "$fs" = "linux-swap" ]; then
	    has_swap_part="yes"
	fi
    done
    close_dialog
}

any_linux_on_dev

if [ $has_linux_part = "yes" ] && [ $has_swap_part = "yes" ]; then
    db_metaget partman-auto/text/do_nothing_partitioning description
    printf "custom\t$RET"
fi
