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