-
Notifications
You must be signed in to change notification settings - Fork 26
NO-JIRA: Add bootloader-migrate-generator to create bootloader-migrate.service
#23
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
Merged
openshift-merge-bot
merged 1 commit into
coreos:main
from
HuijingHei:grub-migrate-generator
Jul 10, 2025
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
55 changes: 55 additions & 0 deletions
55
overlay.d/05rhcos/usr/lib/systemd/system-generators/bootloader-migrate-generator
This file contains hidden or 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,55 @@ | ||
| #!/bin/bash | ||
| set -euo pipefail | ||
|
jlebon marked this conversation as resolved.
|
||
|
|
||
|
HuijingHei marked this conversation as resolved.
|
||
| . /usr/lib/coreos/generator-lib.sh | ||
|
|
||
| # This unit runs `bootupctl adopt-and-update --with-static-config` to | ||
| # migrate RHCOS systems (e.g., OpenShift RHCOS 4.1/4.2 nodes) to use a | ||
| # static GRUB config. | ||
|
|
||
| # It is intended to run only once, and only if `sysroot.bootloader` is | ||
| # unset, which is only the case on 4.1/4.2 aleph system. Systems running | ||
| # 4.3+ already use the static config by default, and s390x uses `zipl`. | ||
| # To avoid running unnecessarily on unaffected systems, this unit is | ||
| # generated dynamically via a systemd generator. | ||
|
|
||
| # We need to keep this at minimum for 9.6, but possibly also 9.8 if | ||
| # bootimage skew enforcement hasn't landed yet to prevent incompatible | ||
| # nodes during scale-up. See https://github.com/openshift/enhancements/pull/1761 | ||
|
|
||
| UNIT_DIR="${1:-/tmp}" | ||
|
|
||
| if ostree config --repo=/sysroot/ostree/repo get sysroot.bootloader &>/dev/null; then | ||
| # sysroot.bootloader is set, exit early | ||
| echo "Skipping bootloader-migrate-generator: sysroot.bootloader is set" | ||
| exit 0 | ||
| fi | ||
|
|
||
| write_service() { | ||
| local service="bootloader-migrate.service" | ||
|
|
||
| cat > "${UNIT_DIR}/${service}" <<EOF | ||
| # generated by bootloader-migrate-generator | ||
| [Unit] | ||
| # e.g. OpenShift RHCOS 4.1/4.2 nodes | ||
| Description=Static GRUB config migration | ||
|
HuijingHei marked this conversation as resolved.
|
||
| Documentation=https://issues.redhat.com/browse/OCPBUGS-52485 | ||
| RequiresMountsFor=/sysroot /boot | ||
|
|
||
| [Service] | ||
| Type=oneshot | ||
| ExecStart=/usr/bin/bootupctl adopt-and-update --with-static-config | ||
| RemainAfterExit=yes | ||
| # Keep this stuff in sync with SYSTEMD_ARGS_BOOTUPD in general | ||
| PrivateNetwork=yes | ||
| ProtectHome=yes | ||
| KillMode=mixed | ||
|
jlebon marked this conversation as resolved.
|
||
| MountFlags=slave | ||
| EOF | ||
|
|
||
| local wants_dir="${UNIT_DIR}/multi-user.target.wants" | ||
| mkdir -p "${wants_dir}" | ||
| ln -sf "../${service}" "${wants_dir}/${service}" | ||
| } | ||
|
|
||
| write_service | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.