Skip to content

Commit 2b61be3

Browse files
johannbgharaldh
authored andcommitted
feat(systemd-tmpfiles): introducing the systemd-tmpfiles module
Introducing the systemd-tmpfiles module
1 parent 9ffe2e4 commit 2b61be3

File tree

2 files changed

+72
-0
lines changed

2 files changed

+72
-0
lines changed
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
#!/bin/bash
2+
# This file is part of dracut.
3+
# SPDX-License-Identifier: GPL-2.0-or-later
4+
5+
# Prerequisite check(s) for module.
6+
check() {
7+
8+
# If the binary(s) requirements are not fulfilled the module can't be installed.
9+
require_binaries systemd-tmpfiles || return 1
10+
11+
# Return 255 to only include the module, if another module requires it.
12+
return 255
13+
14+
}
15+
16+
# Module dependency requirements.
17+
depends() {
18+
19+
# Return 0 to include the dependent module(s) in the initramfs.
20+
return 0
21+
22+
}
23+
24+
# Install the required file(s) and directories for the module in the initramfs.
25+
install() {
26+
27+
# Excluding "$tmpfilesdir/home.conf", sets up /home /srv
28+
# Excluding "$tmpfilesdir/portables.conf", belongs in seperated portables module
29+
# Excluding "$tmpfilesdir/journal-nocow.conf", requires spesific btrfs setup
30+
# Excluding "$tmpfilesdir/legacy.conf", belongs in seperated legacy module
31+
# Excluding "$tmpfilesdir/systemd-nologin.conf", belongs in seperated pam module
32+
# Excluding "$tmpfilesdir/systemd-nspawn.conf", belongs in seperated machined module
33+
# Excluding "$tmpfilesdir/systemd-pstore.conf", belongs in seperated pstore module
34+
# Excluding "$tmpfilesdir/x11.conf", belongs in seperated x11 module
35+
36+
37+
inst_multiple -o \
38+
/usr/lib/group \
39+
/usr/lib/passwd \
40+
"$tmpfilesdir/etc.conf" \
41+
"$tmpfilesdir/static-nodes-permissions.conf" \
42+
"$tmpfilesdir/systemd-tmp.conf" \
43+
"$tmpfilesdir/systemd.conf" \
44+
"$tmpfilesdir/var.conf" \
45+
"$systemdsystemunitdir"/systemd-tmpfiles-clean.service \
46+
"$systemdsystemunitdir/systemd-tmpfiles-clean.service.d/*.conf" \
47+
"$systemdsystemunitdir"/systemd-tmpfiles-setup.service \
48+
"$systemdsystemunitdir/systemd-tmpfiles-setup.service.d/*.conf" \
49+
"$systemdsystemunitdir"/systemd-tmpfiles-setup-dev.service \
50+
"$systemdsystemunitdir/systemd-tmpfiles-setup-dev.service.d/*.conf" \
51+
"$systemdsystemunitdir"/systemd-tmpfiles-clean.timer \
52+
"$systemdsystemunitdir"/timers.target.wants/systemd-tmpfiles-clean.timer \
53+
"$systemdsystemunitdir"/sysinit.target.wants/systemd-tmpfiles-setup-dev.service \
54+
"$systemdsystemunitdir"/sysinit.target.wants/systemd-tmpfiles-setup.service \
55+
systemd-tmpfiles
56+
57+
# Install the hosts local user configurations if enabled.
58+
if [[ $hostonly ]]; then
59+
inst_multiple -H -o \
60+
/etc/group \
61+
/etc/passwd \
62+
"$tmpfilesconfdir/*.conf" \
63+
"$systemdsystemconfdir"/systemd-tmpfiles-clean.service \
64+
"$systemdsystemconfdir/systemd-tmpfiles-clean.service.d/*.conf" \
65+
"$systemdsystemconfdir"/systemd-tmpfiles-setup.service \
66+
"$systemdsystemconfdir/systemd-tmpfiles-setup.service.d/*.conf" \
67+
"$systemdsystemconfdir"/systemd-tmpfiles-setup-dev.service \
68+
"$systemdsystemconfdir/systemd-tmpfiles-setup-dev.service.d/*.conf"
69+
fi
70+
71+
}

pkgbuild/dracut.spec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,7 @@ echo 'dracut_rescue_image="yes"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/
335335
%{dracutlibdir}/modules.d/01systemd-sysusers
336336
%{dracutlibdir}/modules.d/01systemd-timedated
337337
%{dracutlibdir}/modules.d/01systemd-timesyncd
338+
%{dracutlibdir}/modules.d/01systemd-tmpfiles
338339
%{dracutlibdir}/modules.d/01systemd-udevd
339340
%{dracutlibdir}/modules.d/01systemd-veritysetup
340341
%{dracutlibdir}/modules.d/03modsign

0 commit comments

Comments
 (0)