File: prep

package info (click to toggle)
partman-prep 24
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 396 kB
  • sloc: sh: 132; makefile: 2
file content (58 lines) | stat: -rwxr-xr-x 1,193 bytes parent folder | download | duplicates (6)
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
#!/bin/sh

. /lib/partman/lib/base.sh

have_prep=no
good_place=no

# Is there at least one prep-partition?
for dev in $DEVICES/*; do
	[ -d "$dev" ] || continue
	cd $dev
	partitions=
	open_dialog PARTITIONS
	while { read_line num id size type fs path name; [ "$id" ]; }; do
		[ "$fs" != free ] || continue
		partitions="$partitions $id,$path"
	done
	close_dialog

	for part in $partitions; do
		id=${part%,*}
		path=${part#*,}
		[ -f $id/method ] || continue
		method=$(cat $id/method)
		if [ "$method" = prep ]; then
			end=${id#*-}
			have_prep=yes
			if longint_le "$end" 8589934592; then
				good_place=yes
				good_paths="${good_paths:+$good_paths,}$path"
			fi
		fi
	done
done

if [ $good_place = no ]; then
	if [ $have_prep = no ]; then
		db_fset partman-prep/no_prep seen false
		db_input critical partman-prep/no_prep || true
		db_go || exit 1
		db_get partman-prep/no_prep
		if [ "$RET" = true ]; then
			exit 1
		fi
	else
		db_fset partman-prep/wrong_place seen false
		db_input critical partman-prep/wrong_place || true
		db_go || exit 1
		db_get partman-prep/wrong_place
		if [ "$RET" = true ]; then
			exit 1
		fi
	fi
fi

db_set partman-prep/boot_partitions "$good_paths"

exit 0