packages: Add framework for installing packages
Some machines may need to install multiple packages for separate use cases. Requiring each use case to define a systemd unit that runs `rpm-ostree install` directly would be cumbersome and also quite slow, as each one would have to run in turn. Instead, now there is a single *install-packages.service* which installs all of the packages listed in files in `/etc/ignition/packages.d`. On first boot, all files in that directory are read and all the packages they list will be installed in a single `rpm-ostree install` invocation.master
parent
22c085b35d
commit
2048713452
|
@ -0,0 +1,17 @@
|
|||
# vim: set ft=systemd :
|
||||
[Unit]
|
||||
Description=Install collectd
|
||||
After=network-online.target
|
||||
Wants=network-online.target
|
||||
Before=zincati.service
|
||||
ConditionPathExists=/etc/ignition/packages.d
|
||||
ConditionPathExists=/etc/ignition/packages.installed
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
RemainAfterExit=yes
|
||||
ExecStart=/bin/sh /etc/ignition/install-packages.sh
|
||||
ExecStartPost=/bin/touch /etc/ignition/packages.installed
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
|
@ -0,0 +1,8 @@
|
|||
#!/bin/sh
|
||||
# vim: set sw=4 ts=4 sts=4 et :
|
||||
|
||||
if [ ! -d /etc/ignition/packages.d ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
cat /etc/ignition/packages.d/* | xargs rpm-ostree install --apply-live -y
|
|
@ -0,0 +1,16 @@
|
|||
variant: fcos
|
||||
version: 1.4.0
|
||||
|
||||
storage:
|
||||
directories:
|
||||
- path: /etc/ignition/packages.d
|
||||
mode: 0755
|
||||
files:
|
||||
- path: /etc/ignition/install-packages.sh
|
||||
mode: 0755
|
||||
contents:
|
||||
local: install-packages.sh
|
||||
- path: /etc/systemd/system/install-packages.service
|
||||
mode: 0644
|
||||
contents:
|
||||
local: install-packages.service
|
Loading…
Reference in New Issue