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

Add support for mounting /boot #119

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

paulmenzel
Copy link
Contributor

No description provided.

@paulmenzel
Copy link
Contributor Author

This still needs to be tested, and should be considered as an RFC.

Often, a separate boot partition is still desired, especially, when
encrypting the root partition.
@paulmenzel paulmenzel force-pushed the allow-boot-on-separate-partition branch from 8e3d166 to 7e502d8 Compare January 21, 2019 12:14
@paulmenzel
Copy link
Contributor Author

Creating the FS on the block device, and handling, if it’s a directory, is still missing.

Copy link
Member

@mika mika left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this, some preliminary comments while briefly going through the code.

else
if ! [ -d "${MNTPOINT}/boot" ] ; then
[ -n "$VIRTUAL" ] || mkdir -p "${MNTPOINT}/boot"
fi
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those three lines feel unnecessary, given that /boot should exist anyway and that you're creating it in line 1406 anyway :)

fi
einfo "Mounting $MOUNT_BOOT to $MNTPOINT/boot"
mkdir -p "$MNTPOINT/boot"
mount -o rw,suid,dev "$MOUNT_BOOT" "$MNTPOINT/boot"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure we need suid + dev permissions on /boot?
Also we should fail better with an actual error message.

@@ -1385,6 +1391,26 @@ mount_target() {
}
# }}}

# mount the new partition or if it's a directory do nothing at all {{{
mount_boot_target() {
if [ -n "$MOUNT_BOOT" ] ; then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this the wrong logic (as in: shouldn't this be -z ... here)?
Also we should consider verifying it's actually a valid block/LVM/... device, or at least that it can be accessed.
Since we don't format it on our own we should also check for a valid/supported filesystem?

While at it, please use "${MOUNT_BOOT}" instead of "$MOUNT_BOOT" etc. and two-space indention everywhere, that's the coding style we try to follow nowadays (yes, I'm aware that this is still inconsistent in our scripts :-/).

@@ -1642,6 +1668,7 @@ preparechroot() {
[ -n "$TARGET" ] && echo "TARGET='$(sed "s,','\\\\'',g" <<<"${TARGET}")'" >> "$CHROOT_VARIABLES"
[ -n "$UPGRADE_SYSTEM" ] && echo "UPGRADE_SYSTEM='$(sed "s,','\\\\'',g" <<<"${UPGRADE_SYSTEM}")'" >> "$CHROOT_VARIABLES"
[ -n "$TARGET_UUID" ] && echo "TARGET_UUID='$(sed "s,','\\\\'',g" <<<"${TARGET_UUID}")'" >> "$CHROOT_VARIABLES"
[ -n "$BOOT_UUID" ] && echo "BOOT_UUID='$(sed "s,','\\\\'',g" <<<"${BOOT_UUID}")'" >> "$CHROOT_VARIABLES"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is unused and not yet handled inside chroot-script?

@@ -372,6 +374,9 @@ while :; do
--target|-t) # Target partition (/dev/...) or directory
shift; _opt_target="$1"
;;
--mountboot) # Target partition (/dev/...) or directory
shift; _opt_mountboot="$1"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you forgot to add it to the getopt handling.

# mount the new partition or if it's a directory do nothing at all {{{
mount_boot_target() {
if [ -n "$MOUNT_BOOT" ] ; then
einfo "/boot is not on a separate partition, nothing to mount."
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can just "return 0" afterwards and don't need the else ... afterwards, since nothing from this function needs to be executed if separate /boot isn't requested.

@mika
Copy link
Member

mika commented Aug 21, 2019

@paulmenzel ping, are you still interested in getting this submitted? :)

@jkirk
Copy link
Contributor

jkirk commented Aug 22, 2019

I stumbled over this today, so it would be really nice if we can get this into grml-debootstrap. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants