-
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
35coreos-ignition: move ignition-setup-user.service
here
#1095
Merged
bgilbert
merged 4 commits into
coreos:testing-devel
from
bgilbert:setup-user/testing-devel
Jul 9, 2021
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
d1a7cd5
35coreos-ignition: depend on coreos-live; assume is-live-image exists
bgilbert 649cd7e
35coreos-ignition: add ignition-setup-user.service from Ignition repo
bgilbert 197382a
35coreos-ignition: update ignition-setup-user for this repo
bgilbert 5e93174
40ignition-ostree: update an ignition-fetch dep to fetch-offline
bgilbert 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
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
...ay.d/05core/usr/lib/dracut/modules.d/35coreos-ignition/coreos-ignition-setup-user.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 @@ | ||
[Unit] | ||
Description=CoreOS Ignition User Config Setup | ||
Documentation=https://github.com/coreos/ignition | ||
ConditionPathExists=/etc/initrd-release | ||
DefaultDependencies=false | ||
|
||
# We run before config fetch because we may copy in new/different configs | ||
# for Ignition to consume. | ||
Before=ignition-fetch-offline.service | ||
|
||
OnFailure=emergency.target | ||
OnFailureJobMode=isolate | ||
|
||
# On diskful boots, coreos-diskful-generator adds Requires/After on | ||
# dev-disk-by\x2dlabel-boot.device and coreos-gpt-setup.service | ||
|
||
[Service] | ||
Type=oneshot | ||
RemainAfterExit=yes | ||
# The 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 | ||
ExecStart=/usr/sbin/coreos-ignition-setup-user |
32 changes: 32 additions & 0 deletions
32
overlay.d/05core/usr/lib/dracut/modules.d/35coreos-ignition/coreos-ignition-setup-user.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,32 @@ | ||
#!/bin/bash | ||
set -euo pipefail | ||
|
||
copy_file_if_exists() { | ||
src="${1}"; dst="${2}" | ||
if [ -f "${src}" ]; then | ||
echo "Copying ${src} to ${dst}" | ||
cp "${src}" "${dst}" | ||
else | ||
echo "File ${src} does not exist.. Skipping copy" | ||
fi | ||
} | ||
|
||
destination=/usr/lib/ignition | ||
mkdir -p $destination | ||
|
||
if is-live-image; then | ||
# Live image. If the user has supplied a config.ign via an appended | ||
# initrd, put it in the right place. | ||
copy_file_if_exists "/config.ign" "${destination}/user.ign" | ||
else | ||
# We will support a user embedded config in the boot partition | ||
# under $bootmnt/ignition/config.ign. Note that we mount /boot | ||
# but we don't unmount boot because we are run in a systemd unit | ||
# with MountFlags=slave so it is unmounted for us. | ||
bootmnt=/mnt/boot_partition | ||
mkdir -p $bootmnt | ||
# mount as read-only since we don't strictly need write access and we may be | ||
# running alongside other code that also has it mounted ro | ||
mount -o ro /dev/disk/by-label/boot $bootmnt | ||
copy_file_if_exists "${bootmnt}/ignition/config.ign" "${destination}/user.ign" | ||
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
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
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.
Hmm, I guess this bit could live in the live generator now. And then the service would be pulled in by
diskful.target
directly and e.g. we could hardcode the variousRequires
that are currently dynamic. OTOH, it's nice to have everything related to the Ignition config centralized, so... meh, maybe not worth it.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.
Yeah, I'm on the fence too. Leaving alone for now.