File: autopartition

package info (click to toggle)
partman-auto 178
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,740 kB
  • sloc: sh: 1,342; makefile: 17
file content (49 lines) | stat: -rwxr-xr-x 1,210 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
#!/bin/sh

. /usr/lib/partman/lib/base.sh
. /usr/lib/partman/lib/recipes.sh
. /usr/lib/partman/lib/auto-shared.sh

devs="$1"

clean_method

for dev in $devs; do
	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.
		# Do not reuse existing partitions
		reuse=
		target="$target: $(longint2human $size)"
		free_size=$(convert_to_megabytes $size)

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

		auto_init_disks "$dev" || exit $?
		get_last_free_partition_infos $dev
	else
		# Two parameters, being run on selected free space.
		# Reuse existing partitions
		reuse=reuse
		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=$(convert_to_megabytes $free_size)

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

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

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