blob: 7935380e78a9f402103d700410abd7d14088779e [file] [log] [blame]
Brad Bishopc342db32019-05-15 21:57:59 -04001require 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 distro_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://0001-binfmt-Don-t-install-dependency-links-at-install-tim.patch \
21 file://0002-use-lnr-wrapper-instead-of-looking-for-relative-opti.patch \
22 file://0003-implment-systemd-sysv-install-for-OE.patch \
23 file://0004-rules-whitelist-hd-devices.patch \
24 file://0005-rules-watch-metadata-changes-in-ide-devices.patch \
Brad Bishop00e122a2019-10-05 11:10:57 -040025 file://0001-unit-file.c-consider-symlink-on-filesystems-like-NFS.patch \
Brad Bishopc342db32019-05-15 21:57:59 -040026 file://99-default.preset \
Brad Bishop1d80a2e2019-11-15 16:35:03 -050027 file://0001-pstore-fix-use-after-free.patch \
Brad Bishopc342db32019-05-15 21:57:59 -040028 "
29
30# patches needed by musl
Brad Bishop15ae2502019-06-18 21:44:24 -040031SRC_URI_append_libc-musl = " ${SRC_URI_MUSL}"
Brad Bishopc68388fc2019-08-26 01:33:31 -040032SRC_URI_MUSL = "\
Brad Bishopc342db32019-05-15 21:57:59 -040033 file://0002-don-t-use-glibc-specific-qsort_r.patch \
34 file://0003-missing_type.h-add-__compare_fn_t-and-comparison_fn_.patch \
35 file://0004-add-fallback-parse_printf_format-implementation.patch \
36 file://0005-src-basic-missing.h-check-for-missing-strndupa.patch \
37 file://0006-Include-netinet-if_ether.h.patch \
38 file://0007-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not.patch \
39 file://0008-add-missing-FTW_-macros-for-musl.patch \
Brad Bishopc342db32019-05-15 21:57:59 -040040 file://0010-fix-missing-of-__register_atfork-for-non-glibc-build.patch \
41 file://0011-Use-uintmax_t-for-handling-rlim_t.patch \
Brad Bishopc342db32019-05-15 21:57:59 -040042 file://0014-test-sizeof.c-Disable-tests-for-missing-typedefs-in-.patch \
43 file://0015-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch \
44 file://0016-Define-glibc-compatible-basename-for-non-glibc-syste.patch \
45 file://0017-Do-not-disable-buffering-when-writing-to-oom_score_a.patch \
46 file://0018-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch \
47 file://0019-Hide-__start_BUS_ERROR_MAP-and-__stop_BUS_ERROR_MAP.patch \
48 file://0020-missing_type.h-add-__compar_d_fn_t-definition.patch \
49 file://0021-avoid-redefinition-of-prctl_mm_map-structure.patch \
Brad Bishopc342db32019-05-15 21:57:59 -040050 file://0024-test-json.c-define-M_PIl.patch \
Brad Bishopc342db32019-05-15 21:57:59 -040051 file://0001-do-not-disable-buffer-in-writing-files.patch \
Brad Bishopa34c0302019-09-23 22:34:48 -040052 file://0002-src-login-brightness.c-include-sys-wait.h.patch \
53 file://0003-src-basic-copy.c-include-signal.h.patch \
54 file://0004-src-shared-cpu-set-util.h-add-__cpu_mask-definition.patch \
Brad Bishopc342db32019-05-15 21:57:59 -040055 "
56
57PAM_PLUGINS = " \
58 pam-plugin-unix \
59 pam-plugin-loginuid \
60 pam-plugin-keyinit \
61"
62
63PACKAGECONFIG ??= " \
64 ${@bb.utils.filter('DISTRO_FEATURES', 'efi ldconfig pam selinux usrmerge polkit', d)} \
65 ${@bb.utils.contains('DISTRO_FEATURES', 'wifi', 'rfkill', '', d)} \
66 ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'xkbcommon', '', d)} \
67 acl \
68 backlight \
69 binfmt \
70 gshadow \
71 hibernate \
72 hostnamed \
Brad Bishop393846f2019-05-20 12:24:11 -040073 idn \
Brad Bishopc342db32019-05-15 21:57:59 -040074 ima \
75 kmod \
76 localed \
77 logind \
78 machined \
79 myhostname \
80 networkd \
81 nss \
82 nss-mymachines \
83 nss-resolve \
84 quotacheck \
85 randomseed \
86 resolved \
Brad Bishop79641f22019-09-10 07:20:22 -040087 set-time-epoch \
Brad Bishopc342db32019-05-15 21:57:59 -040088 smack \
89 sysusers \
90 timedated \
91 timesyncd \
92 utmp \
93 vconsole \
94 xz \
95"
96
97PACKAGECONFIG_remove_libc-musl = " \
98 gshadow \
Brad Bishop393846f2019-05-20 12:24:11 -040099 idn \
Brad Bishopc342db32019-05-15 21:57:59 -0400100 localed \
101 myhostname \
102 nss \
103 nss-mymachines \
104 nss-resolve \
105 resolved \
106 smack \
107 sysusers \
108 utmp \
109"
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"
Brad Bishopc68388fc2019-08-26 01:33:31 -0400126PACKAGECONFIG[gnu-efi] = "-Dgnu-efi=true -Defi-libdir=${STAGING_LIBDIR} -Defi-includedir=${STAGING_INCDIR}/efi,-Dgnu-efi=false,gnu-efi"
Brad Bishopc342db32019-05-15 21:57:59 -0400127PACKAGECONFIG[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"
Brad Bishop393846f2019-05-20 12:24:11 -0400135PACKAGECONFIG[idn] = "-Didn=true,-Didn=false"
Brad Bishopc342db32019-05-15 21:57:59 -0400136PACKAGECONFIG[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"
Brad Bishop1d80a2e2019-11-15 16:35:03 -0500143PACKAGECONFIG[ldconfig] = "-Dldconfig=true,-Dldconfig=false,,ldconfig"
Brad Bishopc342db32019-05-15 21:57:59 -0400144PACKAGECONFIG[libidn] = "-Dlibidn=true,-Dlibidn=false,libidn"
145PACKAGECONFIG[localed] = "-Dlocaled=true,-Dlocaled=false"
146PACKAGECONFIG[logind] = "-Dlogind=true,-Dlogind=false"
147PACKAGECONFIG[lz4] = "-Dlz4=true,-Dlz4=false,lz4"
148PACKAGECONFIG[machined] = "-Dmachined=true,-Dmachined=false"
149PACKAGECONFIG[manpages] = "-Dman=true,-Dman=false,libxslt-native xmlto-native docbook-xml-dtd4-native docbook-xsl-stylesheets-native"
150PACKAGECONFIG[microhttpd] = "-Dmicrohttpd=true,-Dmicrohttpd=false,libmicrohttpd"
151PACKAGECONFIG[myhostname] = "-Dnss-myhostname=true,-Dnss-myhostname=false,,libnss-myhostname"
152PACKAGECONFIG[networkd] = "-Dnetworkd=true,-Dnetworkd=false"
153PACKAGECONFIG[nss] = "-Dnss-systemd=true,-Dnss-systemd=false"
154PACKAGECONFIG[nss-mymachines] = "-Dnss-mymachines=true,-Dnss-mymachines=false"
155PACKAGECONFIG[nss-resolve] = "-Dnss-resolve=true,-Dnss-resolve=false"
156PACKAGECONFIG[openssl] = "-Dopenssl=true,-Dopenssl=false,openssl"
157PACKAGECONFIG[pam] = "-Dpam=true,-Dpam=false,libpam,${PAM_PLUGINS}"
158PACKAGECONFIG[pcre2] = "-Dpcre2=true,-Dpcre2=false,libpcre2"
159PACKAGECONFIG[polkit] = "-Dpolkit=true,-Dpolkit=false"
160PACKAGECONFIG[portabled] = "-Dportabled=true,-Dportabled=false"
161PACKAGECONFIG[qrencode] = "-Dqrencode=true,-Dqrencode=false,qrencode"
162PACKAGECONFIG[quotacheck] = "-Dquotacheck=true,-Dquotacheck=false"
163PACKAGECONFIG[randomseed] = "-Drandomseed=true,-Drandomseed=false"
164PACKAGECONFIG[resolved] = "-Dresolve=true,-Dresolve=false"
165PACKAGECONFIG[rfkill] = "-Drfkill=true,-Drfkill=false"
166# libseccomp is found in meta-security
167PACKAGECONFIG[seccomp] = "-Dseccomp=true,-Dseccomp=false,libseccomp"
168PACKAGECONFIG[selinux] = "-Dselinux=true,-Dselinux=false,libselinux,initscripts-sushell"
169PACKAGECONFIG[smack] = "-Dsmack=true,-Dsmack=false"
170PACKAGECONFIG[sysusers] = "-Dsysusers=true,-Dsysusers=false"
Brad Bishop79641f22019-09-10 07:20:22 -0400171# When enabled use reproducble build timestamp if set as time epoch,
172# or build time if not. When disabled, time epoch is unset.
173def build_epoch(d):
174 epoch = d.getVar('SOURCE_DATE_EPOCH') or "-1"
175 return '-Dtime-epoch=%d' % int(epoch)
176PACKAGECONFIG[set-time-epoch] = "${@build_epoch(d)},-Dtime-epoch=0"
Brad Bishopc342db32019-05-15 21:57:59 -0400177PACKAGECONFIG[timedated] = "-Dtimedated=true,-Dtimedated=false"
178PACKAGECONFIG[timesyncd] = "-Dtimesyncd=true,-Dtimesyncd=false"
179PACKAGECONFIG[usrmerge] = "-Dsplit-usr=false,-Dsplit-usr=true"
180PACKAGECONFIG[sbinmerge] = "-Dsplit-bin=false,-Dsplit-bin=true"
181PACKAGECONFIG[utmp] = "-Dutmp=true,-Dutmp=false"
182PACKAGECONFIG[valgrind] = "-DVALGRIND=1,,valgrind"
183PACKAGECONFIG[vconsole] = "-Dvconsole=true,-Dvconsole=false,,${PN}-vconsole-setup"
184# Verify keymaps on locale change
185PACKAGECONFIG[xkbcommon] = "-Dxkbcommon=true,-Dxkbcommon=false,libxkbcommon"
186PACKAGECONFIG[xz] = "-Dxz=true,-Dxz=false,xz"
187PACKAGECONFIG[zlib] = "-Dzlib=true,-Dzlib=false,zlib"
188
189# Helper variables to clarify locations. This mirrors the logic in systemd's
190# build system.
191rootprefix ?= "${root_prefix}"
192rootlibdir ?= "${base_libdir}"
193rootlibexecdir = "${rootprefix}/lib"
194
195# This links udev statically with systemd helper library.
196# Otherwise udev package would depend on systemd package (which has the needed shared library),
197# and always pull it into images.
198EXTRA_OEMESON += "-Dlink-udev-shared=false"
199
200EXTRA_OEMESON += "-Dnobody-user=nobody \
201 -Dnobody-group=nobody \
202 -Drootlibdir=${rootlibdir} \
203 -Drootprefix=${rootprefix} \
204 -Dsysvrcnd-path=${sysconfdir} \
205 -Ddefault-locale=C \
206 "
207
208# Hardcode target binary paths to avoid using paths from sysroot
209EXTRA_OEMESON += "-Dkexec-path=${sbindir}/kexec \
210 -Dkmod-path=${base_bindir}/kmod \
211 -Dmount-path=${base_bindir}/mount \
212 -Dquotacheck-path=${sbindir}/quotacheck \
213 -Dquotaon-path=${sbindir}/quotaon \
214 -Dsulogin-path=${base_sbindir}/sulogin \
Brad Bishop79641f22019-09-10 07:20:22 -0400215 -Dnologin-path=${base_sbindir}/nologin \
Brad Bishopc342db32019-05-15 21:57:59 -0400216 -Dumount-path=${base_bindir}/umount"
217
218do_install() {
219 meson_do_install
220 install -d ${D}/${base_sbindir}
221 if ${@bb.utils.contains('PACKAGECONFIG', 'serial-getty-generator', 'false', 'true', d)}; then
222 # Provided by a separate recipe
223 rm ${D}${systemd_unitdir}/system/serial-getty* -f
224 fi
225
226 # Provide support for initramfs
227 [ ! -e ${D}/init ] && ln -s ${rootlibexecdir}/systemd/systemd ${D}/init
228 [ ! -e ${D}/${base_sbindir}/udevd ] && ln -s ${rootlibexecdir}/systemd/systemd-udevd ${D}/${base_sbindir}/udevd
229
230 install -d ${D}${sysconfdir}/udev/rules.d/
231 install -d ${D}${sysconfdir}/tmpfiles.d
232 install -m 0644 ${WORKDIR}/*.rules ${D}${sysconfdir}/udev/rules.d/
Brad Bishopc342db32019-05-15 21:57:59 -0400233
234 install -m 0644 ${WORKDIR}/00-create-volatile.conf ${D}${sysconfdir}/tmpfiles.d/
235
236 if ${@bb.utils.contains('DISTRO_FEATURES','sysvinit','true','false',d)}; then
237 install -d ${D}${sysconfdir}/init.d
238 install -m 0755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/systemd-udevd
239 sed -i s%@UDEVD@%${rootlibexecdir}/systemd/systemd-udevd% ${D}${sysconfdir}/init.d/systemd-udevd
240 fi
241
242 chown root:systemd-journal ${D}/${localstatedir}/log/journal
243
244 # Delete journal README, as log can be symlinked inside volatile.
245 rm -f ${D}/${localstatedir}/log/README
246
247 # journal-remote creates this at start
248 rm -rf ${D}/${localstatedir}/log/journal/remote
249
250 install -d ${D}${systemd_unitdir}/system/graphical.target.wants
251 install -d ${D}${systemd_unitdir}/system/multi-user.target.wants
252 install -d ${D}${systemd_unitdir}/system/poweroff.target.wants
253 install -d ${D}${systemd_unitdir}/system/reboot.target.wants
254 install -d ${D}${systemd_unitdir}/system/rescue.target.wants
255
256 # Create symlinks for systemd-update-utmp-runlevel.service
257 if ${@bb.utils.contains('PACKAGECONFIG', 'utmp', 'true', 'false', d)}; then
258 ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_unitdir}/system/graphical.target.wants/systemd-update-utmp-runlevel.service
259 ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_unitdir}/system/multi-user.target.wants/systemd-update-utmp-runlevel.service
260 ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_unitdir}/system/poweroff.target.wants/systemd-update-utmp-runlevel.service
261 ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_unitdir}/system/reboot.target.wants/systemd-update-utmp-runlevel.service
262 ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_unitdir}/system/rescue.target.wants/systemd-update-utmp-runlevel.service
263 fi
264
265 # this file is needed to exist if networkd is disabled but timesyncd is still in use since timesyncd checks it
266 # for existence else it fails
267 if [ -s ${D}${exec_prefix}/lib/tmpfiles.d/systemd.conf ]; then
268 ${@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)}
269 fi
270 if ! ${@bb.utils.contains('PACKAGECONFIG', 'resolved', 'true', 'false', d)}; then
271 echo 'L! ${sysconfdir}/resolv.conf - - - - ../run/systemd/resolve/resolv.conf' >>${D}${exec_prefix}/lib/tmpfiles.d/etc.conf
272 echo 'd /run/systemd/resolve 0755 root root -' >>${D}${exec_prefix}/lib/tmpfiles.d/systemd.conf
273 echo 'f /run/systemd/resolve/resolv.conf 0644 root root' >>${D}${exec_prefix}/lib/tmpfiles.d/systemd.conf
274 ln -s ../run/systemd/resolve/resolv.conf ${D}${sysconfdir}/resolv-conf.systemd
275 else
276 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
277 ln -s ../run/systemd/resolve/resolv.conf ${D}${sysconfdir}/resolv-conf.systemd
278 fi
279 install -Dm 0755 ${S}/src/systemctl/systemd-sysv-install.SKELETON ${D}${systemd_unitdir}/systemd-sysv-install
280
281 # If polkit is setup fixup permissions and ownership
282 if ${@bb.utils.contains('PACKAGECONFIG', 'polkit', 'true', 'false', d)}; then
283 if [ -d ${D}${datadir}/polkit-1/rules.d ]; then
284 chmod 700 ${D}${datadir}/polkit-1/rules.d
285 chown polkitd:root ${D}${datadir}/polkit-1/rules.d
286 fi
287 fi
288
Brad Bishopa34c0302019-09-23 22:34:48 -0400289 # create link for existing udev rules
290 ln -s ${base_bindir}/udevadm ${D}${base_sbindir}/udevadm
291
Brad Bishopc342db32019-05-15 21:57:59 -0400292 # duplicate udevadm for postinst script
293 install -d ${D}${libexecdir}
294 ln ${D}${base_bindir}/udevadm ${D}${libexecdir}/${MLPREFIX}udevadm
295
296 # install default policy for presets
297 # https://www.freedesktop.org/wiki/Software/systemd/Preset/#howto
298 install -Dm 0644 ${WORKDIR}/99-default.preset ${D}${systemd_unitdir}/system-preset/99-default.preset
Brad Bishopc342db32019-05-15 21:57:59 -0400299
Brad Bishopf3f93bb2019-10-16 14:33:32 -0400300 # We use package postinsts for the hwdb update, as the update service is
301 # easily triggered for no reason and will slow down boots.
302 find ${D} -name systemd-hwdb-update.service -delete
Brad Bishopa34c0302019-09-23 22:34:48 -0400303}
Brad Bishopc342db32019-05-15 21:57:59 -0400304
305python populate_packages_prepend (){
306 systemdlibdir = d.getVar("rootlibdir")
307 do_split_packages(d, systemdlibdir, '^lib(.*)\.so\.*', 'lib%s', 'Systemd %s library', extra_depends='', allow_links=True)
308}
309PACKAGES_DYNAMIC += "^lib(udev|systemd|nss).*"
310
311PACKAGES =+ "\
312 ${PN}-gui \
313 ${PN}-vconsole-setup \
314 ${PN}-initramfs \
315 ${PN}-analyze \
316 ${PN}-kernel-install \
317 ${PN}-rpm-macros \
318 ${PN}-binfmt \
319 ${PN}-zsh-completion \
320 ${PN}-xorg-xinitrc \
321 ${PN}-container \
322 ${PN}-journal-gatewayd \
323 ${PN}-journal-upload \
324 ${PN}-journal-remote \
325 ${PN}-extra-utils \
326"
327
328SUMMARY_${PN}-container = "Tools for containers and VMs"
329DESCRIPTION_${PN}-container = "Systemd tools to spawn and manage containers and virtual machines."
330
331SUMMARY_${PN}-journal-gatewayd = "HTTP server for journal events"
332DESCRIPTION_${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."
333
334SUMMARY_${PN}-journal-upload = "Send journal messages over the network"
335DESCRIPTION_${PN}-journal-upload = "systemd-journal-upload uploads journal entries to a specified URL."
336
337SUMMARY_${PN}-journal-remote = "Receive journal messages over the network"
338DESCRIPTION_${PN}-journal-remote = "systemd-journal-remote is a command to receive serialized journal events and store them to journal files."
339
340SYSTEMD_PACKAGES = "${@bb.utils.contains('PACKAGECONFIG', 'binfmt', '${PN}-binfmt', '', d)} \
341 ${@bb.utils.contains('PACKAGECONFIG', 'microhttpd', '${PN}-journal-gatewayd', '', d)} \
342 ${@bb.utils.contains('PACKAGECONFIG', 'microhttpd', '${PN}-journal-remote', '', d)} \
343 ${@bb.utils.contains('PACKAGECONFIG', 'journal-upload', '${PN}-journal-upload', '', d)} \
344"
345SYSTEMD_SERVICE_${PN}-binfmt = "systemd-binfmt.service"
346
347USERADD_PACKAGES = "${PN} ${PN}-extra-utils \
348 ${@bb.utils.contains('PACKAGECONFIG', 'microhttpd', '${PN}-journal-gateway', '', d)} \
349 ${@bb.utils.contains('PACKAGECONFIG', 'microhttpd', '${PN}-journal-remote', '', d)} \
350 ${@bb.utils.contains('PACKAGECONFIG', 'journal-upload', '${PN}-journal-upload', '', d)} \
351"
352GROUPADD_PARAM_${PN} = "-r systemd-journal"
353USERADD_PARAM_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'coredump', '--system -d / -M --shell /bin/nologin systemd-coredump;', '', d)}"
354USERADD_PARAM_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'networkd', '--system -d / -M --shell /bin/nologin systemd-network;', '', d)}"
355USERADD_PARAM_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'polkit', '--system --no-create-home --user-group --home-dir ${sysconfdir}/polkit-1 polkitd;', '', d)}"
356USERADD_PARAM_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'resolved', '--system -d / -M --shell /bin/nologin systemd-resolve;', '', d)}"
357USERADD_PARAM_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'timesyncd', '--system -d / -M --shell /bin/nologin systemd-timesync;', '', d)}"
358USERADD_PARAM_${PN}-extra-utils = "--system -d / -M --shell /bin/nologin systemd-bus-proxy"
359USERADD_PARAM_${PN}-journal-gateway = "--system -d / -M --shell /bin/nologin systemd-journal-gateway"
360USERADD_PARAM_${PN}-journal-remote = "--system -d / -M --shell /bin/nologin systemd-journal-remote"
361USERADD_PARAM_${PN}-journal-upload = "--system -d / -M --shell /bin/nologin systemd-journal-upload"
362
363FILES_${PN}-analyze = "${bindir}/systemd-analyze"
364
365FILES_${PN}-initramfs = "/init"
366RDEPENDS_${PN}-initramfs = "${PN}"
367
368FILES_${PN}-gui = "${bindir}/systemadm"
369
370FILES_${PN}-vconsole-setup = "${rootlibexecdir}/systemd/systemd-vconsole-setup \
371 ${systemd_unitdir}/system/systemd-vconsole-setup.service \
372 ${systemd_unitdir}/system/sysinit.target.wants/systemd-vconsole-setup.service"
373
374RDEPENDS_${PN}-kernel-install += "bash"
375FILES_${PN}-kernel-install = "${bindir}/kernel-install \
376 ${sysconfdir}/kernel/ \
377 ${exec_prefix}/lib/kernel \
378 "
379FILES_${PN}-rpm-macros = "${exec_prefix}/lib/rpm \
380 "
381
382FILES_${PN}-xorg-xinitrc = "${sysconfdir}/X11/xinit/xinitrc.d/*"
383
384FILES_${PN}-zsh-completion = "${datadir}/zsh/site-functions"
385
386FILES_${PN}-binfmt = "${sysconfdir}/binfmt.d/ \
387 ${exec_prefix}/lib/binfmt.d \
388 ${rootlibexecdir}/systemd/systemd-binfmt \
389 ${systemd_unitdir}/system/proc-sys-fs-binfmt_misc.* \
390 ${systemd_unitdir}/system/systemd-binfmt.service"
391RRECOMMENDS_${PN}-binfmt = "kernel-module-binfmt-misc"
392
393RRECOMMENDS_${PN}-vconsole-setup = "kbd kbd-consolefonts kbd-keymaps"
394
395
396FILES_${PN}-journal-gatewayd = "${rootlibexecdir}/systemd/systemd-journal-gatewayd \
397 ${systemd_system_unitdir}/systemd-journal-gatewayd.service \
398 ${systemd_system_unitdir}/systemd-journal-gatewayd.socket \
399 ${systemd_system_unitdir}/sockets.target.wants/systemd-journal-gatewayd.socket \
400 ${datadir}/systemd/gatewayd/browse.html \
401 "
402SYSTEMD_SERVICE_${PN}-journal-gatewayd = "systemd-journal-gatewayd.socket"
403
404FILES_${PN}-journal-upload = "${rootlibexecdir}/systemd/systemd-journal-upload \
405 ${systemd_system_unitdir}/systemd-journal-upload.service \
406 ${sysconfdir}/systemd/journal-upload.conf \
407 "
408SYSTEMD_SERVICE_${PN}-journal-upload = "systemd-journal-upload.service"
409
410FILES_${PN}-journal-remote = "${rootlibexecdir}/systemd/systemd-journal-remote \
411 ${sysconfdir}/systemd/journal-remote.conf \
412 ${systemd_system_unitdir}/systemd-journal-remote.service \
413 ${systemd_system_unitdir}/systemd-journal-remote.socket \
414 "
415SYSTEMD_SERVICE_${PN}-remote = "systemd-journal-remote.socket"
416
417
418FILES_${PN}-container = "${sysconfdir}/dbus-1/system.d/org.freedesktop.import1.conf \
419 ${sysconfdir}/dbus-1/system.d/org.freedesktop.machine1.conf \
420 ${sysconfdir}/systemd/system/multi-user.target.wants/machines.target \
421 ${base_bindir}/machinectl \
422 ${bindir}/systemd-nspawn \
423 ${nonarch_libdir}/systemd/import-pubring.gpg \
424 ${systemd_system_unitdir}/busnames.target.wants/org.freedesktop.import1.busname \
425 ${systemd_system_unitdir}/busnames.target.wants/org.freedesktop.machine1.busname \
426 ${systemd_system_unitdir}/local-fs.target.wants/var-lib-machines.mount \
427 ${systemd_system_unitdir}/machines.target.wants/var-lib-machines.mount \
428 ${systemd_system_unitdir}/remote-fs.target.wants/var-lib-machines.mount \
429 ${systemd_system_unitdir}/machine.slice \
430 ${systemd_system_unitdir}/machines.target \
431 ${systemd_system_unitdir}/org.freedesktop.import1.busname \
432 ${systemd_system_unitdir}/org.freedesktop.machine1.busname \
433 ${systemd_system_unitdir}/systemd-importd.service \
434 ${systemd_system_unitdir}/systemd-machined.service \
435 ${systemd_system_unitdir}/dbus-org.freedesktop.machine1.service \
436 ${systemd_system_unitdir}/var-lib-machines.mount \
437 ${rootlibexecdir}/systemd/systemd-import \
438 ${rootlibexecdir}/systemd/systemd-importd \
439 ${rootlibexecdir}/systemd/systemd-machined \
440 ${rootlibexecdir}/systemd/systemd-pull \
441 ${exec_prefix}/lib/tmpfiles.d/systemd-nspawn.conf \
442 ${systemd_system_unitdir}/systemd-nspawn@.service \
443 ${libdir}/libnss_mymachines.so.2 \
444 ${datadir}/dbus-1/system-services/org.freedesktop.import1.service \
445 ${datadir}/dbus-1/system-services/org.freedesktop.machine1.service \
446 ${datadir}/dbus-1/system.d/org.freedesktop.import1.conf \
447 ${datadir}/dbus-1/system.d/org.freedesktop.machine1.conf \
448 ${datadir}/polkit-1/actions/org.freedesktop.import1.policy \
449 ${datadir}/polkit-1/actions/org.freedesktop.machine1.policy \
450 "
451
452RRECOMMENDS_${PN}-container += "\
453 ${PN}-journal-upload \
454 ${PN}-journal-remote \
455 ${PN}-journal-gatewayd \
456 "
457
458FILES_${PN}-extra-utils = "\
459 ${base_bindir}/systemd-escape \
460 ${base_bindir}/systemd-inhibit \
461 ${bindir}/systemd-detect-virt \
462 ${bindir}/systemd-path \
463 ${bindir}/systemd-run \
464 ${bindir}/systemd-cat \
465 ${bindir}/systemd-delta \
466 ${bindir}/systemd-cgls \
467 ${bindir}/systemd-cgtop \
468 ${bindir}/systemd-stdio-bridge \
469 ${base_bindir}/systemd-ask-password \
470 ${base_bindir}/systemd-tty-ask-password-agent \
471 ${systemd_unitdir}/system/systemd-ask-password-console.path \
472 ${systemd_unitdir}/system/systemd-ask-password-console.service \
473 ${systemd_unitdir}/system/systemd-ask-password-wall.path \
474 ${systemd_unitdir}/system/systemd-ask-password-wall.service \
475 ${systemd_unitdir}/system/sysinit.target.wants/systemd-ask-password-console.path \
476 ${systemd_unitdir}/system/sysinit.target.wants/systemd-ask-password-wall.path \
477 ${systemd_unitdir}/system/multi-user.target.wants/systemd-ask-password-wall.path \
478 ${rootlibexecdir}/systemd/systemd-resolve-host \
479 ${rootlibexecdir}/systemd/systemd-ac-power \
480 ${rootlibexecdir}/systemd/systemd-activate \
481 ${rootlibexecdir}/systemd/systemd-bus-proxyd \
482 ${systemd_unitdir}/system/systemd-bus-proxyd.service \
483 ${systemd_unitdir}/system/systemd-bus-proxyd.socket \
484 ${rootlibexecdir}/systemd/systemd-socket-proxyd \
485 ${rootlibexecdir}/systemd/systemd-reply-password \
486 ${rootlibexecdir}/systemd/systemd-sleep \
487 ${rootlibexecdir}/systemd/system-sleep \
488 ${systemd_unitdir}/system/systemd-hibernate.service \
489 ${systemd_unitdir}/system/systemd-hybrid-sleep.service \
490 ${systemd_unitdir}/system/systemd-suspend.service \
491 ${systemd_unitdir}/system/sleep.target \
492 ${rootlibexecdir}/systemd/systemd-initctl \
493 ${systemd_unitdir}/system/systemd-initctl.service \
494 ${systemd_unitdir}/system/systemd-initctl.socket \
495 ${systemd_unitdir}/system/sockets.target.wants/systemd-initctl.socket \
496 ${rootlibexecdir}/systemd/system-generators/systemd-gpt-auto-generator \
497 ${rootlibexecdir}/systemd/systemd-cgroups-agent \
498"
499
500CONFFILES_${PN} = "${sysconfdir}/systemd/coredump.conf \
501 ${sysconfdir}/systemd/journald.conf \
502 ${sysconfdir}/systemd/logind.conf \
503 ${sysconfdir}/systemd/system.conf \
504 ${sysconfdir}/systemd/user.conf \
505 ${sysconfdir}/systemd/resolved.conf \
506 ${sysconfdir}/systemd/timesyncd.conf \
507"
508
509FILES_${PN} = " ${base_bindir}/* \
510 ${base_sbindir}/shutdown \
511 ${base_sbindir}/halt \
512 ${base_sbindir}/poweroff \
513 ${base_sbindir}/runlevel \
514 ${base_sbindir}/telinit \
515 ${base_sbindir}/resolvconf \
516 ${base_sbindir}/reboot \
517 ${base_sbindir}/init \
518 ${datadir}/dbus-1/services \
519 ${datadir}/dbus-1/system-services \
520 ${datadir}/polkit-1 \
521 ${datadir}/${BPN} \
522 ${datadir}/factory \
523 ${sysconfdir}/dbus-1/ \
524 ${sysconfdir}/modules-load.d/ \
525 ${sysconfdir}/pam.d/ \
526 ${sysconfdir}/sysctl.d/ \
527 ${sysconfdir}/systemd/ \
528 ${sysconfdir}/tmpfiles.d/ \
529 ${sysconfdir}/xdg/ \
530 ${sysconfdir}/init.d/README \
531 ${sysconfdir}/resolv-conf.systemd \
532 ${rootlibexecdir}/systemd/* \
533 ${systemd_unitdir}/* \
534 ${base_libdir}/security/*.so \
535 /cgroup \
536 ${bindir}/systemd* \
537 ${bindir}/busctl \
538 ${bindir}/coredumpctl \
539 ${bindir}/localectl \
540 ${bindir}/hostnamectl \
541 ${bindir}/resolvectl \
542 ${bindir}/timedatectl \
543 ${bindir}/bootctl \
544 ${bindir}/kernel-install \
545 ${exec_prefix}/lib/tmpfiles.d/*.conf \
546 ${exec_prefix}/lib/systemd \
547 ${exec_prefix}/lib/modules-load.d \
548 ${exec_prefix}/lib/sysctl.d \
549 ${exec_prefix}/lib/sysusers.d \
550 ${exec_prefix}/lib/environment.d \
551 ${localstatedir} \
552 ${nonarch_base_libdir}/udev/rules.d/70-uaccess.rules \
553 ${nonarch_base_libdir}/udev/rules.d/71-seat.rules \
554 ${nonarch_base_libdir}/udev/rules.d/73-seat-late.rules \
555 ${nonarch_base_libdir}/udev/rules.d/99-systemd.rules \
556 ${nonarch_base_libdir}/modprobe.d/systemd.conf \
557 ${datadir}/dbus-1/system.d/org.freedesktop.timedate1.conf \
558 ${datadir}/dbus-1/system.d/org.freedesktop.locale1.conf \
559 ${datadir}/dbus-1/system.d/org.freedesktop.network1.conf \
560 ${datadir}/dbus-1/system.d/org.freedesktop.resolve1.conf \
561 ${datadir}/dbus-1/system.d/org.freedesktop.systemd1.conf \
562 ${datadir}/dbus-1/system.d/org.freedesktop.hostname1.conf \
563 ${datadir}/dbus-1/system.d/org.freedesktop.login1.conf \
564 ${datadir}/dbus-1/system.d/org.freedesktop.timesync1.conf \
565 ${datadir}/dbus-1/system.d/org.freedesktop.portable1.conf \
566 "
567
568FILES_${PN}-dev += "${base_libdir}/security/*.la ${datadir}/dbus-1/interfaces/ ${sysconfdir}/rpm/macros.systemd"
569
570RDEPENDS_${PN} += "kmod dbus util-linux-mount util-linux-umount udev (= ${EXTENDPKGV}) util-linux-agetty util-linux-fsck"
571RDEPENDS_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'serial-getty-generator', '', 'systemd-serialgetty', d)}"
572RDEPENDS_${PN} += "volatile-binds update-rc.d"
573
574RRECOMMENDS_${PN} += "systemd-extra-utils \
575 systemd-compat-units udev-hwdb \
576 e2fsprogs-e2fsck \
577 kernel-module-autofs4 kernel-module-unix kernel-module-ipv6 \
578 os-release \
579 systemd-conf \
580"
581
582INSANE_SKIP_${PN} += "dev-so libdir"
583INSANE_SKIP_${PN}-dbg += "libdir"
584INSANE_SKIP_${PN}-doc += " libdir"
585
586PACKAGES =+ "udev udev-hwdb"
587
588RPROVIDES_udev = "hotplug"
589
590RDEPENDS_udev-hwdb += "udev"
591
592FILES_udev += "${base_sbindir}/udevd \
593 ${rootlibexecdir}/systemd/network/99-default.link \
594 ${rootlibexecdir}/systemd/systemd-udevd \
595 ${rootlibexecdir}/udev/accelerometer \
596 ${rootlibexecdir}/udev/ata_id \
597 ${rootlibexecdir}/udev/cdrom_id \
598 ${rootlibexecdir}/udev/collect \
599 ${rootlibexecdir}/udev/findkeyboards \
600 ${rootlibexecdir}/udev/keyboard-force-release.sh \
601 ${rootlibexecdir}/udev/keymap \
602 ${rootlibexecdir}/udev/mtd_probe \
603 ${rootlibexecdir}/udev/scsi_id \
604 ${rootlibexecdir}/udev/v4l_id \
605 ${rootlibexecdir}/udev/keymaps \
606 ${rootlibexecdir}/udev/rules.d/*.rules \
607 ${sysconfdir}/udev \
608 ${sysconfdir}/init.d/systemd-udevd \
609 ${systemd_unitdir}/system/*udev* \
610 ${systemd_unitdir}/system/*.wants/*udev* \
611 ${base_bindir}/udevadm \
Brad Bishopa34c0302019-09-23 22:34:48 -0400612 ${base_sbindir}/udevadm \
Brad Bishopc342db32019-05-15 21:57:59 -0400613 ${libexecdir}/${MLPREFIX}udevadm \
614 ${datadir}/bash-completion/completions/udevadm \
615 "
616
617FILES_udev-hwdb = "${rootlibexecdir}/udev/hwdb.d"
618
Brad Bishop15ae2502019-06-18 21:44:24 -0400619RCONFLICTS_${PN} = "tiny-init ${@bb.utils.contains('PACKAGECONFIG', 'resolved', 'resolvconf', '', d)}"
620
Brad Bishopc342db32019-05-15 21:57:59 -0400621INITSCRIPT_PACKAGES = "udev"
622INITSCRIPT_NAME_udev = "systemd-udevd"
623INITSCRIPT_PARAMS_udev = "start 03 S ."
624
625python __anonymous() {
626 if not bb.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d):
627 d.setVar("INHIBIT_UPDATERCD_BBCLASS", "1")
628}
629
Brad Bishop79641f22019-09-10 07:20:22 -0400630python do_warn_musl() {
631 if d.getVar('TCLIBC') == "musl":
632 bb.warn("Using systemd with musl is not recommended since it is not supported upstream and some patches are known to be problematic.")
633}
634addtask warn_musl before do_configure
635
Brad Bishop00e122a2019-10-05 11:10:57 -0400636ALTERNATIVE_${PN} = "halt reboot shutdown poweroff runlevel ${@bb.utils.contains('PACKAGECONFIG', 'resolved', 'resolv-conf', '', d)}"
Brad Bishopc342db32019-05-15 21:57:59 -0400637
638ALTERNATIVE_TARGET[resolv-conf] = "${sysconfdir}/resolv-conf.systemd"
639ALTERNATIVE_LINK_NAME[resolv-conf] = "${sysconfdir}/resolv.conf"
640ALTERNATIVE_PRIORITY[resolv-conf] ?= "50"
641
642ALTERNATIVE_TARGET[halt] = "${base_bindir}/systemctl"
643ALTERNATIVE_LINK_NAME[halt] = "${base_sbindir}/halt"
644ALTERNATIVE_PRIORITY[halt] ?= "300"
645
646ALTERNATIVE_TARGET[reboot] = "${base_bindir}/systemctl"
647ALTERNATIVE_LINK_NAME[reboot] = "${base_sbindir}/reboot"
648ALTERNATIVE_PRIORITY[reboot] ?= "300"
649
650ALTERNATIVE_TARGET[shutdown] = "${base_bindir}/systemctl"
651ALTERNATIVE_LINK_NAME[shutdown] = "${base_sbindir}/shutdown"
652ALTERNATIVE_PRIORITY[shutdown] ?= "300"
653
654ALTERNATIVE_TARGET[poweroff] = "${base_bindir}/systemctl"
655ALTERNATIVE_LINK_NAME[poweroff] = "${base_sbindir}/poweroff"
656ALTERNATIVE_PRIORITY[poweroff] ?= "300"
657
658ALTERNATIVE_TARGET[runlevel] = "${base_bindir}/systemctl"
659ALTERNATIVE_LINK_NAME[runlevel] = "${base_sbindir}/runlevel"
660ALTERNATIVE_PRIORITY[runlevel] ?= "300"
661
Brad Bishopa34c0302019-09-23 22:34:48 -0400662pkg_postinst_${PN}_libc-glibc () {
Brad Bishopc342db32019-05-15 21:57:59 -0400663 sed -e '/^hosts:/s/\s*\<myhostname\>//' \
664 -e 's/\(^hosts:.*\)\(\<files\>\)\(.*\)\(\<dns\>\)\(.*\)/\1\2 myhostname \3\4\5/' \
665 -i $D${sysconfdir}/nsswitch.conf
666}
667
Brad Bishopa34c0302019-09-23 22:34:48 -0400668pkg_prerm_${PN}_libc-glibc () {
Brad Bishopc342db32019-05-15 21:57:59 -0400669 sed -e '/^hosts:/s/\s*\<myhostname\>//' \
670 -e '/^hosts:/s/\s*myhostname//' \
671 -i $D${sysconfdir}/nsswitch.conf
672}
673
674PACKAGE_WRITE_DEPS += "qemu-native"
675pkg_postinst_udev-hwdb () {
676 if test -n "$D"; then
677 $INTERCEPT_DIR/postinst_intercept update_udev_hwdb ${PKG} mlprefix=${MLPREFIX} binprefix=${MLPREFIX}
678 else
679 udevadm hwdb --update
680 fi
681}
682
683pkg_prerm_udev-hwdb () {
684 rm -f $D${sysconfdir}/udev/hwdb.bin
685}