-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support is added for greenboot to work with read-only /boot. It uses PrivateMounts=yes to isolate the system and remounts boot as rw followed by setting the grub parameters as per healthcheck. The following services are affected: greenboot-grub2-set-success.service greenboot-grub2-set-counter.service greenboot-rpm-ostree-check-fallback.service The grub2-editenv command is decoupled from greenboot-grub2-set-success.service and is part of a separate script. Signed-off-by: saypaul <paul.sayan@gmail.com>
- Loading branch information
Showing
7 changed files
with
83 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/bin/bash | ||
|
||
set -eo pipefail | ||
|
||
# Check if /boot is mounted as read-only, and remount as read-write if necessary | ||
if grep -q " /boot .* ro," /proc/mounts; then | ||
mount -o remount,rw /boot || exit 1 | ||
fi | ||
|
||
# Run the grub2-editenv commands | ||
if ! /usr/bin/grub2-editenv /boot/grub2/grubenv set boot_success=1; then | ||
# If the first command fails, remount /boot as read-only and exit with failure | ||
if grep -q " /boot .* rw," /proc/mounts; then | ||
mount -o remount,ro /boot || exit 1 | ||
fi | ||
exit 1 | ||
fi | ||
|
||
if ! /usr/bin/grub2-editenv /boot/grubenv unset boot_counter; then | ||
# If the second command fails, remount /boot as read-only and exit with failure | ||
if grep -q " /boot .* rw," /proc/mounts; then | ||
mount -o remount,ro /boot || exit 1 | ||
fi | ||
exit 1 | ||
fi | ||
|
||
# Remount /boot as read-only if it was mounted as read-write | ||
if grep -q " /boot .* rw," /proc/mounts; then | ||
mount -o remount,ro /boot || exit 1 | ||
fi | ||
|
||
# If everything succeeded, exit with success | ||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters