Skip to content

Commit

Permalink
Handle pre-mounted efi partitions
Browse files Browse the repository at this point in the history
  • Loading branch information
lonkamikaze committed Mar 22, 2021
1 parent cbb99b0 commit a9433d2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/loaderupdate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ bsda:obj:createClass loaderupdate:Mount \
# Failed to create mountpoint or failed to mount
#
loaderupdate:Mount.init() {
local device mountpoint
local device mountpoint nullfs
device="${1}"
shift
mountpoint="${1}"
Expand All @@ -209,6 +209,12 @@ loaderupdate:Mount.init() {
return 1
fi
setvar ${this}mountpoint "${mountpoint}"
nullfs="$(/sbin/mount -p | /usr/bin/awk -vDEV="${device}" '$1 == DEV && $0=$2')"
if [ -n "${nullfs}" ]; then
# fall back to a nullfs mount if the device is already mounted
device="${nullfs%%$'\n'*}"
set -- -t nullfs
fi
if ! /sbin/mount "$@" "${device}" "${mountpoint}"; then
bsda:err:raise E_LOADERUPDATE_MOUNT \
"ERROR: Failed to mount device: ${device}"
Expand Down

0 comments on commit a9433d2

Please sign in to comment.