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