blob: 9215adf8dc42f3979ec113e94d1a7ec23ce95e1c [file] [log] [blame]
Andrew Geissler82c905d2020-04-13 13:39:40 -05001require systemd.inc
2
3PROVIDES = "udev"
4
5PE = "1"
6
7DEPENDS = "intltool-native gperf-native libcap util-linux"
8
9SECTION = "base/shell"
10
11inherit useradd pkgconfig meson perlnative update-rc.d update-alternatives qemu systemd gettext bash-completion manpages features_check
12
13# As this recipe builds udev, respect systemd being in DISTRO_FEATURES so
14# that we don't build both udev and systemd in world builds.
15REQUIRED_DISTRO_FEATURES = "systemd"
16
17SRC_URI += "file://touchscreen.rules \
18 file://00-create-volatile.conf \
19 file://init \
20 file://99-default.preset \
21 file://0001-binfmt-Don-t-install-dependency-links-at-install-tim.patch \
22 file://0003-implment-systemd-sysv-install-for-OE.patch \
Andrew Geissleraf5e4ef2020-10-16 10:22:50 -050023 file://0001-systemd.pc.in-use-ROOTPREFIX-without-suffixed-slash.patch \
Andrew Geissler82c905d2020-04-13 13:39:40 -050024 "
25
26# patches needed by musl
27SRC_URI_append_libc-musl = " ${SRC_URI_MUSL}"
28SRC_URI_MUSL = "\
29 file://0002-don-t-use-glibc-specific-qsort_r.patch \
30 file://0003-missing_type.h-add-__compare_fn_t-and-comparison_fn_.patch \
31 file://0004-add-fallback-parse_printf_format-implementation.patch \
32 file://0005-src-basic-missing.h-check-for-missing-strndupa.patch \
33 file://0006-Include-netinet-if_ether.h.patch \
34 file://0007-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not.patch \
35 file://0008-add-missing-FTW_-macros-for-musl.patch \
36 file://0010-fix-missing-of-__register_atfork-for-non-glibc-build.patch \
37 file://0011-Use-uintmax_t-for-handling-rlim_t.patch \
38 file://0014-test-sizeof.c-Disable-tests-for-missing-typedefs-in-.patch \
39 file://0015-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch \
40 file://0016-Define-glibc-compatible-basename-for-non-glibc-syste.patch \
41 file://0017-Do-not-disable-buffering-when-writing-to-oom_score_a.patch \
42 file://0018-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch \
43 file://0019-Hide-__start_BUS_ERROR_MAP-and-__stop_BUS_ERROR_MAP.patch \
44 file://0020-missing_type.h-add-__compar_d_fn_t-definition.patch \
45 file://0021-avoid-redefinition-of-prctl_mm_map-structure.patch \
Andrew Geissler635e0e42020-08-21 15:58:33 -050046 file://0021-Handle-missing-LOCK_EX.patch \
47 file://0022-Fix-incompatible-pointer-type-struct-sockaddr_un.patch \
Andrew Geissler82c905d2020-04-13 13:39:40 -050048 file://0024-test-json.c-define-M_PIl.patch \
49 file://0001-do-not-disable-buffer-in-writing-files.patch \
50 file://0002-src-login-brightness.c-include-sys-wait.h.patch \
51 file://0003-src-basic-copy.c-include-signal.h.patch \
52 file://0004-src-shared-cpu-set-util.h-add-__cpu_mask-definition.patch \
53 file://0001-Handle-missing-gshadow.patch \
54 "
55
56PAM_PLUGINS = " \
57 pam-plugin-unix \
58 pam-plugin-loginuid \
59 pam-plugin-keyinit \
60"
61
62PACKAGECONFIG ??= " \
63 ${@bb.utils.filter('DISTRO_FEATURES', 'acl audit efi ldconfig pam selinux smack usrmerge polkit', d)} \
64 ${@bb.utils.contains('DISTRO_FEATURES', 'wifi', 'rfkill', '', d)} \
65 ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'xkbcommon', '', d)} \
66 backlight \
67 binfmt \
68 gshadow \
69 hibernate \
70 hostnamed \
71 idn \
72 ima \
73 kmod \
74 localed \
75 logind \
76 machined \
77 myhostname \
78 networkd \
79 nss \
80 nss-mymachines \
81 nss-resolve \
82 quotacheck \
83 randomseed \
84 resolved \
85 set-time-epoch \
86 sysusers \
87 sysvinit \
88 timedated \
89 timesyncd \
90 userdb \
91 utmp \
92 vconsole \
93 xz \
94"
95
96PACKAGECONFIG_remove_libc-musl = " \
97 gshadow \
98 idn \
99 localed \
100 myhostname \
101 nss \
102 nss-mymachines \
103 nss-resolve \
104 sysusers \
105 userdb \
106 utmp \
107"
108
109CFLAGS_append_libc-musl = " -D__UAPI_DEF_ETHHDR=0 "
110
111# Use the upstream systemd serial-getty@.service and rely on
112# systemd-getty-generator instead of using the OE-core specific
113# systemd-serialgetty.bb - not enabled by default.
114PACKAGECONFIG[serial-getty-generator] = ""
115
116PACKAGECONFIG[acl] = "-Dacl=true,-Dacl=false,acl"
117PACKAGECONFIG[audit] = "-Daudit=true,-Daudit=false,audit"
118PACKAGECONFIG[backlight] = "-Dbacklight=true,-Dbacklight=false"
119PACKAGECONFIG[binfmt] = "-Dbinfmt=true,-Dbinfmt=false"
120PACKAGECONFIG[bzip2] = "-Dbzip2=true,-Dbzip2=false,bzip2"
121PACKAGECONFIG[cgroupv2] = "-Ddefault-hierarchy=unified,-Ddefault-hierarchy=hybrid"
122PACKAGECONFIG[coredump] = "-Dcoredump=true,-Dcoredump=false"
123PACKAGECONFIG[cryptsetup] = "-Dlibcryptsetup=true,-Dlibcryptsetup=false,cryptsetup"
124PACKAGECONFIG[dbus] = "-Ddbus=true,-Ddbus=false,dbus"
125PACKAGECONFIG[efi] = "-Defi=true,-Defi=false"
126PACKAGECONFIG[gnu-efi] = "-Dgnu-efi=true -Defi-libdir=${STAGING_LIBDIR} -Defi-includedir=${STAGING_INCDIR}/efi,-Dgnu-efi=false,gnu-efi"
127PACKAGECONFIG[elfutils] = "-Delfutils=true,-Delfutils=false,elfutils"
128PACKAGECONFIG[firstboot] = "-Dfirstboot=true,-Dfirstboot=false"
129# Sign the journal for anti-tampering
130PACKAGECONFIG[gcrypt] = "-Dgcrypt=true,-Dgcrypt=false,libgcrypt"
131PACKAGECONFIG[gnutls] = "-Dgnutls=true,-Dgnutls=false,gnutls"
132PACKAGECONFIG[gshadow] = "-Dgshadow=true,-Dgshadow=false"
133PACKAGECONFIG[hibernate] = "-Dhibernate=true,-Dhibernate=false"
134PACKAGECONFIG[hostnamed] = "-Dhostnamed=true,-Dhostnamed=false"
135PACKAGECONFIG[idn] = "-Didn=true,-Didn=false"
136PACKAGECONFIG[ima] = "-Dima=true,-Dima=false"
137# importd requires curl/xz/zlib/bzip2/gcrypt
138PACKAGECONFIG[importd] = "-Dimportd=true,-Dimportd=false"
139# Update NAT firewall rules
140PACKAGECONFIG[iptc] = "-Dlibiptc=true,-Dlibiptc=false,iptables"
141PACKAGECONFIG[journal-upload] = "-Dlibcurl=true,-Dlibcurl=false,curl"
142PACKAGECONFIG[kmod] = "-Dkmod=true,-Dkmod=false,kmod"
143PACKAGECONFIG[ldconfig] = "-Dldconfig=true,-Dldconfig=false,,ldconfig"
144PACKAGECONFIG[libidn] = "-Dlibidn=true,-Dlibidn=false,libidn"
145PACKAGECONFIG[libidn2] = "-Dlibidn2=true,-Dlibidn2=false,libidn2"
146PACKAGECONFIG[localed] = "-Dlocaled=true,-Dlocaled=false"
147PACKAGECONFIG[logind] = "-Dlogind=true,-Dlogind=false"
148PACKAGECONFIG[lz4] = "-Dlz4=true,-Dlz4=false,lz4"
149PACKAGECONFIG[machined] = "-Dmachined=true,-Dmachined=false"
150PACKAGECONFIG[manpages] = "-Dman=true,-Dman=false,libxslt-native xmlto-native docbook-xml-dtd4-native docbook-xsl-stylesheets-native"
151PACKAGECONFIG[microhttpd] = "-Dmicrohttpd=true,-Dmicrohttpd=false,libmicrohttpd"
152PACKAGECONFIG[myhostname] = "-Dnss-myhostname=true,-Dnss-myhostname=false,,libnss-myhostname"
153PACKAGECONFIG[networkd] = "-Dnetworkd=true,-Dnetworkd=false"
154PACKAGECONFIG[nss] = "-Dnss-systemd=true,-Dnss-systemd=false"
155PACKAGECONFIG[nss-mymachines] = "-Dnss-mymachines=true,-Dnss-mymachines=false"
156PACKAGECONFIG[nss-resolve] = "-Dnss-resolve=true,-Dnss-resolve=false"
157PACKAGECONFIG[openssl] = "-Dopenssl=true,-Dopenssl=false,openssl"
158PACKAGECONFIG[pam] = "-Dpam=true,-Dpam=false,libpam,${PAM_PLUGINS}"
159PACKAGECONFIG[pcre2] = "-Dpcre2=true,-Dpcre2=false,libpcre2"
160PACKAGECONFIG[polkit] = "-Dpolkit=true,-Dpolkit=false"
161PACKAGECONFIG[portabled] = "-Dportabled=true,-Dportabled=false"
162PACKAGECONFIG[qrencode] = "-Dqrencode=true,-Dqrencode=false,qrencode"
163PACKAGECONFIG[quotacheck] = "-Dquotacheck=true,-Dquotacheck=false"
164PACKAGECONFIG[randomseed] = "-Drandomseed=true,-Drandomseed=false"
165PACKAGECONFIG[resolved] = "-Dresolve=true,-Dresolve=false"
166PACKAGECONFIG[rfkill] = "-Drfkill=true,-Drfkill=false"
167# libseccomp is found in meta-security
168PACKAGECONFIG[seccomp] = "-Dseccomp=true,-Dseccomp=false,libseccomp"
169PACKAGECONFIG[selinux] = "-Dselinux=true,-Dselinux=false,libselinux,initscripts-sushell"
170PACKAGECONFIG[smack] = "-Dsmack=true,-Dsmack=false"
171PACKAGECONFIG[sysusers] = "-Dsysusers=true,-Dsysusers=false"
172PACKAGECONFIG[sysvinit] = "-Dsysvinit-path=${sysconfdir}/init.d -Dsysvrcnd-path=${sysconfdir},-Dsysvinit-path= -Dsysvrcnd-path=,,systemd-compat-units update-rc.d"
173# When enabled use reproducble build timestamp if set as time epoch,
174# or build time if not. When disabled, time epoch is unset.
175def build_epoch(d):
176 epoch = d.getVar('SOURCE_DATE_EPOCH') or "-1"
177 return '-Dtime-epoch=%d' % int(epoch)
178PACKAGECONFIG[set-time-epoch] = "${@build_epoch(d)},-Dtime-epoch=0"
179PACKAGECONFIG[timedated] = "-Dtimedated=true,-Dtimedated=false"
180PACKAGECONFIG[timesyncd] = "-Dtimesyncd=true,-Dtimesyncd=false"
181PACKAGECONFIG[usrmerge] = "-Dsplit-usr=false,-Dsplit-usr=true"
182PACKAGECONFIG[sbinmerge] = "-Dsplit-bin=false,-Dsplit-bin=true"
183PACKAGECONFIG[userdb] = "-Duserdb=true,-Duserdb=false"
184PACKAGECONFIG[utmp] = "-Dutmp=true,-Dutmp=false"
185PACKAGECONFIG[valgrind] = "-DVALGRIND=1,,valgrind"
186PACKAGECONFIG[vconsole] = "-Dvconsole=true,-Dvconsole=false,,${PN}-vconsole-setup"
Andrew Geisslerc3d88e42020-10-02 09:45:00 -0500187PACKAGECONFIG[xdg-autostart] = "-Dxdg-autostart=true,-Dxdg-autostart=false"
Andrew Geissler82c905d2020-04-13 13:39:40 -0500188# Verify keymaps on locale change
189PACKAGECONFIG[xkbcommon] = "-Dxkbcommon=true,-Dxkbcommon=false,libxkbcommon"
190PACKAGECONFIG[xz] = "-Dxz=true,-Dxz=false,xz"
191PACKAGECONFIG[zlib] = "-Dzlib=true,-Dzlib=false,zlib"
192
193# Helper variables to clarify locations. This mirrors the logic in systemd's
194# build system.
195rootprefix ?= "${root_prefix}"
196rootlibdir ?= "${base_libdir}"
197rootlibexecdir = "${rootprefix}/lib"
198
199# This links udev statically with systemd helper library.
200# Otherwise udev package would depend on systemd package (which has the needed shared library),
201# and always pull it into images.
202EXTRA_OEMESON += "-Dlink-udev-shared=false"
203
204EXTRA_OEMESON += "-Dnobody-user=nobody \
205 -Dnobody-group=nobody \
206 -Drootlibdir=${rootlibdir} \
207 -Drootprefix=${rootprefix} \
208 -Ddefault-locale=C \
209 "
210
211# Hardcode target binary paths to avoid using paths from sysroot
212EXTRA_OEMESON += "-Dkexec-path=${sbindir}/kexec \
213 -Dkmod-path=${base_bindir}/kmod \
214 -Dmount-path=${base_bindir}/mount \
215 -Dquotacheck-path=${sbindir}/quotacheck \
216 -Dquotaon-path=${sbindir}/quotaon \
217 -Dsulogin-path=${base_sbindir}/sulogin \
218 -Dnologin-path=${base_sbindir}/nologin \
219 -Dumount-path=${base_bindir}/umount"
220
221do_install() {
222 meson_do_install
223 install -d ${D}/${base_sbindir}
224 if ${@bb.utils.contains('PACKAGECONFIG', 'serial-getty-generator', 'false', 'true', d)}; then
225 # Provided by a separate recipe
226 rm ${D}${systemd_unitdir}/system/serial-getty* -f
227 fi
228
229 # Provide support for initramfs
230 [ ! -e ${D}/init ] && ln -s ${rootlibexecdir}/systemd/systemd ${D}/init
231 [ ! -e ${D}/${base_sbindir}/udevd ] && ln -s ${rootlibexecdir}/systemd/systemd-udevd ${D}/${base_sbindir}/udevd
232
233 install -d ${D}${sysconfdir}/udev/rules.d/
234 install -d ${D}${sysconfdir}/tmpfiles.d
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500235 for rule in $(find ${WORKDIR} -maxdepth 1 -type f -name "*.rules"); do
236 install -m 0644 $rule ${D}${sysconfdir}/udev/rules.d/
237 done
Andrew Geissler82c905d2020-04-13 13:39:40 -0500238
239 install -m 0644 ${WORKDIR}/00-create-volatile.conf ${D}${sysconfdir}/tmpfiles.d/
240
241 if ${@bb.utils.contains('DISTRO_FEATURES','sysvinit','true','false',d)}; then
242 install -d ${D}${sysconfdir}/init.d
243 install -m 0755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/systemd-udevd
244 sed -i s%@UDEVD@%${rootlibexecdir}/systemd/systemd-udevd% ${D}${sysconfdir}/init.d/systemd-udevd
245 install -Dm 0755 ${S}/src/systemctl/systemd-sysv-install.SKELETON ${D}${systemd_unitdir}/systemd-sysv-install
246 fi
247
248 chown root:systemd-journal ${D}/${localstatedir}/log/journal
249
250 # Delete journal README, as log can be symlinked inside volatile.
251 rm -f ${D}/${localstatedir}/log/README
252
253 # journal-remote creates this at start
254 rm -rf ${D}/${localstatedir}/log/journal/remote
255
256 install -d ${D}${systemd_unitdir}/system/graphical.target.wants
257 install -d ${D}${systemd_unitdir}/system/multi-user.target.wants
258 install -d ${D}${systemd_unitdir}/system/poweroff.target.wants
259 install -d ${D}${systemd_unitdir}/system/reboot.target.wants
260 install -d ${D}${systemd_unitdir}/system/rescue.target.wants
261
262 # Create symlinks for systemd-update-utmp-runlevel.service
263 if ${@bb.utils.contains('PACKAGECONFIG', 'utmp', 'true', 'false', d)}; then
264 ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_unitdir}/system/graphical.target.wants/systemd-update-utmp-runlevel.service
265 ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_unitdir}/system/multi-user.target.wants/systemd-update-utmp-runlevel.service
266 ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_unitdir}/system/poweroff.target.wants/systemd-update-utmp-runlevel.service
267 ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_unitdir}/system/reboot.target.wants/systemd-update-utmp-runlevel.service
268 ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_unitdir}/system/rescue.target.wants/systemd-update-utmp-runlevel.service
269 fi
270
271 # this file is needed to exist if networkd is disabled but timesyncd is still in use since timesyncd checks it
272 # for existence else it fails
273 if [ -s ${D}${exec_prefix}/lib/tmpfiles.d/systemd.conf ]; then
274 ${@bb.utils.contains('PACKAGECONFIG', 'networkd', ':', 'sed -i -e "\$ad /run/systemd/netif/links 0755 root root -" ${D}${exec_prefix}/lib/tmpfiles.d/systemd.conf', d)}
275 fi
276 if ! ${@bb.utils.contains('PACKAGECONFIG', 'resolved', 'true', 'false', d)}; then
277 echo 'L! ${sysconfdir}/resolv.conf - - - - ../run/systemd/resolve/resolv.conf' >>${D}${exec_prefix}/lib/tmpfiles.d/etc.conf
278 echo 'd /run/systemd/resolve 0755 root root -' >>${D}${exec_prefix}/lib/tmpfiles.d/systemd.conf
279 echo 'f /run/systemd/resolve/resolv.conf 0644 root root' >>${D}${exec_prefix}/lib/tmpfiles.d/systemd.conf
280 ln -s ../run/systemd/resolve/resolv.conf ${D}${sysconfdir}/resolv-conf.systemd
281 else
282 sed -i -e "s%^L! /etc/resolv.conf.*$%L! /etc/resolv.conf - - - - ../run/systemd/resolve/resolv.conf%g" ${D}${exec_prefix}/lib/tmpfiles.d/etc.conf
283 ln -s ../run/systemd/resolve/resolv.conf ${D}${sysconfdir}/resolv-conf.systemd
284 fi
285 if ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'false', 'true', d)}; then
286 rm ${D}${exec_prefix}/lib/tmpfiles.d/x11.conf
287 rm -r ${D}${sysconfdir}/X11
288 fi
289
290 # If polkit is setup fixup permissions and ownership
291 if ${@bb.utils.contains('PACKAGECONFIG', 'polkit', 'true', 'false', d)}; then
292 if [ -d ${D}${datadir}/polkit-1/rules.d ]; then
293 chmod 700 ${D}${datadir}/polkit-1/rules.d
294 chown polkitd:root ${D}${datadir}/polkit-1/rules.d
295 fi
296 fi
297
298 # create link for existing udev rules
299 ln -s ${base_bindir}/udevadm ${D}${base_sbindir}/udevadm
300
301 # duplicate udevadm for postinst script
302 install -d ${D}${libexecdir}
303 ln ${D}${base_bindir}/udevadm ${D}${libexecdir}/${MLPREFIX}udevadm
304
305 # install default policy for presets
306 # https://www.freedesktop.org/wiki/Software/systemd/Preset/#howto
307 install -Dm 0644 ${WORKDIR}/99-default.preset ${D}${systemd_unitdir}/system-preset/99-default.preset
308}
309
310python populate_packages_prepend (){
311 systemdlibdir = d.getVar("rootlibdir")
312 do_split_packages(d, systemdlibdir, '^lib(.*)\.so\.*', 'lib%s', 'Systemd %s library', extra_depends='', allow_links=True)
313}
314PACKAGES_DYNAMIC += "^lib(udev|systemd|nss).*"
315
316PACKAGE_BEFORE_PN = "\
317 ${PN}-gui \
318 ${PN}-vconsole-setup \
319 ${PN}-initramfs \
320 ${PN}-analyze \
321 ${PN}-kernel-install \
322 ${PN}-rpm-macros \
323 ${PN}-binfmt \
324 ${PN}-zsh-completion \
325 ${PN}-container \
326 ${PN}-journal-gatewayd \
327 ${PN}-journal-upload \
328 ${PN}-journal-remote \
329 ${PN}-extra-utils \
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500330 ${PN}-udev-rules \
Andrew Geissler82c905d2020-04-13 13:39:40 -0500331 udev \
332 udev-hwdb \
333"
334
335SUMMARY_${PN}-container = "Tools for containers and VMs"
336DESCRIPTION_${PN}-container = "Systemd tools to spawn and manage containers and virtual machines."
337
338SUMMARY_${PN}-journal-gatewayd = "HTTP server for journal events"
339DESCRIPTION_${PN}-journal-gatewayd = "systemd-journal-gatewayd serves journal events over the network. Clients must connect using HTTP. The server listens on port 19531 by default."
340
341SUMMARY_${PN}-journal-upload = "Send journal messages over the network"
342DESCRIPTION_${PN}-journal-upload = "systemd-journal-upload uploads journal entries to a specified URL."
343
344SUMMARY_${PN}-journal-remote = "Receive journal messages over the network"
345DESCRIPTION_${PN}-journal-remote = "systemd-journal-remote is a command to receive serialized journal events and store them to journal files."
346
347SYSTEMD_PACKAGES = "${@bb.utils.contains('PACKAGECONFIG', 'binfmt', '${PN}-binfmt', '', d)} \
348 ${@bb.utils.contains('PACKAGECONFIG', 'microhttpd', '${PN}-journal-gatewayd', '', d)} \
349 ${@bb.utils.contains('PACKAGECONFIG', 'microhttpd', '${PN}-journal-remote', '', d)} \
350 ${@bb.utils.contains('PACKAGECONFIG', 'journal-upload', '${PN}-journal-upload', '', d)} \
351"
352SYSTEMD_SERVICE_${PN}-binfmt = "systemd-binfmt.service"
353
354USERADD_PACKAGES = "${PN} ${PN}-extra-utils \
355 ${@bb.utils.contains('PACKAGECONFIG', 'microhttpd', '${PN}-journal-gateway', '', d)} \
356 ${@bb.utils.contains('PACKAGECONFIG', 'microhttpd', '${PN}-journal-remote', '', d)} \
357 ${@bb.utils.contains('PACKAGECONFIG', 'journal-upload', '${PN}-journal-upload', '', d)} \
358"
359GROUPADD_PARAM_${PN} = "-r systemd-journal"
360USERADD_PARAM_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'coredump', '--system -d / -M --shell /bin/nologin systemd-coredump;', '', d)}"
361USERADD_PARAM_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'networkd', '--system -d / -M --shell /bin/nologin systemd-network;', '', d)}"
362USERADD_PARAM_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'polkit', '--system --no-create-home --user-group --home-dir ${sysconfdir}/polkit-1 polkitd;', '', d)}"
363USERADD_PARAM_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'resolved', '--system -d / -M --shell /bin/nologin systemd-resolve;', '', d)}"
364USERADD_PARAM_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'timesyncd', '--system -d / -M --shell /bin/nologin systemd-timesync;', '', d)}"
365USERADD_PARAM_${PN}-extra-utils = "--system -d / -M --shell /bin/nologin systemd-bus-proxy"
366USERADD_PARAM_${PN}-journal-gateway = "--system -d / -M --shell /bin/nologin systemd-journal-gateway"
367USERADD_PARAM_${PN}-journal-remote = "--system -d / -M --shell /bin/nologin systemd-journal-remote"
368USERADD_PARAM_${PN}-journal-upload = "--system -d / -M --shell /bin/nologin systemd-journal-upload"
369
370FILES_${PN}-analyze = "${bindir}/systemd-analyze"
371
372FILES_${PN}-initramfs = "/init"
373RDEPENDS_${PN}-initramfs = "${PN}"
374
375FILES_${PN}-gui = "${bindir}/systemadm"
376
377FILES_${PN}-vconsole-setup = "${rootlibexecdir}/systemd/systemd-vconsole-setup \
378 ${systemd_unitdir}/system/systemd-vconsole-setup.service \
379 ${systemd_unitdir}/system/sysinit.target.wants/systemd-vconsole-setup.service"
380
381RDEPENDS_${PN}-kernel-install += "bash"
382FILES_${PN}-kernel-install = "${bindir}/kernel-install \
383 ${sysconfdir}/kernel/ \
384 ${exec_prefix}/lib/kernel \
385 "
386FILES_${PN}-rpm-macros = "${exec_prefix}/lib/rpm \
387 "
388
389FILES_${PN}-zsh-completion = "${datadir}/zsh/site-functions"
390
391FILES_${PN}-binfmt = "${sysconfdir}/binfmt.d/ \
392 ${exec_prefix}/lib/binfmt.d \
393 ${rootlibexecdir}/systemd/systemd-binfmt \
394 ${systemd_unitdir}/system/proc-sys-fs-binfmt_misc.* \
395 ${systemd_unitdir}/system/systemd-binfmt.service"
396RRECOMMENDS_${PN}-binfmt = "kernel-module-binfmt-misc"
397
398RRECOMMENDS_${PN}-vconsole-setup = "kbd kbd-consolefonts kbd-keymaps"
399
400
401FILES_${PN}-journal-gatewayd = "${rootlibexecdir}/systemd/systemd-journal-gatewayd \
402 ${systemd_system_unitdir}/systemd-journal-gatewayd.service \
403 ${systemd_system_unitdir}/systemd-journal-gatewayd.socket \
404 ${systemd_system_unitdir}/sockets.target.wants/systemd-journal-gatewayd.socket \
405 ${datadir}/systemd/gatewayd/browse.html \
406 "
407SYSTEMD_SERVICE_${PN}-journal-gatewayd = "systemd-journal-gatewayd.socket"
408
409FILES_${PN}-journal-upload = "${rootlibexecdir}/systemd/systemd-journal-upload \
410 ${systemd_system_unitdir}/systemd-journal-upload.service \
411 ${sysconfdir}/systemd/journal-upload.conf \
412 "
413SYSTEMD_SERVICE_${PN}-journal-upload = "systemd-journal-upload.service"
414
415FILES_${PN}-journal-remote = "${rootlibexecdir}/systemd/systemd-journal-remote \
416 ${sysconfdir}/systemd/journal-remote.conf \
417 ${systemd_system_unitdir}/systemd-journal-remote.service \
418 ${systemd_system_unitdir}/systemd-journal-remote.socket \
419 "
420SYSTEMD_SERVICE_${PN}-journal-remote = "systemd-journal-remote.socket"
421
422
423FILES_${PN}-container = "${sysconfdir}/dbus-1/system.d/org.freedesktop.import1.conf \
424 ${sysconfdir}/dbus-1/system.d/org.freedesktop.machine1.conf \
425 ${sysconfdir}/systemd/system/multi-user.target.wants/machines.target \
426 ${base_bindir}/machinectl \
427 ${bindir}/systemd-nspawn \
428 ${nonarch_libdir}/systemd/import-pubring.gpg \
429 ${systemd_system_unitdir}/busnames.target.wants/org.freedesktop.import1.busname \
430 ${systemd_system_unitdir}/busnames.target.wants/org.freedesktop.machine1.busname \
431 ${systemd_system_unitdir}/local-fs.target.wants/var-lib-machines.mount \
432 ${systemd_system_unitdir}/machines.target.wants/var-lib-machines.mount \
433 ${systemd_system_unitdir}/remote-fs.target.wants/var-lib-machines.mount \
434 ${systemd_system_unitdir}/machine.slice \
435 ${systemd_system_unitdir}/machines.target \
436 ${systemd_system_unitdir}/org.freedesktop.import1.busname \
437 ${systemd_system_unitdir}/org.freedesktop.machine1.busname \
438 ${systemd_system_unitdir}/systemd-importd.service \
439 ${systemd_system_unitdir}/systemd-machined.service \
440 ${systemd_system_unitdir}/dbus-org.freedesktop.machine1.service \
441 ${systemd_system_unitdir}/var-lib-machines.mount \
442 ${rootlibexecdir}/systemd/systemd-import \
443 ${rootlibexecdir}/systemd/systemd-importd \
444 ${rootlibexecdir}/systemd/systemd-machined \
445 ${rootlibexecdir}/systemd/systemd-pull \
446 ${exec_prefix}/lib/tmpfiles.d/systemd-nspawn.conf \
447 ${systemd_system_unitdir}/systemd-nspawn@.service \
448 ${libdir}/libnss_mymachines.so.2 \
449 ${datadir}/dbus-1/system-services/org.freedesktop.import1.service \
450 ${datadir}/dbus-1/system-services/org.freedesktop.machine1.service \
451 ${datadir}/dbus-1/system.d/org.freedesktop.import1.conf \
452 ${datadir}/dbus-1/system.d/org.freedesktop.machine1.conf \
453 ${datadir}/polkit-1/actions/org.freedesktop.import1.policy \
454 ${datadir}/polkit-1/actions/org.freedesktop.machine1.policy \
455 "
456
457RRECOMMENDS_${PN}-container += "\
458 ${PN}-journal-upload \
459 ${PN}-journal-remote \
460 ${PN}-journal-gatewayd \
461 "
462
463FILES_${PN}-extra-utils = "\
464 ${base_bindir}/systemd-escape \
465 ${base_bindir}/systemd-inhibit \
466 ${bindir}/systemd-detect-virt \
467 ${bindir}/systemd-path \
468 ${bindir}/systemd-run \
469 ${bindir}/systemd-cat \
470 ${bindir}/systemd-delta \
471 ${bindir}/systemd-cgls \
472 ${bindir}/systemd-cgtop \
473 ${bindir}/systemd-stdio-bridge \
474 ${base_bindir}/systemd-ask-password \
475 ${base_bindir}/systemd-tty-ask-password-agent \
476 ${systemd_unitdir}/system/systemd-ask-password-console.path \
477 ${systemd_unitdir}/system/systemd-ask-password-console.service \
478 ${systemd_unitdir}/system/systemd-ask-password-wall.path \
479 ${systemd_unitdir}/system/systemd-ask-password-wall.service \
480 ${systemd_unitdir}/system/sysinit.target.wants/systemd-ask-password-console.path \
481 ${systemd_unitdir}/system/sysinit.target.wants/systemd-ask-password-wall.path \
482 ${systemd_unitdir}/system/multi-user.target.wants/systemd-ask-password-wall.path \
483 ${rootlibexecdir}/systemd/systemd-resolve-host \
484 ${rootlibexecdir}/systemd/systemd-ac-power \
485 ${rootlibexecdir}/systemd/systemd-activate \
486 ${rootlibexecdir}/systemd/systemd-bus-proxyd \
487 ${systemd_unitdir}/system/systemd-bus-proxyd.service \
488 ${systemd_unitdir}/system/systemd-bus-proxyd.socket \
489 ${rootlibexecdir}/systemd/systemd-socket-proxyd \
490 ${rootlibexecdir}/systemd/systemd-reply-password \
491 ${rootlibexecdir}/systemd/systemd-sleep \
492 ${rootlibexecdir}/systemd/system-sleep \
493 ${systemd_unitdir}/system/systemd-hibernate.service \
494 ${systemd_unitdir}/system/systemd-hybrid-sleep.service \
495 ${systemd_unitdir}/system/systemd-suspend.service \
496 ${systemd_unitdir}/system/sleep.target \
497 ${rootlibexecdir}/systemd/systemd-initctl \
498 ${systemd_unitdir}/system/systemd-initctl.service \
499 ${systemd_unitdir}/system/systemd-initctl.socket \
500 ${systemd_unitdir}/system/sockets.target.wants/systemd-initctl.socket \
501 ${rootlibexecdir}/systemd/system-generators/systemd-gpt-auto-generator \
502 ${rootlibexecdir}/systemd/systemd-cgroups-agent \
503"
504
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500505FILES_${PN}-udev-rules = "\
506 ${rootlibexecdir}/udev/rules.d/70-uaccess.rules \
507 ${rootlibexecdir}/udev/rules.d/71-seat.rules \
508 ${rootlibexecdir}/udev/rules.d/73-seat-late.rules \
509 ${rootlibexecdir}/udev/rules.d/99-systemd.rules \
510"
511
Andrew Geissler82c905d2020-04-13 13:39:40 -0500512CONFFILES_${PN} = "${sysconfdir}/systemd/coredump.conf \
513 ${sysconfdir}/systemd/journald.conf \
514 ${sysconfdir}/systemd/logind.conf \
515 ${sysconfdir}/systemd/networkd.conf \
516 ${sysconfdir}/systemd/pstore.conf \
517 ${sysconfdir}/systemd/resolved.conf \
518 ${sysconfdir}/systemd/sleep.conf \
519 ${sysconfdir}/systemd/system.conf \
520 ${sysconfdir}/systemd/timesyncd.conf \
521 ${sysconfdir}/systemd/user.conf \
522"
523
524FILES_${PN} = " ${base_bindir}/* \
525 ${base_sbindir}/shutdown \
526 ${base_sbindir}/halt \
527 ${base_sbindir}/poweroff \
528 ${base_sbindir}/runlevel \
529 ${base_sbindir}/telinit \
530 ${base_sbindir}/resolvconf \
531 ${base_sbindir}/reboot \
532 ${base_sbindir}/init \
533 ${datadir}/dbus-1/services \
534 ${datadir}/dbus-1/system-services \
535 ${datadir}/polkit-1 \
536 ${datadir}/${BPN} \
537 ${datadir}/factory \
538 ${sysconfdir}/dbus-1/ \
539 ${sysconfdir}/modules-load.d/ \
540 ${sysconfdir}/pam.d/ \
541 ${sysconfdir}/sysctl.d/ \
542 ${sysconfdir}/systemd/ \
543 ${sysconfdir}/tmpfiles.d/ \
544 ${sysconfdir}/xdg/ \
545 ${sysconfdir}/init.d/README \
546 ${sysconfdir}/resolv-conf.systemd \
547 ${sysconfdir}/X11/xinit/xinitrc.d/* \
548 ${rootlibexecdir}/systemd/* \
549 ${systemd_unitdir}/* \
550 ${base_libdir}/security/*.so \
551 /cgroup \
552 ${bindir}/systemd* \
553 ${bindir}/busctl \
554 ${bindir}/coredumpctl \
555 ${bindir}/localectl \
556 ${bindir}/hostnamectl \
557 ${bindir}/resolvectl \
558 ${bindir}/timedatectl \
559 ${bindir}/bootctl \
Andrew Geissler82c905d2020-04-13 13:39:40 -0500560 ${exec_prefix}/lib/tmpfiles.d/*.conf \
561 ${exec_prefix}/lib/systemd \
562 ${exec_prefix}/lib/modules-load.d \
563 ${exec_prefix}/lib/sysctl.d \
564 ${exec_prefix}/lib/sysusers.d \
565 ${exec_prefix}/lib/environment.d \
566 ${localstatedir} \
Andrew Geissler82c905d2020-04-13 13:39:40 -0500567 ${rootlibexecdir}/modprobe.d/systemd.conf \
568 ${datadir}/dbus-1/system.d/org.freedesktop.timedate1.conf \
569 ${datadir}/dbus-1/system.d/org.freedesktop.locale1.conf \
570 ${datadir}/dbus-1/system.d/org.freedesktop.network1.conf \
571 ${datadir}/dbus-1/system.d/org.freedesktop.resolve1.conf \
572 ${datadir}/dbus-1/system.d/org.freedesktop.systemd1.conf \
573 ${datadir}/dbus-1/system.d/org.freedesktop.hostname1.conf \
574 ${datadir}/dbus-1/system.d/org.freedesktop.login1.conf \
575 ${datadir}/dbus-1/system.d/org.freedesktop.timesync1.conf \
576 ${datadir}/dbus-1/system.d/org.freedesktop.portable1.conf \
577 "
578
579FILES_${PN}-dev += "${base_libdir}/security/*.la ${datadir}/dbus-1/interfaces/ ${sysconfdir}/rpm/macros.systemd"
580
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500581RDEPENDS_${PN} += "kmod dbus util-linux-mount util-linux-umount udev (= ${EXTENDPKGV}) systemd-udev-rules util-linux-agetty util-linux-fsck"
Andrew Geissler82c905d2020-04-13 13:39:40 -0500582RDEPENDS_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'serial-getty-generator', '', 'systemd-serialgetty', d)}"
583RDEPENDS_${PN} += "volatile-binds"
584
585RRECOMMENDS_${PN} += "systemd-extra-utils \
586 udev-hwdb \
587 e2fsprogs-e2fsck \
588 kernel-module-autofs4 kernel-module-unix kernel-module-ipv6 kernel-module-sch-fq-codel \
589 os-release \
590 systemd-conf \
591"
592
593INSANE_SKIP_${PN} += "dev-so libdir"
594INSANE_SKIP_${PN}-dbg += "libdir"
595INSANE_SKIP_${PN}-doc += " libdir"
596
597RPROVIDES_udev = "hotplug"
598
599RDEPENDS_udev-hwdb += "udev"
600
601FILES_udev += "${base_sbindir}/udevd \
602 ${rootlibexecdir}/systemd/network/99-default.link \
603 ${rootlibexecdir}/systemd/systemd-udevd \
604 ${rootlibexecdir}/udev/accelerometer \
605 ${rootlibexecdir}/udev/ata_id \
606 ${rootlibexecdir}/udev/cdrom_id \
607 ${rootlibexecdir}/udev/collect \
608 ${rootlibexecdir}/udev/fido_id \
609 ${rootlibexecdir}/udev/findkeyboards \
610 ${rootlibexecdir}/udev/keyboard-force-release.sh \
611 ${rootlibexecdir}/udev/keymap \
612 ${rootlibexecdir}/udev/mtd_probe \
613 ${rootlibexecdir}/udev/scsi_id \
614 ${rootlibexecdir}/udev/v4l_id \
615 ${rootlibexecdir}/udev/keymaps \
616 ${rootlibexecdir}/udev/rules.d/50-udev-default.rules \
Andrew Geissler635e0e42020-08-21 15:58:33 -0500617 ${rootlibexecdir}/udev/rules.d/60-autosuspend.rules \
Andrew Geissler82c905d2020-04-13 13:39:40 -0500618 ${rootlibexecdir}/udev/rules.d/60-autosuspend-chromiumos.rules \
619 ${rootlibexecdir}/udev/rules.d/60-block.rules \
620 ${rootlibexecdir}/udev/rules.d/60-cdrom_id.rules \
621 ${rootlibexecdir}/udev/rules.d/60-drm.rules \
622 ${rootlibexecdir}/udev/rules.d/60-evdev.rules \
623 ${rootlibexecdir}/udev/rules.d/60-fido-id.rules \
624 ${rootlibexecdir}/udev/rules.d/60-input-id.rules \
625 ${rootlibexecdir}/udev/rules.d/60-persistent-alsa.rules \
626 ${rootlibexecdir}/udev/rules.d/60-persistent-input.rules \
627 ${rootlibexecdir}/udev/rules.d/60-persistent-storage.rules \
628 ${rootlibexecdir}/udev/rules.d/60-persistent-storage-tape.rules \
629 ${rootlibexecdir}/udev/rules.d/60-persistent-v4l.rules \
630 ${rootlibexecdir}/udev/rules.d/60-sensor.rules \
631 ${rootlibexecdir}/udev/rules.d/60-serial.rules \
632 ${rootlibexecdir}/udev/rules.d/61-autosuspend-manual.rules \
633 ${rootlibexecdir}/udev/rules.d/64-btrfs.rules \
634 ${rootlibexecdir}/udev/rules.d/70-joystick.rules \
635 ${rootlibexecdir}/udev/rules.d/70-mouse.rules \
636 ${rootlibexecdir}/udev/rules.d/70-power-switch.rules \
637 ${rootlibexecdir}/udev/rules.d/70-touchpad.rules \
638 ${rootlibexecdir}/udev/rules.d/75-net-description.rules \
639 ${rootlibexecdir}/udev/rules.d/75-probe_mtd.rules \
640 ${rootlibexecdir}/udev/rules.d/78-sound-card.rules \
641 ${rootlibexecdir}/udev/rules.d/80-drivers.rules \
642 ${rootlibexecdir}/udev/rules.d/80-net-setup-link.rules \
643 ${rootlibexecdir}/udev/rules.d/90-vconsole.rules \
644 ${sysconfdir}/udev \
645 ${sysconfdir}/init.d/systemd-udevd \
646 ${systemd_unitdir}/system/*udev* \
647 ${systemd_unitdir}/system/*.wants/*udev* \
648 ${base_bindir}/systemd-hwdb \
649 ${base_bindir}/udevadm \
650 ${base_sbindir}/udevadm \
651 ${libexecdir}/${MLPREFIX}udevadm \
652 ${datadir}/bash-completion/completions/udevadm \
653 ${systemd_unitdir}/system/systemd-hwdb-update.service \
654 "
655
656FILES_udev-hwdb = "${rootlibexecdir}/udev/hwdb.d \
657 "
658
659RCONFLICTS_${PN} = "tiny-init ${@bb.utils.contains('PACKAGECONFIG', 'resolved', 'resolvconf', '', d)}"
660
661INITSCRIPT_PACKAGES = "udev"
662INITSCRIPT_NAME_udev = "systemd-udevd"
663INITSCRIPT_PARAMS_udev = "start 03 S ."
664
665python __anonymous() {
666 if not bb.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d):
667 d.setVar("INHIBIT_UPDATERCD_BBCLASS", "1")
668}
669
670python do_warn_musl() {
671 if d.getVar('TCLIBC') == "musl":
672 bb.warn("Using systemd with musl is not recommended since it is not supported upstream and some patches are known to be problematic.")
673}
674addtask warn_musl before do_configure
675
676ALTERNATIVE_${PN} = "halt reboot shutdown poweroff runlevel ${@bb.utils.contains('PACKAGECONFIG', 'resolved', 'resolv-conf', '', d)}"
677
678ALTERNATIVE_TARGET[resolv-conf] = "${sysconfdir}/resolv-conf.systemd"
679ALTERNATIVE_LINK_NAME[resolv-conf] = "${sysconfdir}/resolv.conf"
680ALTERNATIVE_PRIORITY[resolv-conf] ?= "50"
681
682ALTERNATIVE_TARGET[halt] = "${base_bindir}/systemctl"
683ALTERNATIVE_LINK_NAME[halt] = "${base_sbindir}/halt"
684ALTERNATIVE_PRIORITY[halt] ?= "300"
685
686ALTERNATIVE_TARGET[reboot] = "${base_bindir}/systemctl"
687ALTERNATIVE_LINK_NAME[reboot] = "${base_sbindir}/reboot"
688ALTERNATIVE_PRIORITY[reboot] ?= "300"
689
690ALTERNATIVE_TARGET[shutdown] = "${base_bindir}/systemctl"
691ALTERNATIVE_LINK_NAME[shutdown] = "${base_sbindir}/shutdown"
692ALTERNATIVE_PRIORITY[shutdown] ?= "300"
693
694ALTERNATIVE_TARGET[poweroff] = "${base_bindir}/systemctl"
695ALTERNATIVE_LINK_NAME[poweroff] = "${base_sbindir}/poweroff"
696ALTERNATIVE_PRIORITY[poweroff] ?= "300"
697
698ALTERNATIVE_TARGET[runlevel] = "${base_bindir}/systemctl"
699ALTERNATIVE_LINK_NAME[runlevel] = "${base_sbindir}/runlevel"
700ALTERNATIVE_PRIORITY[runlevel] ?= "300"
701
702pkg_postinst_${PN}_libc-glibc () {
703 sed -e '/^hosts:/s/\s*\<myhostname\>//' \
704 -e 's/\(^hosts:.*\)\(\<files\>\)\(.*\)\(\<dns\>\)\(.*\)/\1\2 myhostname \3\4\5/' \
705 -i $D${sysconfdir}/nsswitch.conf
706}
707
708pkg_prerm_${PN}_libc-glibc () {
709 sed -e '/^hosts:/s/\s*\<myhostname\>//' \
710 -e '/^hosts:/s/\s*myhostname//' \
711 -i $D${sysconfdir}/nsswitch.conf
712}
713
714PACKAGE_WRITE_DEPS += "qemu-native"
715pkg_postinst_udev-hwdb () {
716 if test -n "$D"; then
717 $INTERCEPT_DIR/postinst_intercept update_udev_hwdb ${PKG} mlprefix=${MLPREFIX} binprefix=${MLPREFIX} rootlibexecdir="${rootlibexecdir}" PREFERRED_PROVIDER_udev="${PREFERRED_PROVIDER_udev}"
718 else
719 udevadm hwdb --update
720 fi
721}
722
723pkg_prerm_udev-hwdb () {
724 rm -f $D${sysconfdir}/udev/hwdb.bin
725}