Skip to content

Commit

Permalink
40ignition-ostree: add service for deleting /etc enablements
Browse files Browse the repository at this point in the history
A lot of backstory on this, but essentially right now, we always bake a
run of `systemctl preset-all` into the OSTree because upgrading hosts
rely on these links for service enablement.

In hindsight, we should've just stuck with pure systemd preset only as
canonicaly from the get go, though it's a bit difficult now to
transition from one to the other without breaking things. (Though I'll
note not impossible, since we do have update barriers which could allow
us to e.g. run a script to restore lost symlinks).

For now though, let's at least fix the ability to disable services,
which is a pretty big gap in our Ignition configuration story right now.

Related: systemd/systemd#15205
Related: coreos#77

Closes: coreos/fedora-coreos-tracker#392
  • Loading branch information
jlebon committed Apr 21, 2020
1 parent a8c84a3 commit 9af34c3
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[Unit]
Description=Delete /etc Service Enablements
DefaultDependencies=false
ConditionKernelCommandLine=|ostree
ConditionPathExists=|/run/ostree-live

# Really, we don't really expect mount points for /etc, so we could just order
# after initrd-root-fs.target, but meh... doesn't hurt to pretend we support
# that.
After=ignition-mount.service

# But *before* any user-specified enablement
Before=ignition-files.service

[Service]
Type=oneshot
RemainAfterExit=yes
# use glob instead of nuking /etc/systemd/system itself so that we don't end up
# recreating it from the initrd as unlabeled for RHCOS
ExecStart=/usr/bin/sh -c "rm -rf /sysroot/etc/systemd/system/*"
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,6 @@ install() {
inst_script "$moddir/coreos-growpart" /usr/libexec/coreos-growpart

inst_script "$moddir/coreos-relabel" /usr/bin/coreos-relabel

install_ignition_unit ignition-ostree-delete-etc-services.service
}

0 comments on commit 9af34c3

Please sign in to comment.