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.
This commit is contained in:
2
after-install.target
Normal file
2
after-install.target
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Start services after package install
|
||||||
@@ -6,3 +6,6 @@ if [ ! -d /etc/ignition/packages.d ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
cat /etc/ignition/packages.d/* | xargs rpm-ostree install --apply-live -y
|
cat /etc/ignition/packages.d/* | xargs rpm-ostree install --apply-live -y
|
||||||
|
|
||||||
|
systemctl preset-all --preset-mode=enable-only
|
||||||
|
systemctl start after-install.target
|
||||||
|
|||||||
@@ -14,6 +14,10 @@ storage:
|
|||||||
mode: 0644
|
mode: 0644
|
||||||
contents:
|
contents:
|
||||||
local: install-packages.service
|
local: install-packages.service
|
||||||
|
- path: /etc/systemd/system/after-install.target
|
||||||
|
mode: 0644
|
||||||
|
contents:
|
||||||
|
local: after-install.target
|
||||||
|
|
||||||
systemd:
|
systemd:
|
||||||
units:
|
units:
|
||||||
|
|||||||
Reference in New Issue
Block a user