File: autopartition

package info (click to toggle)
partman-auto 68etch1
  • links: PTS
  • area: main
  • in suites: etch
  • size: 1,224 kB
  • ctags: 22
  • sloc: sh: 838; makefile: 43
file content (40 lines) | stat: -rwxr-xr-x 1,047 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
#!/bin/sh

. /lib/partman/definitions.sh
. /lib/partman/recipes.sh
. /lib/partman/auto-shared.sh

dev=$1
cd $dev

[ -f size ] || exit 1
size=$(cat size)
target="$(humandev $(cat device)) - $(cat model)"

if [ -z "$2" ]; then
	# Only one parameter. Being run for initial autopartitioning.

	target="$target: $(longint2human $size)"
	free_size=$(expr 0000000"$size" : '0*\(..*\)......$') # convert to megabytes

	choose_recipe default "$target" "$free_size" || exit $?

	wipe_disk || exit $?
else
	# Two parameters, being run on selected free space.
	free_space=$2
	
	open_dialog PARTITION_INFO $free_space
	read_line x1 x2 free_size x3 x4 x5 x6
	close_dialog

	target="$target: $(longint2human $free_size) ($(longint2human $size))"
	free_size=$(expr 0000000"$free_size" : '0*\(..*\)......$') # convert to megabytes

	choose_recipe default "$target" "$free_size" || exit $?
fi

perform_recipe $dev $free_space $recipe || exit $?

# default to accepting the autopartitioning
menudir_default_choice /lib/partman/choose_partition finish finish || true