| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 
 | #!/bin/sh
. /usr/share/debconf/confmodule
set -e
dev=$1
id=$2
part=$dev/$id
cd $dev
[ -f $part/method -a -f $part/acting_filesystem ] || exit 0
method=$(cat $part/method)
filesystem=$(cat $part/acting_filesystem)
case "$filesystem" in
    ext2|fat16|fat32|ntfs)
	:
	;;
    *)
	exit 0
	;;
esac
choice_mountpoint () {
	case "$filesystem" in
	    ext2|fat16|fat32|ntfs)
		if [ -f $part/mountpoint ]; then
			mp=$(cat $part/mountpoint)
		else
			db_metaget partman-basicfilesystems/text/no_mountpoint description
			mp="$RET"
		fi
		db_metaget partman-basicfilesystems/text/specify_mountpoint description
		printf "mountpoint\t%s\${!TAB}%s\n" "$RET" "$mp"
		;;
	esac
}
choice_options () {
	db_metaget partman-basicfilesystems/text/options description
	printf "options\t%s\${!TAB}%.45s\n" "$RET" "$(get_mountoptions $dev $id)"
}
choice_format_swap () {
	if [ "$method" = swap ] && [ -f $part/detected_filesystem ] && \
	   [ "$(cat $part/detected_filesystem)" = linux-swap ];	then
		db_metaget partman-basicfilesystems/text/format_swap description
		description="$RET"
		if [ -f $part/format ]; then
			db_metaget partman-basicfilesystems/text/yes description
			printf "dont_format_swap\t%s\${!TAB}%s\n" "$description" "${RET}"
		else
			db_metaget partman-basicfilesystems/text/no description
			printf "format_swap\t%s\${!TAB}%s\n" "$description" "${RET}"
		fi
	fi
}
choice_label () {
	# allow to set label only if the partition is to be formatted
	[ -f $part/format ] || return 0
	[ ! -f $part/formatted \
	  -o $part/formatted -ot $part/method \
	  -o $part/formatted -ot $part/filesystem ] || return 0
	case "$filesystem" in
	    ext2)
		if [ -f $part/label ]; then
			label=$(cat $part/label)
		else
			db_metaget partman-basicfilesystems/text/none description
			label=$RET
		fi
		db_metaget partman-basicfilesystems/text/specify_label description
		printf "label\t%s\${!TAB}%s\n" "$RET" "$label"
		;;
	    _no_fat16|_no_fat32) # we dont have tools to set label of FAT file systems
		if [ -f $part/label ]; then
			label=$(cat $part/label)
		else
			db_metaget partman-basicfilesystems/text/none description
			label=$RET
		fi
		db_metaget partman-basicfilesystems/text/specify_label description
		printf "label\t%s\${!TAB}%s\n" "$RET" "$label"
		;;
	esac
}
choice_reserved () {
	local reserved
	[ "$filesystem" = ext2 ] || return 0
	# allow to set reserved space only if the partition is to be formatted
	[ -f $part/format ] || return 0
	[ ! -f $part/formatted \
	  -o $part/formatted -ot $part/method \
	  -o $part/formatted -ot $part/filesystem ] || return 0
	if [ -f $part/reserved_for_root ]; then
		reserved=$(cat $part/reserved_for_root)
	else
		reserved=5
	fi
	db_metaget partman-basicfilesystems/text/reserved_for_root description
	printf "reserved_for_root\t%s\${!TAB}%s\n" "$RET" "$reserved%"
}
choice_usage () {
	local usage
	[ "$filesystem" = ext2 ] || return 0
	# allow to set usage only if the partition is to be formatted
	[ -f $part/format ] || return 0
	[ ! -f $part/formatted \
	  -o $part/formatted -ot $part/method \
	  -o $part/formatted -ot $part/filesystem ] || return 0
	if [ -f $part/usage ]; then
		usage=$(cat $part/usage)
	else
		db_metaget partman-basicfilesystems/text/typical_usage description
		usage=$RET
	fi
	db_metaget partman-basicfilesystems/text/usage description
	printf "usage\t%s\${!TAB}%s\n" "$RET" "$usage"
}
choice_mountpoint
choice_options
choice_format_swap
choice_label
choice_reserved
choice_usage
 |