File: efi

package info (click to toggle)
partman-efi 23
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 400 kB
  • sloc: sh: 200; makefile: 2
file content (42 lines) | stat: -rwxr-xr-x 847 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
#!/bin/sh

# This script sets method "efi" for all fat16 partitions that have the boot
# flag set.

# Give the kernel a chance to create /proc/efi if appropriate.
modprobe efivars >/dev/null 2>&1 || true

if [ ! -d /proc/efi ] && [ ! -d /sys/firmware/efi ]; then
	exit 0
fi

. /lib/partman/lib/base.sh

for dev in /var/lib/partman/devices/*; do
	[ -d "$dev" ] || continue
	cd $dev
	partitions=
	open_dialog PARTITIONS
	while { read_line num id size type fs path name; [ "$id" ]; }; do
		if [ "$fs" = fat16 ]; then
			partitions="$partitions $id"
		fi
	done
	close_dialog

	for id in $partitions; do
	efi=no
	open_dialog GET_FLAGS $id
	while { read_line flag; [ "$flag" ]; }; do
		if [ "$flag" = boot ]; then
			efi=yes
			# cannot break here
		fi
	done
	close_dialog
	if [ "$efi" = yes ]; then
		mkdir -p $id
		echo efi >$id/method
	fi
	done
done