/lib/partman/init.d/50efi is in ubiquity 2.21.63.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
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 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 | #!/bin/sh
# This script sets method "efi" for all fat16/fat32 partitions that
# have the bootable flag set.
ARCH="$(archdetect)"
# Give the kernel a chance to create /proc/efi if appropriate.
modprobe efivars >/dev/null 2>&1 || true
in_efi_mode() {
[ -d /proc/efi ] || [ -d /sys/firmware/efi ]
}
if in_efi_mode; then
> /var/lib/partman/efi
else
case $ARCH in
i386/mac|amd64/mac)
# Intel Macs have an EFI partition, regardless of
# whether we're currently booted using BIOS
# compatibility or not (if we are, we won't be able to
# talk to EFI directly).
> /var/lib/partman/efi
;;
*)
rm -f /var/lib/partman/efi
exit 0
;;
esac
fi
. /lib/partman/lib/base.sh
gpt_efi_type=c12a7328-f81f-11d2-ba4b-00a0c93ec93b
msdos_efi_type=0xef
NUM_ESP=0
NUM_NO=0
for dev in /var/lib/partman/devices/*; do
[ -d "$dev" ] || continue
cd $dev
open_dialog GET_LABEL_TYPE
read_line label_type
close_dialog
partitions=
open_dialog PARTITIONS
while { read_line num id size type fs path name; [ "$id" ]; }; do
if [ "$fs" = fat16 ]; then
partitions="$partitions $id"
elif [ "$fs" = fat32 ] && echo "$name" |
grep -i "^EFI System Partition" >/dev/null; then
partitions="$partitions $id"
elif [ "$label_type" = msdos ] && \
[ "$(blkid -o value -s PART_ENTRY_TYPE -p "$path" 2>/dev/null)" = "$msdos_efi_type" ]; then
partitions="$partitions $id"
elif [ "$label_type" = gpt ] && \
[ "$(blkid -o value -s PART_ENTRY_TYPE -p "$path" 2>/dev/null)" = "$gpt_efi_type" ]; then
partitions="$partitions $id"
else
if [ "$fs" != "free" ]; then
NUM_NO=$(($NUM_NO + 1))
fi
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
NUM_ESP=$(($NUM_ESP + 1))
# cannot break here
else
NUM_NO=$(($NUM_NO + 1))
fi
done
close_dialog
if [ "$efi" = yes ]; then
mkdir -p $id
echo efi >$id/method
fi
done
done
log "Found $NUM_ESP ESPs, $NUM_NO non-ESPs"
if in_efi_mode && [ $NUM_ESP = 0 ] && [ $NUM_NO -gt 0 ]; then
case $ARCH in
i386/*|amd64/*)
db_fget partman-efi/non_efi_system seen
if [ $RET = false ]; then
db_input critical partman-efi/non_efi_system || true
db_go || exit 1
db_fset partman-efi/non_efi_system seen true
fi
db_get partman-efi/non_efi_system
if [ "$RET" = false ]; then
log "User chose to ignore UEFI"
touch /var/lib/partman/ignore_uefi
else
log "User chose to continue in UEFI mode"
fi
;;
esac
fi
|