Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow Rescue Partition Without Breaking USB Boot #65

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions initramfs-init.in
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,21 @@ nlplug-findfs $cryptopts -p /sbin/mdev ${KOPT_debug_init:+-d} \
$repoopts -a /tmp/apkovls
eend $?

# If the apkovl or alpine_repo specify a local absolute path like /media/sd*, make sure that it is still mounted.
# If it was put deep enough to not be auto discovered by nlplug-findfs, nlplug-findfs unmounts it.
# This fix allows having a rescue boot on the EFI partition that doesn't break auto discovery for USB/CD boot.
# I.E.: You can hide your apks and apkovl under /media/sda1/boot/rescue, use it AND still be able to boot from the USB/CD with auto discovery.
# Example of working related kernel parameters: apkovl=/media/sda1/boot/rescue/apkovl.tar.gz alpine_repo=/media/sda1/boot/rescue/apks modloop=/boot/rescue/modloop-lts
for explicit_path in "$KOPT_apkovl" "$ALPINE_REPO"; do
explicit_path_device=$(echo "$explicit_path" | sed -n 's|^/media/\(sd[^/]*\)/.*$|\1|p') # Match /media/sd*/... and keep the device name.
if [ -n "$explicit_path_device" ]; then # We have a path requiring a media mount if it matched.
# If the path was defined by nlplug-findfs and then unmounted because nothing was found.
if [ -d "/media/$explicit_path_device" ] && ! mountpoint -q "/media/$explicit_path_device" && [ -e "/dev/$explicit_path_device" ]; then
mount "/dev/$explicit_path_device" "/media/$explicit_path_device"
fi
fi
done

# Setup network interfaces
if $do_networking; then
configure_ip
Expand Down