Skip to content

Commit 27d8ecc

Browse files
authored
Merge pull request #93 from eric-ch/stable-8-oxt-1372
STABLE-8: OXT-1372: installer: Amend disk/partition for efibootmgr
2 parents 029fb9d + 231464c commit 27d8ecc

File tree

2 files changed

+30
-2
lines changed

2 files changed

+30
-2
lines changed

common/stages/Functions/library

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,3 +396,30 @@ reread_partition_table()
396396
udevadm settle >&2
397397
}
398398

399+
#-----------------------------------------------------------
400+
# Usage: get_devnode_disk /dev/(sd[a-z]\+[0-9]\+|/dev/nvme[0-9]\+n[0-9]\+p[0-9]\+)
401+
# Prints the disk component of the argument devnode on stdout.
402+
get_devnode_disk() {
403+
local devnode="$1"
404+
local disk
405+
406+
case "${devnode}" in
407+
"/dev/nvme"*) disk="${devnode%p*}" ;;
408+
"/dev/sd"*) disk="${devnode%%[!/a-z]*}" ;;
409+
esac
410+
echo "${disk}"
411+
}
412+
413+
#-----------------------------------------------------------
414+
# Usage: get_devnode_partition /dev/(sd[a-z]\+[0-9]\+|/dev/nvme[0-9]\+n[0-9]\+p[0-9]\+)
415+
# Prints the partition component of the argument devnode on stdout.
416+
get_devnode_partition() {
417+
local devnode="$1"
418+
local part
419+
420+
case "${devnode}" in
421+
"/dev/nvme"*"p"*) part="${devnode##*nvme*n*p}" ;;
422+
"/dev/sd"*) part="${devnode##*/sd*[!0-9]}" ;;
423+
esac
424+
echo "${part}"
425+
}

part2/stages/Functions/install-main

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -540,8 +540,9 @@ remove_efi_boot_entries()
540540

541541
create_efi_boot_entries()
542542
{
543-
local DISK_DEV="$( echo ${1} | sed -e 's/[[:digit:]]*$//' )"
544-
local PART="${1#$DISK_DEV}"
543+
local DEVNODE="$1"
544+
local DISK_DEV="$(get_devnode_disk ${DEVNODE})"
545+
local PART="$(get_devnode_partition ${DEVNODE})"
545546

546547
remove_efi_boot_entries
547548

0 commit comments

Comments
 (0)