File: newworld

package info (click to toggle)
partman-newworld 11
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 272 kB
  • ctags: 2
  • sloc: sh: 195; makefile: 30
file content (56 lines) | stat: -rwxr-xr-x 1,237 bytes parent folder | download | duplicates (2)
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
#!/bin/sh

. /lib/partman/definitions.sh

have_newworld=no
good_size=yes

# Is there at least one new-world 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" = hfs ] || continue
	partitions="$partitions $id,$size,$path"
    done
    close_dialog
    
    for part in $partitions; do
	id="${part%%,*}"
	[ -f $id/method ] || continue
	method=$(cat $id/method)
	if [ "$method" = newworld ]; then
	    cdr="${part#*,}"
	    size="${cdr%%,*}"
	    have_newworld=yes
	    if longint_le "$size" 819199; then
		good_size=no
	    else
		path="${cdr#*,}"
		good_paths="${good_paths:+$good_paths,}$path"
	    fi
	fi
    done
done

if [ "$have_newworld" = no ]; then
    db_input critical partman-newworld/no_newworld || true
    db_go || exit 1
    db_get partman-newworld/no_newworld
    if [ "$RET" = 'true' ]; then
	exit 1
    fi
elif [ "$good_size" = no ]; then
    db_input critical partman-newworld/wrong_size || true
    db_go || exit 1
    db_get partman-newworld/wrong_size
    if [ "$RET" = 'true' ]; then
	exit 1
    fi
fi

db_set partman-newworld/boot_partitions "$good_paths"

exit 0