4 SYSTEMD_VERSION
=$
($systemdutildir/systemd
--version |
{ read a b a
; echo $b; })
5 # Check if the systemd version is a valid number
6 if ! [[ $SYSTEMD_VERSION =~ ^
[0-9]+$
]]; then
7 dfatal
"systemd version is not a number ($SYSTEMD_VERSION)"
16 [[ $mount_needs ]] && return 1
17 if require_binaries
$systemdutildir/systemd
; then
18 SYSTEMD_VERSION
=$
(getSystemdVersion
)
19 (( $SYSTEMD_VERSION >= 198 )) && return 0
32 hostonly
='' instmods autofs4 ipv6 algif_hash hmac sha256
40 if [[ "$prefix" == /run
/* ]]; then
41 dfatal
"systemd does not work with a prefix, which contains \"/run\"!!"
45 if [ $
(getSystemdVersion
) -ge 240 ]; then
47 $systemdutildir/system-generators
/systemd-debug-generator \
48 $systemdsystemunitdir/debug-shell.service
52 $systemdutildir/systemd \
53 $systemdutildir/systemd-coredump \
54 $systemdutildir/systemd-cgroups-agent \
55 $systemdutildir/systemd-shutdown \
56 $systemdutildir/systemd-reply-password \
57 $systemdutildir/systemd-fsck \
58 $systemdutildir/systemd-udevd \
59 $systemdutildir/systemd-journald \
60 $systemdutildir/systemd-sysctl \
61 $systemdutildir/systemd-modules-load \
62 $systemdutildir/systemd-vconsole-setup \
63 $systemdutildir/systemd-volatile-root \
64 $systemdutildir/system-generators
/systemd-fstab-generator \
65 $systemdutildir/system-generators
/systemd-gpt-auto-generator \
67 $systemdsystemunitdir/cryptsetup.target \
68 $systemdsystemunitdir/emergency.target \
69 $systemdsystemunitdir/sysinit.target \
70 $systemdsystemunitdir/basic.target \
71 $systemdsystemunitdir/halt.target \
72 $systemdsystemunitdir/kexec.target \
73 $systemdsystemunitdir/local-fs.target \
74 $systemdsystemunitdir/local-fs-pre.target \
75 $systemdsystemunitdir/remote-fs.target \
76 $systemdsystemunitdir/remote-fs-pre.target \
77 $systemdsystemunitdir/multi-user.target \
78 $systemdsystemunitdir/network.target \
79 $systemdsystemunitdir/network-pre.target \
80 $systemdsystemunitdir/network-online.target \
81 $systemdsystemunitdir/nss-lookup.target \
82 $systemdsystemunitdir/nss-user-lookup.target \
83 $systemdsystemunitdir/poweroff.target \
84 $systemdsystemunitdir/reboot.target \
85 $systemdsystemunitdir/rescue.target \
86 $systemdsystemunitdir/rpcbind.target \
87 $systemdsystemunitdir/shutdown.target \
88 $systemdsystemunitdir/final.target \
89 $systemdsystemunitdir/sigpwr.target \
90 $systemdsystemunitdir/sockets.target \
91 $systemdsystemunitdir/swap.target \
92 $systemdsystemunitdir/timers.target \
93 $systemdsystemunitdir/paths.target \
94 $systemdsystemunitdir/umount.target \
96 $systemdsystemunitdir/sys-kernel-config.mount \
98 $systemdsystemunitdir/kmod-static-nodes.service \
99 $systemdsystemunitdir/systemd-tmpfiles-setup.service \
100 $systemdsystemunitdir/systemd-tmpfiles-setup-dev.service \
101 $systemdsystemunitdir/systemd-ask-password-console.path \
102 $systemdsystemunitdir/systemd-udevd-control.socket \
103 $systemdsystemunitdir/systemd-udevd-kernel.socket \
104 $systemdsystemunitdir/systemd-ask-password-plymouth.path \
105 $systemdsystemunitdir/systemd-journald.socket \
106 $systemdsystemunitdir/systemd-journald-audit.socket \
107 $systemdsystemunitdir/systemd-ask-password-console.service \
108 $systemdsystemunitdir/systemd-modules-load.service \
109 $systemdsystemunitdir/systemd-halt.service \
110 $systemdsystemunitdir/systemd-poweroff.service \
111 $systemdsystemunitdir/systemd-reboot.service \
112 $systemdsystemunitdir/systemd-kexec.service \
113 $systemdsystemunitdir/systemd-fsck@.service \
114 $systemdsystemunitdir/systemd-udevd.service \
115 $systemdsystemunitdir/systemd-udev-trigger.service \
116 $systemdsystemunitdir/systemd-udev-settle.service \
117 $systemdsystemunitdir/systemd-ask-password-plymouth.service \
118 $systemdsystemunitdir/systemd-journald.service \
119 $systemdsystemunitdir/systemd-vconsole-setup.service \
120 $systemdsystemunitdir/systemd-volatile-root.service \
121 $systemdsystemunitdir/systemd-random-seed-load.service \
122 $systemdsystemunitdir/systemd-random-seed.service \
123 $systemdsystemunitdir/systemd-sysctl.service \
125 $systemdsystemunitdir/sysinit.target.wants
/systemd-modules-load.service \
126 $systemdsystemunitdir/sysinit.target.wants
/systemd-ask-password-console.path \
127 $systemdsystemunitdir/sysinit.target.wants
/systemd-journald.service \
128 $systemdsystemunitdir/sockets.target.wants
/systemd-udevd-control.socket \
129 $systemdsystemunitdir/sockets.target.wants
/systemd-udevd-kernel.socket \
130 $systemdsystemunitdir/sockets.target.wants
/systemd-journald.socket \
131 $systemdsystemunitdir/sockets.target.wants
/systemd-journald-audit.socket \
132 $systemdsystemunitdir/sockets.target.wants
/systemd-journald-dev-log.socket \
133 $systemdsystemunitdir/sysinit.target.wants
/systemd-udevd.service \
134 $systemdsystemunitdir/sysinit.target.wants
/systemd-udev-trigger.service \
135 $systemdsystemunitdir/sysinit.target.wants
/kmod-static-nodes.service \
136 $systemdsystemunitdir/sysinit.target.wants
/systemd-tmpfiles-setup.service \
137 $systemdsystemunitdir/sysinit.target.wants
/systemd-tmpfiles-setup-dev.service \
138 $systemdsystemunitdir/sysinit.target.wants
/systemd-sysctl.service \
140 $systemdsystemunitdir/ctrl-alt-del.target \
141 $systemdsystemunitdir/reboot.target \
142 $systemdsystemunitdir/systemd-reboot.service \
143 $systemdsystemunitdir/syslog.socket \
145 $systemdsystemunitdir/slices.target \
146 $systemdsystemunitdir/system.slice \
147 $systemdsystemunitdir/-.slice \
149 $tmpfilesdir/systemd.conf \
151 journalctl systemctl \
153 kmod insmod rmmod modprobe modinfo depmod lsmod \
154 mount umount reboot poweroff \
155 systemd-run systemd-escape \
156 systemd-cgls systemd-tmpfiles \
157 /etc
/udev
/udev.hwdb \
161 /usr
/lib
/modules-load.d
/*.conf \
162 /usr
/lib
/sysctl.d
/*.conf
166 for i
in "$1"/*.conf
; do
167 [[ -f $i ]] ||
continue
168 while read _line ||
[ -n "$_line" ]; do
181 _mods
=$
(modules_load_get
/usr
/lib
/modules-load.d
)
182 [[ $_mods ]] && hostonly
='' instmods
$_mods
184 if [[ $hostonly ]]; then
185 inst_multiple
-H -o \
186 /etc
/systemd
/journald.conf \
187 /etc
/systemd
/journald.conf.d
/*.conf \
188 /etc
/systemd
/system.conf \
189 /etc
/systemd
/system.conf.d
/*.conf \
195 /etc
/modules-load.d
/*.conf \
196 /etc
/sysctl.d
/*.conf \
198 /etc
/udev
/udev.conf \
201 _mods
=$
(modules_load_get
/etc
/modules-load.d
)
202 [[ $_mods ]] && hostonly
='' instmods
$_mods
205 if ! [[ -e "$initdir/etc/machine-id" ]]; then
206 > "$initdir/etc/machine-id"
209 # install adm user/group for journald
210 inst_multiple nologin
211 grep '^systemd-journal:' /etc
/passwd
2>/dev
/null
>> "$initdir/etc/passwd"
212 grep '^adm:' /etc
/passwd
2>/dev
/null
>> "$initdir/etc/passwd"
213 grep '^systemd-journal:' /etc
/group
>> "$initdir/etc/group"
214 grep '^wheel:' /etc
/group
>> "$initdir/etc/group"
215 grep '^adm:' /etc
/group
>> "$initdir/etc/group"
216 grep '^utmp:' /etc
/group
>> "$initdir/etc/group"
217 grep '^root:' /etc
/group
>> "$initdir/etc/group"
219 # we don't use systemd-networkd, but the user is in systemd.conf tmpfiles snippet
220 grep '^systemd-network:' /etc
/passwd
2>/dev
/null
>> "$initdir/etc/passwd"
221 grep '^systemd-network:' /etc
/group
>> "$initdir/etc/group"
223 ln_r
$systemdutildir/systemd
"/init"
224 ln_r
$systemdutildir/systemd
"/sbin/init"
227 ln_r $
(type -P true
) "/usr/bin/loginctl"
228 ln_r $
(type -P true
) "/bin/loginctl"
240 systemd-ask-password-console.service \
241 systemd-ask-password-plymouth.service \
243 mkdir
-p "${initdir}${systemdsystemunitdir}/${i}.wants"
244 ln_r
"${systemdsystemunitdir}/systemd-vconsole-setup.service" \
245 "${systemdsystemunitdir}/${i}.wants/systemd-vconsole-setup.service"
248 mkdir
-p "$initdir/etc/systemd"
249 # We must use a volatile journal, and we don't want rate-limiting
252 echo "Storage=volatile"
253 echo "RateLimitInterval=0"
254 echo "RateLimitBurst=0"
255 } >> "$initdir/etc/systemd/journald.conf"
257 ln_r
"${systemdsystemunitdir}/multi-user.target" "${systemdsystemunitdir}/default.target"