File: efi

package info (click to toggle)
partman-efi 101
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 660 kB
  • sloc: sh: 393; makefile: 2
file content (46 lines) | stat: -rwxr-xr-x 1,180 bytes parent folder | download | duplicates (3)
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
#!/bin/sh

. /lib/partman/lib/base.sh

ARCH="$(archdetect)"
case $ARCH in
    i386/mac|amd64/mac)
	# Not yet sure what to do on Intel Macs.  Mounting the EFI System
	# Partition on /boot/efi will change the behaviour of grub-install,
	# so it seems best to avoid it for the moment.
	exit 0
	;;
esac

# Resolve the device that is mounted as /cdrom
cdrom_device=
while IFS=" " read -r f1 f2 f3 f4 f5 f6
do
	if [ $f2 == "/cdrom" ]; then
		cdrom_device=$f1
	fi
done < /proc/mounts

seen_efi=
for dev in $DEVICES/*; do
	[ -d $dev ] || continue
	cd $dev
	open_dialog PARTITIONS
	while { read_line num id size type fs path name; [ "$id" ]; }; do
		[ -z "$seen_efi" ] || continue
		[ $fs != free ] || continue
		[ -f "$id/method" ] || continue
		method=$(cat $id/method)
		[ "$method" = efi ] || continue
		# If the device we are mounting as /boot/efi also happens to
		# be the /cdrom device, we must remount it read-write, else
		# the mounting of /boot/efi fails.
		if [ "$path" == "$cdrom_device" ]; then
			log "Remounting /cdrom read-write for use as ESP"
			mount -o remount,rw "$path" /cdrom
		fi
		echo "$path" /boot/efi vfat umask=0077 0 1
		seen_efi=1
	done
	close_dialog
done