standard: convert apply updates enablement to a preset

The way it was done before with a symlink in
/usr/lib/systemd/system/default.target.wants/bootc-fetch-apply-updates.timer
meant that users (or derivative builds) can't easily disable
this service without masking it.

The docs at [1] would work for the current boot because of the
`--now` but the next boot the timer would be running again.

[1] e7d868de85/modules/ROOT/pages/manual-rollbacks.adoc
This commit is contained in:
Dusty Mabe 2026-09-29 12:43:05 -04:00
commit 08747c33d0
No known key found for this signature in database
GPG key ID: D0181D71212F1FA4
4 changed files with 31 additions and 9 deletions

View file

@ -1,8 +0,0 @@
# Enable automatic updates by default
postprocess:
- |
#!/usr/bin/env bash
set -xeuo pipefail
target=/usr/lib/systemd/system/default.target.wants
mkdir -p $target
ln -s ../bootc-fetch-apply-updates.timer $target

View file

@ -9,13 +9,13 @@ recommends: true
include:
- ../minimal-plus/manifest.yaml
- autoupdates.yaml
- networking-tools.yaml
- system-configuration.yaml
- coreos-user-experience.yaml
- persistent-journal.yaml
- initramfs-full.yaml
- generic-growfs.yaml
- systemd-presets.yaml
packages:
# Include and set the default editor

View file

@ -0,0 +1,14 @@
# Postprocessing relating to systemd presets on the system.
#
# Note this relies on the `systemctl preset-all` run from
# minimal/systemd-presets.yaml running after this postprocess.
postprocess:
# Enable automatic updates by default
- |
#!/bin/bash
set -xeuo pipefail
# Enable automatic updates by default
cat <<EOF > usr/lib/systemd/system-preset/86-bootc-standard.preset
# Enable automatic updates by default
enable bootc-fetch-apply-updates.timer
EOF

View file

@ -0,0 +1,16 @@
#!/bin/bash
set -xeuo pipefail
# Right now the `systemctl preset-all` runs via a postprocess in
# minimal/systemd-presets.yaml but the preset for the timer is only
# set up in a postprocess in standard/systemd-presets.yaml.
#
# This test ensures that the ordering works out such that the preset
# from standard got applied.
#
# Verify if the preset file exists (only on standard) that the timer
# is enabled. Right now the `s
if [ -f /usr/lib/systemd/system-preset/86-bootc-standard.preset ]; then
# Will return success (0) if enabled or failure (1) if not
systemctl is-enabled bootc-fetch-apply-updates.timer
fi