Skip to content

Commit 46b1b95

Browse files
committed
build_sysext: Trigger tmpfiles.d processing when sysext includes config
A new systemd unit is needed for this because the one that systemd ships is only suitable for use at boot time. Signed-off-by: James Le Cuirot <jlecuirot@microsoft.com>
1 parent 07d27dc commit 46b1b95

2 files changed

Lines changed: 19 additions & 0 deletions

File tree

‎build_sysext‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,7 @@ EXTENSION_RELOAD_MANAGER=0
294294
[[ -d ${BUILD_DIR}/${FLAGS_install_root_basename}/usr/lib/systemd ]] && EXTENSION_RELOAD_MANAGER=1
295295

296296
EXTENSION_RESTART_UNITS=()
297+
[[ -d ${BUILD_DIR}/${FLAGS_install_root_basename}/usr/lib/tmpfiles.d ]] && EXTENSION_RESTART_UNITS+=( systemd-tmpfiles-setup-again.service )
297298
[[ -d ${BUILD_DIR}/${FLAGS_install_root_basename}/usr/lib/udev/rules.d ]] && EXTENSION_RESTART_UNITS+=( systemd-udev-trigger.service )
298299

299300
grep . <<EOF | install -m0644 -D /dev/stdin "${BUILD_DIR}/${FLAGS_install_root_basename}/usr/lib/extension-release.d/extension-release.${SYSEXT_ID}"

‎sdk_container/src/third_party/coreos-overlay/coreos/config/env/sys-apps/systemd‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,24 @@ EOF
180180

181181
[Service]
182182
ExecStartPre=-udevadm control --reload
183+
EOF
184+
185+
insinto "$(systemd_get_systemunitdir)"
186+
newins - systemd-tmpfiles-setup-again.service <<'EOF'
187+
# System extensions that include tmpfiles.d configuration can restart this
188+
# service to have it processed when merging.
189+
190+
[Unit]
191+
Description=Create System Files and Directories After Booting
192+
Documentation=man:tmpfiles.d(5) man:systemd-tmpfiles(8)
193+
194+
[Service]
195+
Type=oneshot
196+
RemainAfterExit=yes
197+
ExecStart=systemd-tmpfiles --create --remove --exclude-prefix=/dev
198+
SuccessExitStatus=DATAERR CANTCREAT
199+
ImportCredential=tmpfiles.*
200+
RestrictSUIDSGID=no
183201
EOF
184202
)
185203
}

0 commit comments

Comments
 (0)