~ubuntu-branches/ubuntu/hardy/partman-basicfilesystems/hardy-proposed

1
2
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
#!/bin/sh

. /usr/share/debconf/confmodule

dev=$1
id=$2
part=$dev/$id

cd $dev

do_mountpoint () {
    local noninteractive
    noninteractive=true
    while true; do
	if [ -f "$part/mountpoint" ]; then
	    old_mountpoint=$(cat $part/mountpoint)
	else
	    old_mountpoint=/
	fi
	db_set partman-basicfilesystems/mountpoint "$old_mountpoint"
	db_input critical partman-basicfilesystems/mountpoint || $noninteractive
	db_go || return 1
	db_get partman-basicfilesystems/mountpoint

	case "$RET" in
	    Do?not?mount?it)
                rm -f $part/mountpoint
		break
		;;
	    Enter?manually)
		if do_mountpoint_manual; then break; fi
		noninteractive="return 1"
		;;
	    *)
		echo ${RET%% *} >$part/mountpoint
		break
	esac
    done
}

do_mountpoint_manual () {
    local noninteractive
    noninteractive=true
    while true; do
	new_mountpoint=''
	while [ ! "$new_mountpoint" ]; do
	    if [ -f "$part/mountpoint" ]; then
		old_mountpoint=$(cat $part/mountpoint)
	    else
		old_mountpoint=/
	    fi
	    db_set partman-basicfilesystems/mountpoint_manual "$old_mountpoint"
	    db_input critical partman-basicfilesystems/mountpoint_manual \
		|| $noninteractive
	    db_go || return 1
	    db_get partman-basicfilesystems/mountpoint_manual
	    
	    if expr "$RET" : '/[^ ]*$' >/dev/null; then
		new_mountpoint=$RET
	    else
		db_input high partman-basicfilesystems/bad_mountpoint || true
		db_go || true
	    fi
	done
	echo $RET >$part/mountpoint
	break
    done
}

do_mountpoint