From ac6c31c5d89225991292e48c7935bf2ea30efe01 Mon Sep 17 00:00:00 2001 From: "Dustin C. Hatch" Date: Sat, 6 Jan 2024 19:43:08 -0600 Subject: [PATCH] packages: Add after-install target unit Units that get installed via `rpm-ostree` on first boot cannot be enabled by ignition, because they do not exist when it runs `systemctl preset`. Thus, anything we want to start after its been installed needs to be explicitly started. To allow this in an extensible fashion, I've added an `after-install.target` unit and modified the `install-packages.sh` script to activate this unit once the installation is complete. The script also re-runs `systemctl preset`, so services will start automatically on subsequent boots. --- after-install.target | 2 ++ install-packages.sh | 3 +++ packages.yaml | 4 ++++ 3 files changed, 9 insertions(+) create mode 100644 after-install.target diff --git a/after-install.target b/after-install.target new file mode 100644 index 0000000..a4dad95 --- /dev/null +++ b/after-install.target @@ -0,0 +1,2 @@ +[Unit] +Description=Start services after package install diff --git a/install-packages.sh b/install-packages.sh index d5a9c55..0ec7afd 100644 --- a/install-packages.sh +++ b/install-packages.sh @@ -6,3 +6,6 @@ if [ ! -d /etc/ignition/packages.d ]; then fi cat /etc/ignition/packages.d/* | xargs rpm-ostree install --apply-live -y + +systemctl preset-all --preset-mode=enable-only +systemctl start after-install.target diff --git a/packages.yaml b/packages.yaml index 16d6cc8..e688471 100644 --- a/packages.yaml +++ b/packages.yaml @@ -14,6 +14,10 @@ storage: mode: 0644 contents: local: install-packages.service + - path: /etc/systemd/system/after-install.target + mode: 0644 + contents: + local: after-install.target systemd: units: