-
Notifications
You must be signed in to change notification settings - Fork 157
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
30ignition-coreos: Add coreos-boot-edit.{service,sh}
#743
Merged
kelvinfan001
merged 2 commits into
coreos:testing-devel
from
kelvinfan001:kfan-cleanup-firstboot-network
Nov 23, 2020
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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
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
23 changes: 23 additions & 0 deletions
23
overlay.d/05core/usr/lib/dracut/modules.d/30ignition-coreos/coreos-boot-edit.service
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,23 @@ | ||
# This unit will run late in the initrd process after Ignition is completed | ||
# successfully and temporarily mount /boot read-write to make edits | ||
# (e.g. removing firstboot networking configuration files if necessary). | ||
|
||
[Unit] | ||
Description=CoreOS Boot Edit | ||
ConditionPathExists=/usr/lib/initrd-release | ||
OnFailure=emergency.target | ||
OnFailureJobMode=isolate | ||
|
||
# Since we are mounting /boot, require the device first | ||
Requires=dev-disk-by\x2dlabel-boot.device | ||
After=dev-disk-by\x2dlabel-boot.device | ||
# Start after Ignition has finished | ||
After=ignition-files.service | ||
|
||
[Service] | ||
Type=oneshot | ||
ExecStart=/usr/sbin/coreos-boot-edit | ||
RemainAfterExit=yes | ||
# MountFlags=slave is so the umount of /boot is guaranteed to happen. | ||
# /boot will only be mounted for the lifetime of the unit. | ||
MountFlags=slave |
22 changes: 22 additions & 0 deletions
22
overlay.d/05core/usr/lib/dracut/modules.d/30ignition-coreos/coreos-boot-edit.sh
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,22 @@ | ||
#!/bin/bash | ||
set -euo pipefail | ||
|
||
# For a description of how this is used, see `coreos-boot-edit.service`. | ||
|
||
# Mount /boot. Note that we mount /boot but we don't unmount it because we | ||
# are run in a systemd unit with MountFlags=slave so it is unmounted for us. | ||
bootmnt=/mnt/boot_partition | ||
mkdir -p ${bootmnt} | ||
bootdev=/dev/disk/by-label/boot | ||
mount -o rw ${bootdev} ${bootmnt} | ||
|
||
# Clean up firstboot networking config files if the user copied them into the | ||
# installed system (most likely by using `coreos-installer install --copy-network`). | ||
firstboot_network_dir_basename="coreos-firstboot-network" | ||
initramfs_firstboot_network_dir="${bootmnt}/${firstboot_network_dir_basename}" | ||
copy_firstboot_network_stamp="/run/coreos-copy-firstboot-network.stamp" | ||
if [ -f ${copy_firstboot_network_stamp} ]; then | ||
rm -vrf ${initramfs_firstboot_network_dir} | ||
else | ||
echo "info: no firstboot networking config files to clean from /boot. skipping" | ||
fi |
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 |
---|---|---|
|
@@ -36,4 +36,11 @@ install() { | |
# units only started when we have a boot disk | ||
# path generated by systemd-escape --path /dev/disk/by-label/root | ||
install_ignition_unit coreos-gpt-setup.service ignition-diskful.target | ||
|
||
inst_script "$moddir/coreos-boot-edit.sh" \ | ||
"/usr/sbin/coreos-boot-edit" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, this should probably be |
||
# Only start when the system has disks since we are editing /boot. | ||
install_ignition_unit "coreos-boot-edit.service" \ | ||
"ignition-diskful.target" | ||
|
||
} |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that's needed with
After=ignition-files.service
. But this probably does not hurt either.