Skip to content

Commit

Permalink
Merge pull request #93 from eric-ch/stable-8-oxt-1372
Browse files Browse the repository at this point in the history
STABLE-8: OXT-1372: installer: Amend disk/partition for efibootmgr
  • Loading branch information
jean-edouard authored Jul 9, 2018
2 parents 029fb9d + 231464c commit 27d8ecc
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
27 changes: 27 additions & 0 deletions common/stages/Functions/library
Original file line number Diff line number Diff line change
Expand Up @@ -396,3 +396,30 @@ reread_partition_table()
udevadm settle >&2
}

#-----------------------------------------------------------
# Usage: get_devnode_disk /dev/(sd[a-z]\+[0-9]\+|/dev/nvme[0-9]\+n[0-9]\+p[0-9]\+)
# Prints the disk component of the argument devnode on stdout.
get_devnode_disk() {
local devnode="$1"
local disk

case "${devnode}" in
"/dev/nvme"*) disk="${devnode%p*}" ;;
"/dev/sd"*) disk="${devnode%%[!/a-z]*}" ;;
esac
echo "${disk}"
}

#-----------------------------------------------------------
# Usage: get_devnode_partition /dev/(sd[a-z]\+[0-9]\+|/dev/nvme[0-9]\+n[0-9]\+p[0-9]\+)
# Prints the partition component of the argument devnode on stdout.
get_devnode_partition() {
local devnode="$1"
local part

case "${devnode}" in
"/dev/nvme"*"p"*) part="${devnode##*nvme*n*p}" ;;
"/dev/sd"*) part="${devnode##*/sd*[!0-9]}" ;;
esac
echo "${part}"
}
5 changes: 3 additions & 2 deletions part2/stages/Functions/install-main
Original file line number Diff line number Diff line change
Expand Up @@ -540,8 +540,9 @@ remove_efi_boot_entries()

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

remove_efi_boot_entries

Expand Down

0 comments on commit 27d8ecc

Please sign in to comment.