~ubuntu-core-dev/partman-efi/ubuntu

592 by Colin Watson
* Move sanity-checking scripts from finish.d to check.d. Requires
1
#!/bin/sh
2
682 by dann frazier
* Resynchronise with Debian version 62
3
if [ -f /var/lib/partman/ignore_uefi ]; then
4
	exit 0
5
fi
6
638.1.235 by Steve McIntyre
Better handle mixed UEFI and non-UEFI booting
7
if [ -f /var/lib/partman/ignore_uefi ]; then
8
	exit 0
9
fi
10
611 by Frans Pop
Move definitions.sh to ./lib/base.sh
11
. /lib/partman/lib/base.sh
592 by Colin Watson
* Move sanity-checking scripts from finish.d to check.d. Requires
12
13
have_efi=no
663 by Colin Watson
On x86 architectures, create EFI system partitions using FAT32 rather
14
new_efi_size=
592 by Colin Watson
* Move sanity-checking scripts from finish.d to check.d. Requires
15
16
# Is there at least one efi-partition?
17
for dev in $DEVICES/*; do
621 by Frans Pop
Major whitespace cleanup and a few minor coding style fixes
18
	[ -d "$dev" ] || continue
19
	cd $dev
20
	partitions=
21
	open_dialog PARTITIONS
22
	while { read_line num id size type fs path name; [ "$id" ]; }; do
23
		[ "$fs" != free ] || continue
663 by Colin Watson
On x86 architectures, create EFI system partitions using FAT32 rather
24
		partitions="$partitions $id,$num,$size"
621 by Frans Pop
Major whitespace cleanup and a few minor coding style fixes
25
	done
26
	close_dialog
27
28
	for part in $partitions; do
671 by Colin Watson
check.d/efi: Fix parsing bug in code to find the EFI System Partition
29
		id=${part%%,*}
682 by dann frazier
* Resynchronise with Debian version 62
30
		part=${part##*,}
671 by Colin Watson
check.d/efi: Fix parsing bug in code to find the EFI System Partition
31
		num=${part%%,*}
663 by Colin Watson
On x86 architectures, create EFI system partitions using FAT32 rather
32
		size=${part#*,}
621 by Frans Pop
Major whitespace cleanup and a few minor coding style fixes
33
		[ -f $id/method ] || continue
34
		method=$(cat $id/method)
35
		if [ "$method" = efi ] && [ -f $id/bootable ]; then
36
			have_efi=yes
663 by Colin Watson
On x86 architectures, create EFI system partitions using FAT32 rather
37
			if [ -f $id/format ] && [ -z "$new_efi_size" ]; then
38
				new_efi_size="$size"
39
			fi
621 by Frans Pop
Major whitespace cleanup and a few minor coding style fixes
40
		fi
41
	done
592 by Colin Watson
* Move sanity-checking scripts from finish.d to check.d. Requires
42
done
43
663 by Colin Watson
On x86 architectures, create EFI system partitions using FAT32 rather
44
# On Intel Macs, it isn't entirely clear that you have to have an EFI system
45
# partition; see http://refit.sourceforge.net/myths/ for further details. In
46
# the meantime, we only force an EFI system partition on ia64.
47
if [ -e /var/lib/partman/efi ] && \
48
   [ "$(udpkg --print-architecture)" = ia64 ] && \
49
   [ "$have_efi" = no ]; then
621 by Frans Pop
Major whitespace cleanup and a few minor coding style fixes
50
	db_input critical partman-efi/no_efi || true
51
	db_go || exit 1
52
	db_get partman-efi/no_efi
53
	if [ "$RET" = true ]; then
54
		exit 1
55
	fi
592 by Colin Watson
* Move sanity-checking scripts from finish.d to check.d. Requires
56
fi
57
663 by Colin Watson
On x86 architectures, create EFI system partitions using FAT32 rather
58
ARCH="$(archdetect)"
59
60
# Experimentally-verified minimum size for a FAT32 filesystem created using
61
# libparted.
682 by dann frazier
* Resynchronise with Debian version 62
62
if [ "$new_efi_size" ] && longint_le "$new_efi_size" 34091007; then
63
	db_input critical partman-efi/too_small_efi || true
64
	db_go || true
65
	exit 1
66
fi
663 by Colin Watson
On x86 architectures, create EFI system partitions using FAT32 rather
67
592 by Colin Watson
* Move sanity-checking scripts from finish.d to check.d. Requires
68
exit 0