File: do_option

package info (click to toggle)
partman-partitioning 33
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 644 kB
  • ctags: 16
  • sloc: sh: 716; makefile: 41
file content (72 lines) | stat: -rwxr-xr-x 1,358 bytes parent folder | download
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
71
72
#!/bin/sh

. /lib/partman/definitions.sh

dev=$2
id=$3

cd $dev

db_set partman-partitioning/confirm_copy 'false'
db_input critical partman-partitioning/confirm_copy || true
db_go || exit 0
db_get partman-partitioning/confirm_copy

[ "$RET" = 'true' ] || exit 0

ask_for_source () {
    local noninteractive
    noninteractive=true
    while true; do
	source_dev=''
	source_id=''
	while [ ! "$source_id" ]; do
	    choices=$(partition_tree_choices)
	    debconf_select critical partman-partitioning/source_partition "$choices" asdfasdfasdf
	    case $? in
		1)
		    $noninteractive
		    ;;
		255)
		    return 1
		    ;;
	    esac
	    noninteractive='return 1'
	    source_dev=${RET%//*}
	    source_id=${RET#*//}
	done
	source_dev=${source_dev##*/}
	if perform_copying; then break; fi
    done
    return 0
}

perform_copying () {
    for s in /lib/partman/commit.d/*; do
	if [ -x $s ]; then
	    $s || {
		db_input high partman-partitioning/copy_commit_failed || true
		db_go || true
		for s in /lib/partman/init.d/*; do
		    if [ -x $s ]; then
			$s || exit 0
		    fi
		done
		exit 0
	    }
	fi
    done

    name_progress_bar partman-partitioning/progress_copying
    open_dialog COPY_PARTITION $id $source_dev $source_id
    close_dialog

    for s in /lib/partman/init.d/*; do
	if [ -x $s ]; then
	    $s || exit 0
	fi
    done
}

ask_for_source