blob: ce6ac7ebaa0450510ba5002d33dc49347f446a3b [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 \
Andrew Geisslerc926e172021-05-07 16:11:35 -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 ??= " \
Andrew Geisslerc926e172021-05-07 16:11:35 -050068 ${@bb.utils.filter('DISTRO_FEATURES', 'acl audit efi ldconfig pam selinux smack usrmerge polkit seccomp', d)} \
Andrew Geissler82c905d2020-04-13 13:39:40 -050069 ${@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"
Andrew Geissler82c905d2020-04-13 13:39:40 -0500180PACKAGECONFIG[seccomp] = "-Dseccomp=true,-Dseccomp=false,libseccomp"
181PACKAGECONFIG[selinux] = "-Dselinux=true,-Dselinux=false,libselinux,initscripts-sushell"
182PACKAGECONFIG[smack] = "-Dsmack=true,-Dsmack=false"
183PACKAGECONFIG[sysusers] = "-Dsysusers=true,-Dsysusers=false"
184PACKAGECONFIG[sysvinit] = "-Dsysvinit-path=${sysconfdir}/init.d -Dsysvrcnd-path=${sysconfdir},-Dsysvinit-path= -Dsysvrcnd-path=,,systemd-compat-units update-rc.d"
185# When enabled use reproducble build timestamp if set as time epoch,
186# or build time if not. When disabled, time epoch is unset.
187def build_epoch(d):
188 epoch = d.getVar('SOURCE_DATE_EPOCH') or "-1"
189 return '-Dtime-epoch=%d' % int(epoch)
190PACKAGECONFIG[set-time-epoch] = "${@build_epoch(d)},-Dtime-epoch=0"
191PACKAGECONFIG[timedated] = "-Dtimedated=true,-Dtimedated=false"
192PACKAGECONFIG[timesyncd] = "-Dtimesyncd=true,-Dtimesyncd=false"
193PACKAGECONFIG[usrmerge] = "-Dsplit-usr=false,-Dsplit-usr=true"
194PACKAGECONFIG[sbinmerge] = "-Dsplit-bin=false,-Dsplit-bin=true"
195PACKAGECONFIG[userdb] = "-Duserdb=true,-Duserdb=false"
196PACKAGECONFIG[utmp] = "-Dutmp=true,-Dutmp=false"
197PACKAGECONFIG[valgrind] = "-DVALGRIND=1,,valgrind"
198PACKAGECONFIG[vconsole] = "-Dvconsole=true,-Dvconsole=false,,${PN}-vconsole-setup"
Andrew Geisslerc3d88e42020-10-02 09:45:00 -0500199PACKAGECONFIG[xdg-autostart] = "-Dxdg-autostart=true,-Dxdg-autostart=false"
Andrew Geissler82c905d2020-04-13 13:39:40 -0500200# Verify keymaps on locale change
201PACKAGECONFIG[xkbcommon] = "-Dxkbcommon=true,-Dxkbcommon=false,libxkbcommon"
202PACKAGECONFIG[xz] = "-Dxz=true,-Dxz=false,xz"
203PACKAGECONFIG[zlib] = "-Dzlib=true,-Dzlib=false,zlib"
204
205# Helper variables to clarify locations. This mirrors the logic in systemd's
206# build system.
207rootprefix ?= "${root_prefix}"
208rootlibdir ?= "${base_libdir}"
209rootlibexecdir = "${rootprefix}/lib"
210
211# This links udev statically with systemd helper library.
212# Otherwise udev package would depend on systemd package (which has the needed shared library),
213# and always pull it into images.
214EXTRA_OEMESON += "-Dlink-udev-shared=false"
215
216EXTRA_OEMESON += "-Dnobody-user=nobody \
217 -Dnobody-group=nobody \
218 -Drootlibdir=${rootlibdir} \
219 -Drootprefix=${rootprefix} \
220 -Ddefault-locale=C \
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600221 -Dmode=release \
222 -Dsystem-alloc-uid-min=101 \
223 -Dsystem-uid-max=999 \
224 -Dsystem-alloc-gid-min=101 \
225 -Dsystem-gid-max=999 \
Andrew Geissler82c905d2020-04-13 13:39:40 -0500226 "
227
228# Hardcode target binary paths to avoid using paths from sysroot
229EXTRA_OEMESON += "-Dkexec-path=${sbindir}/kexec \
230 -Dkmod-path=${base_bindir}/kmod \
231 -Dmount-path=${base_bindir}/mount \
232 -Dquotacheck-path=${sbindir}/quotacheck \
233 -Dquotaon-path=${sbindir}/quotaon \
234 -Dsulogin-path=${base_sbindir}/sulogin \
235 -Dnologin-path=${base_sbindir}/nologin \
236 -Dumount-path=${base_bindir}/umount"
237
238do_install() {
239 meson_do_install
240 install -d ${D}/${base_sbindir}
241 if ${@bb.utils.contains('PACKAGECONFIG', 'serial-getty-generator', 'false', 'true', d)}; then
242 # Provided by a separate recipe
243 rm ${D}${systemd_unitdir}/system/serial-getty* -f
244 fi
245
246 # Provide support for initramfs
247 [ ! -e ${D}/init ] && ln -s ${rootlibexecdir}/systemd/systemd ${D}/init
248 [ ! -e ${D}/${base_sbindir}/udevd ] && ln -s ${rootlibexecdir}/systemd/systemd-udevd ${D}/${base_sbindir}/udevd
249
250 install -d ${D}${sysconfdir}/udev/rules.d/
251 install -d ${D}${sysconfdir}/tmpfiles.d
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500252 for rule in $(find ${WORKDIR} -maxdepth 1 -type f -name "*.rules"); do
253 install -m 0644 $rule ${D}${sysconfdir}/udev/rules.d/
254 done
Andrew Geissler82c905d2020-04-13 13:39:40 -0500255
256 install -m 0644 ${WORKDIR}/00-create-volatile.conf ${D}${sysconfdir}/tmpfiles.d/
257
258 if ${@bb.utils.contains('DISTRO_FEATURES','sysvinit','true','false',d)}; then
259 install -d ${D}${sysconfdir}/init.d
260 install -m 0755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/systemd-udevd
261 sed -i s%@UDEVD@%${rootlibexecdir}/systemd/systemd-udevd% ${D}${sysconfdir}/init.d/systemd-udevd
262 install -Dm 0755 ${S}/src/systemctl/systemd-sysv-install.SKELETON ${D}${systemd_unitdir}/systemd-sysv-install
263 fi
264
265 chown root:systemd-journal ${D}/${localstatedir}/log/journal
266
267 # Delete journal README, as log can be symlinked inside volatile.
268 rm -f ${D}/${localstatedir}/log/README
269
270 # journal-remote creates this at start
271 rm -rf ${D}/${localstatedir}/log/journal/remote
272
273 install -d ${D}${systemd_unitdir}/system/graphical.target.wants
274 install -d ${D}${systemd_unitdir}/system/multi-user.target.wants
275 install -d ${D}${systemd_unitdir}/system/poweroff.target.wants
276 install -d ${D}${systemd_unitdir}/system/reboot.target.wants
277 install -d ${D}${systemd_unitdir}/system/rescue.target.wants
278
279 # Create symlinks for systemd-update-utmp-runlevel.service
280 if ${@bb.utils.contains('PACKAGECONFIG', 'utmp', 'true', 'false', d)}; then
281 ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_unitdir}/system/graphical.target.wants/systemd-update-utmp-runlevel.service
282 ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_unitdir}/system/multi-user.target.wants/systemd-update-utmp-runlevel.service
283 ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_unitdir}/system/poweroff.target.wants/systemd-update-utmp-runlevel.service
284 ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_unitdir}/system/reboot.target.wants/systemd-update-utmp-runlevel.service
285 ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_unitdir}/system/rescue.target.wants/systemd-update-utmp-runlevel.service
286 fi
287
288 # this file is needed to exist if networkd is disabled but timesyncd is still in use since timesyncd checks it
289 # for existence else it fails
290 if [ -s ${D}${exec_prefix}/lib/tmpfiles.d/systemd.conf ]; then
291 ${@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)}
292 fi
293 if ! ${@bb.utils.contains('PACKAGECONFIG', 'resolved', 'true', 'false', d)}; then
294 echo 'L! ${sysconfdir}/resolv.conf - - - - ../run/systemd/resolve/resolv.conf' >>${D}${exec_prefix}/lib/tmpfiles.d/etc.conf
295 echo 'd /run/systemd/resolve 0755 root root -' >>${D}${exec_prefix}/lib/tmpfiles.d/systemd.conf
296 echo 'f /run/systemd/resolve/resolv.conf 0644 root root' >>${D}${exec_prefix}/lib/tmpfiles.d/systemd.conf
297 ln -s ../run/systemd/resolve/resolv.conf ${D}${sysconfdir}/resolv-conf.systemd
298 else
299 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
300 ln -s ../run/systemd/resolve/resolv.conf ${D}${sysconfdir}/resolv-conf.systemd
301 fi
302 if ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'false', 'true', d)}; then
303 rm ${D}${exec_prefix}/lib/tmpfiles.d/x11.conf
304 rm -r ${D}${sysconfdir}/X11
305 fi
306
307 # If polkit is setup fixup permissions and ownership
308 if ${@bb.utils.contains('PACKAGECONFIG', 'polkit', 'true', 'false', d)}; then
309 if [ -d ${D}${datadir}/polkit-1/rules.d ]; then
310 chmod 700 ${D}${datadir}/polkit-1/rules.d
311 chown polkitd:root ${D}${datadir}/polkit-1/rules.d
312 fi
313 fi
314
Andrew Geissler9b4d8b02021-02-19 12:26:16 -0600315 # If polkit is not available and a fallback was requested, install a drop-in that allows networkd to
316 # request hostname changes via DBUS without elevating its privileges
317 if ${@bb.utils.contains('PACKAGECONFIG', 'polkit_hostnamed_fallback', 'true', 'false', d)}; then
318 install -d ${D}${systemd_unitdir}/system/systemd-hostnamed.service.d/
319 install -m 0644 ${WORKDIR}/00-hostnamed-network-user.conf ${D}${systemd_unitdir}/system/systemd-hostnamed.service.d/
320 install -d ${D}${datadir}/dbus-1/system.d/
321 install -m 0644 ${WORKDIR}/org.freedesktop.hostname1_no_polkit.conf ${D}${datadir}/dbus-1/system.d/
322 fi
323
Andrew Geissler82c905d2020-04-13 13:39:40 -0500324 # create link for existing udev rules
325 ln -s ${base_bindir}/udevadm ${D}${base_sbindir}/udevadm
326
327 # duplicate udevadm for postinst script
328 install -d ${D}${libexecdir}
329 ln ${D}${base_bindir}/udevadm ${D}${libexecdir}/${MLPREFIX}udevadm
330
331 # install default policy for presets
332 # https://www.freedesktop.org/wiki/Software/systemd/Preset/#howto
333 install -Dm 0644 ${WORKDIR}/99-default.preset ${D}${systemd_unitdir}/system-preset/99-default.preset
Andrew Geissler6ce62a22020-11-30 19:58:47 -0600334
335 # add a profile fragment to disable systemd pager with busybox less
336 install -Dm 0644 ${WORKDIR}/systemd-pager.sh ${D}${sysconfdir}/profile.d/systemd-pager.sh
Andrew Geissler82c905d2020-04-13 13:39:40 -0500337}
338
339python populate_packages_prepend (){
340 systemdlibdir = d.getVar("rootlibdir")
341 do_split_packages(d, systemdlibdir, '^lib(.*)\.so\.*', 'lib%s', 'Systemd %s library', extra_depends='', allow_links=True)
342}
343PACKAGES_DYNAMIC += "^lib(udev|systemd|nss).*"
344
345PACKAGE_BEFORE_PN = "\
346 ${PN}-gui \
347 ${PN}-vconsole-setup \
348 ${PN}-initramfs \
349 ${PN}-analyze \
350 ${PN}-kernel-install \
351 ${PN}-rpm-macros \
352 ${PN}-binfmt \
353 ${PN}-zsh-completion \
354 ${PN}-container \
355 ${PN}-journal-gatewayd \
356 ${PN}-journal-upload \
357 ${PN}-journal-remote \
358 ${PN}-extra-utils \
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500359 ${PN}-udev-rules \
Andrew Geissler82c905d2020-04-13 13:39:40 -0500360 udev \
361 udev-hwdb \
362"
363
364SUMMARY_${PN}-container = "Tools for containers and VMs"
365DESCRIPTION_${PN}-container = "Systemd tools to spawn and manage containers and virtual machines."
366
367SUMMARY_${PN}-journal-gatewayd = "HTTP server for journal events"
368DESCRIPTION_${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."
369
370SUMMARY_${PN}-journal-upload = "Send journal messages over the network"
371DESCRIPTION_${PN}-journal-upload = "systemd-journal-upload uploads journal entries to a specified URL."
372
373SUMMARY_${PN}-journal-remote = "Receive journal messages over the network"
374DESCRIPTION_${PN}-journal-remote = "systemd-journal-remote is a command to receive serialized journal events and store them to journal files."
375
376SYSTEMD_PACKAGES = "${@bb.utils.contains('PACKAGECONFIG', 'binfmt', '${PN}-binfmt', '', d)} \
377 ${@bb.utils.contains('PACKAGECONFIG', 'microhttpd', '${PN}-journal-gatewayd', '', d)} \
378 ${@bb.utils.contains('PACKAGECONFIG', 'microhttpd', '${PN}-journal-remote', '', d)} \
379 ${@bb.utils.contains('PACKAGECONFIG', 'journal-upload', '${PN}-journal-upload', '', d)} \
380"
381SYSTEMD_SERVICE_${PN}-binfmt = "systemd-binfmt.service"
382
383USERADD_PACKAGES = "${PN} ${PN}-extra-utils \
384 ${@bb.utils.contains('PACKAGECONFIG', 'microhttpd', '${PN}-journal-gateway', '', d)} \
385 ${@bb.utils.contains('PACKAGECONFIG', 'microhttpd', '${PN}-journal-remote', '', d)} \
386 ${@bb.utils.contains('PACKAGECONFIG', 'journal-upload', '${PN}-journal-upload', '', d)} \
387"
Andrew Geissler9b4d8b02021-02-19 12:26:16 -0600388GROUPADD_PARAM_${PN} = "-r systemd-journal;"
389GROUPADD_PARAM_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'polkit_hostnamed_fallback', '-r systemd-hostname;', '', d)}"
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600390USERADD_PARAM_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'coredump', '--system -d / -M --shell /sbin/nologin systemd-coredump;', '', d)}"
391USERADD_PARAM_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'networkd', '--system -d / -M --shell /sbin/nologin systemd-network;', '', d)}"
Andrew Geissler82c905d2020-04-13 13:39:40 -0500392USERADD_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 -0600393USERADD_PARAM_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'resolved', '--system -d / -M --shell /sbin/nologin systemd-resolve;', '', d)}"
394USERADD_PARAM_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'timesyncd', '--system -d / -M --shell /sbin/nologin systemd-timesync;', '', d)}"
395USERADD_PARAM_${PN}-extra-utils = "--system -d / -M --shell /sbin/nologin systemd-bus-proxy"
396USERADD_PARAM_${PN}-journal-gateway = "--system -d / -M --shell /sbin/nologin systemd-journal-gateway"
397USERADD_PARAM_${PN}-journal-remote = "--system -d / -M --shell /sbin/nologin systemd-journal-remote"
398USERADD_PARAM_${PN}-journal-upload = "--system -d / -M --shell /sbin/nologin systemd-journal-upload"
Andrew Geissler82c905d2020-04-13 13:39:40 -0500399
400FILES_${PN}-analyze = "${bindir}/systemd-analyze"
401
402FILES_${PN}-initramfs = "/init"
403RDEPENDS_${PN}-initramfs = "${PN}"
404
405FILES_${PN}-gui = "${bindir}/systemadm"
406
407FILES_${PN}-vconsole-setup = "${rootlibexecdir}/systemd/systemd-vconsole-setup \
408 ${systemd_unitdir}/system/systemd-vconsole-setup.service \
409 ${systemd_unitdir}/system/sysinit.target.wants/systemd-vconsole-setup.service"
410
411RDEPENDS_${PN}-kernel-install += "bash"
412FILES_${PN}-kernel-install = "${bindir}/kernel-install \
413 ${sysconfdir}/kernel/ \
414 ${exec_prefix}/lib/kernel \
415 "
416FILES_${PN}-rpm-macros = "${exec_prefix}/lib/rpm \
417 "
418
419FILES_${PN}-zsh-completion = "${datadir}/zsh/site-functions"
420
421FILES_${PN}-binfmt = "${sysconfdir}/binfmt.d/ \
422 ${exec_prefix}/lib/binfmt.d \
423 ${rootlibexecdir}/systemd/systemd-binfmt \
424 ${systemd_unitdir}/system/proc-sys-fs-binfmt_misc.* \
425 ${systemd_unitdir}/system/systemd-binfmt.service"
426RRECOMMENDS_${PN}-binfmt = "kernel-module-binfmt-misc"
427
428RRECOMMENDS_${PN}-vconsole-setup = "kbd kbd-consolefonts kbd-keymaps"
429
430
431FILES_${PN}-journal-gatewayd = "${rootlibexecdir}/systemd/systemd-journal-gatewayd \
432 ${systemd_system_unitdir}/systemd-journal-gatewayd.service \
433 ${systemd_system_unitdir}/systemd-journal-gatewayd.socket \
434 ${systemd_system_unitdir}/sockets.target.wants/systemd-journal-gatewayd.socket \
435 ${datadir}/systemd/gatewayd/browse.html \
436 "
437SYSTEMD_SERVICE_${PN}-journal-gatewayd = "systemd-journal-gatewayd.socket"
438
439FILES_${PN}-journal-upload = "${rootlibexecdir}/systemd/systemd-journal-upload \
440 ${systemd_system_unitdir}/systemd-journal-upload.service \
441 ${sysconfdir}/systemd/journal-upload.conf \
442 "
443SYSTEMD_SERVICE_${PN}-journal-upload = "systemd-journal-upload.service"
444
445FILES_${PN}-journal-remote = "${rootlibexecdir}/systemd/systemd-journal-remote \
446 ${sysconfdir}/systemd/journal-remote.conf \
447 ${systemd_system_unitdir}/systemd-journal-remote.service \
448 ${systemd_system_unitdir}/systemd-journal-remote.socket \
449 "
450SYSTEMD_SERVICE_${PN}-journal-remote = "systemd-journal-remote.socket"
451
452
453FILES_${PN}-container = "${sysconfdir}/dbus-1/system.d/org.freedesktop.import1.conf \
454 ${sysconfdir}/dbus-1/system.d/org.freedesktop.machine1.conf \
455 ${sysconfdir}/systemd/system/multi-user.target.wants/machines.target \
456 ${base_bindir}/machinectl \
457 ${bindir}/systemd-nspawn \
458 ${nonarch_libdir}/systemd/import-pubring.gpg \
459 ${systemd_system_unitdir}/busnames.target.wants/org.freedesktop.import1.busname \
460 ${systemd_system_unitdir}/busnames.target.wants/org.freedesktop.machine1.busname \
461 ${systemd_system_unitdir}/local-fs.target.wants/var-lib-machines.mount \
462 ${systemd_system_unitdir}/machines.target.wants/var-lib-machines.mount \
463 ${systemd_system_unitdir}/remote-fs.target.wants/var-lib-machines.mount \
464 ${systemd_system_unitdir}/machine.slice \
465 ${systemd_system_unitdir}/machines.target \
466 ${systemd_system_unitdir}/org.freedesktop.import1.busname \
467 ${systemd_system_unitdir}/org.freedesktop.machine1.busname \
468 ${systemd_system_unitdir}/systemd-importd.service \
469 ${systemd_system_unitdir}/systemd-machined.service \
470 ${systemd_system_unitdir}/dbus-org.freedesktop.machine1.service \
471 ${systemd_system_unitdir}/var-lib-machines.mount \
472 ${rootlibexecdir}/systemd/systemd-import \
473 ${rootlibexecdir}/systemd/systemd-importd \
474 ${rootlibexecdir}/systemd/systemd-machined \
475 ${rootlibexecdir}/systemd/systemd-pull \
476 ${exec_prefix}/lib/tmpfiles.d/systemd-nspawn.conf \
477 ${systemd_system_unitdir}/systemd-nspawn@.service \
478 ${libdir}/libnss_mymachines.so.2 \
479 ${datadir}/dbus-1/system-services/org.freedesktop.import1.service \
480 ${datadir}/dbus-1/system-services/org.freedesktop.machine1.service \
481 ${datadir}/dbus-1/system.d/org.freedesktop.import1.conf \
482 ${datadir}/dbus-1/system.d/org.freedesktop.machine1.conf \
483 ${datadir}/polkit-1/actions/org.freedesktop.import1.policy \
484 ${datadir}/polkit-1/actions/org.freedesktop.machine1.policy \
485 "
486
Andrew Geissler95ac1b82021-03-31 14:34:31 -0500487# "machinectl import-tar" uses "tar --numeric-owner", not supported by busybox.
Andrew Geissler82c905d2020-04-13 13:39:40 -0500488RRECOMMENDS_${PN}-container += "\
Andrew Geissler82c905d2020-04-13 13:39:40 -0500489 ${PN}-journal-gatewayd \
Andrew Geissler95ac1b82021-03-31 14:34:31 -0500490 ${PN}-journal-remote \
491 ${PN}-journal-upload \
492 kernel-module-dm-mod \
493 kernel-module-loop \
494 kernel-module-tun \
495 tar \
Andrew Geissler82c905d2020-04-13 13:39:40 -0500496 "
497
498FILES_${PN}-extra-utils = "\
499 ${base_bindir}/systemd-escape \
500 ${base_bindir}/systemd-inhibit \
501 ${bindir}/systemd-detect-virt \
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600502 ${bindir}/systemd-dissect \
Andrew Geissler82c905d2020-04-13 13:39:40 -0500503 ${bindir}/systemd-path \
504 ${bindir}/systemd-run \
505 ${bindir}/systemd-cat \
506 ${bindir}/systemd-delta \
507 ${bindir}/systemd-cgls \
508 ${bindir}/systemd-cgtop \
509 ${bindir}/systemd-stdio-bridge \
510 ${base_bindir}/systemd-ask-password \
511 ${base_bindir}/systemd-tty-ask-password-agent \
512 ${systemd_unitdir}/system/systemd-ask-password-console.path \
513 ${systemd_unitdir}/system/systemd-ask-password-console.service \
514 ${systemd_unitdir}/system/systemd-ask-password-wall.path \
515 ${systemd_unitdir}/system/systemd-ask-password-wall.service \
516 ${systemd_unitdir}/system/sysinit.target.wants/systemd-ask-password-console.path \
517 ${systemd_unitdir}/system/sysinit.target.wants/systemd-ask-password-wall.path \
518 ${systemd_unitdir}/system/multi-user.target.wants/systemd-ask-password-wall.path \
519 ${rootlibexecdir}/systemd/systemd-resolve-host \
520 ${rootlibexecdir}/systemd/systemd-ac-power \
521 ${rootlibexecdir}/systemd/systemd-activate \
522 ${rootlibexecdir}/systemd/systemd-bus-proxyd \
523 ${systemd_unitdir}/system/systemd-bus-proxyd.service \
524 ${systemd_unitdir}/system/systemd-bus-proxyd.socket \
525 ${rootlibexecdir}/systemd/systemd-socket-proxyd \
526 ${rootlibexecdir}/systemd/systemd-reply-password \
527 ${rootlibexecdir}/systemd/systemd-sleep \
528 ${rootlibexecdir}/systemd/system-sleep \
529 ${systemd_unitdir}/system/systemd-hibernate.service \
530 ${systemd_unitdir}/system/systemd-hybrid-sleep.service \
531 ${systemd_unitdir}/system/systemd-suspend.service \
532 ${systemd_unitdir}/system/sleep.target \
533 ${rootlibexecdir}/systemd/systemd-initctl \
534 ${systemd_unitdir}/system/systemd-initctl.service \
535 ${systemd_unitdir}/system/systemd-initctl.socket \
536 ${systemd_unitdir}/system/sockets.target.wants/systemd-initctl.socket \
537 ${rootlibexecdir}/systemd/system-generators/systemd-gpt-auto-generator \
538 ${rootlibexecdir}/systemd/systemd-cgroups-agent \
539"
540
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500541FILES_${PN}-udev-rules = "\
542 ${rootlibexecdir}/udev/rules.d/70-uaccess.rules \
543 ${rootlibexecdir}/udev/rules.d/71-seat.rules \
544 ${rootlibexecdir}/udev/rules.d/73-seat-late.rules \
545 ${rootlibexecdir}/udev/rules.d/99-systemd.rules \
546"
547
Andrew Geissler82c905d2020-04-13 13:39:40 -0500548CONFFILES_${PN} = "${sysconfdir}/systemd/coredump.conf \
549 ${sysconfdir}/systemd/journald.conf \
550 ${sysconfdir}/systemd/logind.conf \
551 ${sysconfdir}/systemd/networkd.conf \
552 ${sysconfdir}/systemd/pstore.conf \
553 ${sysconfdir}/systemd/resolved.conf \
554 ${sysconfdir}/systemd/sleep.conf \
555 ${sysconfdir}/systemd/system.conf \
556 ${sysconfdir}/systemd/timesyncd.conf \
557 ${sysconfdir}/systemd/user.conf \
558"
559
560FILES_${PN} = " ${base_bindir}/* \
561 ${base_sbindir}/shutdown \
562 ${base_sbindir}/halt \
563 ${base_sbindir}/poweroff \
564 ${base_sbindir}/runlevel \
565 ${base_sbindir}/telinit \
566 ${base_sbindir}/resolvconf \
567 ${base_sbindir}/reboot \
568 ${base_sbindir}/init \
569 ${datadir}/dbus-1/services \
570 ${datadir}/dbus-1/system-services \
571 ${datadir}/polkit-1 \
572 ${datadir}/${BPN} \
573 ${datadir}/factory \
574 ${sysconfdir}/dbus-1/ \
575 ${sysconfdir}/modules-load.d/ \
576 ${sysconfdir}/pam.d/ \
Andrew Geissler6ce62a22020-11-30 19:58:47 -0600577 ${sysconfdir}/profile.d/ \
Andrew Geissler82c905d2020-04-13 13:39:40 -0500578 ${sysconfdir}/sysctl.d/ \
579 ${sysconfdir}/systemd/ \
580 ${sysconfdir}/tmpfiles.d/ \
581 ${sysconfdir}/xdg/ \
582 ${sysconfdir}/init.d/README \
583 ${sysconfdir}/resolv-conf.systemd \
584 ${sysconfdir}/X11/xinit/xinitrc.d/* \
585 ${rootlibexecdir}/systemd/* \
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600586 ${libdir}/pam.d \
587 ${nonarch_libdir}/pam.d \
Andrew Geissler82c905d2020-04-13 13:39:40 -0500588 ${systemd_unitdir}/* \
589 ${base_libdir}/security/*.so \
590 /cgroup \
591 ${bindir}/systemd* \
592 ${bindir}/busctl \
593 ${bindir}/coredumpctl \
594 ${bindir}/localectl \
595 ${bindir}/hostnamectl \
596 ${bindir}/resolvectl \
597 ${bindir}/timedatectl \
598 ${bindir}/bootctl \
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600599 ${bindir}/oomctl \
Andrew Geissler82c905d2020-04-13 13:39:40 -0500600 ${exec_prefix}/lib/tmpfiles.d/*.conf \
601 ${exec_prefix}/lib/systemd \
602 ${exec_prefix}/lib/modules-load.d \
603 ${exec_prefix}/lib/sysctl.d \
604 ${exec_prefix}/lib/sysusers.d \
605 ${exec_prefix}/lib/environment.d \
606 ${localstatedir} \
Andrew Geissler82c905d2020-04-13 13:39:40 -0500607 ${rootlibexecdir}/modprobe.d/systemd.conf \
608 ${datadir}/dbus-1/system.d/org.freedesktop.timedate1.conf \
609 ${datadir}/dbus-1/system.d/org.freedesktop.locale1.conf \
610 ${datadir}/dbus-1/system.d/org.freedesktop.network1.conf \
611 ${datadir}/dbus-1/system.d/org.freedesktop.resolve1.conf \
612 ${datadir}/dbus-1/system.d/org.freedesktop.systemd1.conf \
Andrew Geissler9b4d8b02021-02-19 12:26:16 -0600613 ${@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 -0500614 ${datadir}/dbus-1/system.d/org.freedesktop.hostname1.conf \
615 ${datadir}/dbus-1/system.d/org.freedesktop.login1.conf \
616 ${datadir}/dbus-1/system.d/org.freedesktop.timesync1.conf \
617 ${datadir}/dbus-1/system.d/org.freedesktop.portable1.conf \
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600618 ${datadir}/dbus-1/system.d/org.freedesktop.oom1.conf \
Andrew Geissler82c905d2020-04-13 13:39:40 -0500619 "
620
621FILES_${PN}-dev += "${base_libdir}/security/*.la ${datadir}/dbus-1/interfaces/ ${sysconfdir}/rpm/macros.systemd"
622
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500623RDEPENDS_${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 -0500624RDEPENDS_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'serial-getty-generator', '', 'systemd-serialgetty', d)}"
625RDEPENDS_${PN} += "volatile-binds"
626
627RRECOMMENDS_${PN} += "systemd-extra-utils \
628 udev-hwdb \
629 e2fsprogs-e2fsck \
630 kernel-module-autofs4 kernel-module-unix kernel-module-ipv6 kernel-module-sch-fq-codel \
631 os-release \
632 systemd-conf \
633"
634
635INSANE_SKIP_${PN} += "dev-so libdir"
636INSANE_SKIP_${PN}-dbg += "libdir"
637INSANE_SKIP_${PN}-doc += " libdir"
638
639RPROVIDES_udev = "hotplug"
640
641RDEPENDS_udev-hwdb += "udev"
642
643FILES_udev += "${base_sbindir}/udevd \
644 ${rootlibexecdir}/systemd/network/99-default.link \
645 ${rootlibexecdir}/systemd/systemd-udevd \
646 ${rootlibexecdir}/udev/accelerometer \
647 ${rootlibexecdir}/udev/ata_id \
648 ${rootlibexecdir}/udev/cdrom_id \
649 ${rootlibexecdir}/udev/collect \
650 ${rootlibexecdir}/udev/fido_id \
651 ${rootlibexecdir}/udev/findkeyboards \
652 ${rootlibexecdir}/udev/keyboard-force-release.sh \
653 ${rootlibexecdir}/udev/keymap \
654 ${rootlibexecdir}/udev/mtd_probe \
655 ${rootlibexecdir}/udev/scsi_id \
656 ${rootlibexecdir}/udev/v4l_id \
657 ${rootlibexecdir}/udev/keymaps \
658 ${rootlibexecdir}/udev/rules.d/50-udev-default.rules \
Andrew Geissler635e0e42020-08-21 15:58:33 -0500659 ${rootlibexecdir}/udev/rules.d/60-autosuspend.rules \
Andrew Geissler82c905d2020-04-13 13:39:40 -0500660 ${rootlibexecdir}/udev/rules.d/60-autosuspend-chromiumos.rules \
661 ${rootlibexecdir}/udev/rules.d/60-block.rules \
662 ${rootlibexecdir}/udev/rules.d/60-cdrom_id.rules \
663 ${rootlibexecdir}/udev/rules.d/60-drm.rules \
664 ${rootlibexecdir}/udev/rules.d/60-evdev.rules \
665 ${rootlibexecdir}/udev/rules.d/60-fido-id.rules \
666 ${rootlibexecdir}/udev/rules.d/60-input-id.rules \
667 ${rootlibexecdir}/udev/rules.d/60-persistent-alsa.rules \
668 ${rootlibexecdir}/udev/rules.d/60-persistent-input.rules \
669 ${rootlibexecdir}/udev/rules.d/60-persistent-storage.rules \
670 ${rootlibexecdir}/udev/rules.d/60-persistent-storage-tape.rules \
671 ${rootlibexecdir}/udev/rules.d/60-persistent-v4l.rules \
672 ${rootlibexecdir}/udev/rules.d/60-sensor.rules \
673 ${rootlibexecdir}/udev/rules.d/60-serial.rules \
674 ${rootlibexecdir}/udev/rules.d/61-autosuspend-manual.rules \
675 ${rootlibexecdir}/udev/rules.d/64-btrfs.rules \
676 ${rootlibexecdir}/udev/rules.d/70-joystick.rules \
677 ${rootlibexecdir}/udev/rules.d/70-mouse.rules \
678 ${rootlibexecdir}/udev/rules.d/70-power-switch.rules \
679 ${rootlibexecdir}/udev/rules.d/70-touchpad.rules \
680 ${rootlibexecdir}/udev/rules.d/75-net-description.rules \
681 ${rootlibexecdir}/udev/rules.d/75-probe_mtd.rules \
682 ${rootlibexecdir}/udev/rules.d/78-sound-card.rules \
683 ${rootlibexecdir}/udev/rules.d/80-drivers.rules \
684 ${rootlibexecdir}/udev/rules.d/80-net-setup-link.rules \
685 ${rootlibexecdir}/udev/rules.d/90-vconsole.rules \
686 ${sysconfdir}/udev \
687 ${sysconfdir}/init.d/systemd-udevd \
688 ${systemd_unitdir}/system/*udev* \
689 ${systemd_unitdir}/system/*.wants/*udev* \
690 ${base_bindir}/systemd-hwdb \
691 ${base_bindir}/udevadm \
692 ${base_sbindir}/udevadm \
693 ${libexecdir}/${MLPREFIX}udevadm \
694 ${datadir}/bash-completion/completions/udevadm \
695 ${systemd_unitdir}/system/systemd-hwdb-update.service \
696 "
697
698FILES_udev-hwdb = "${rootlibexecdir}/udev/hwdb.d \
699 "
700
701RCONFLICTS_${PN} = "tiny-init ${@bb.utils.contains('PACKAGECONFIG', 'resolved', 'resolvconf', '', d)}"
702
703INITSCRIPT_PACKAGES = "udev"
704INITSCRIPT_NAME_udev = "systemd-udevd"
705INITSCRIPT_PARAMS_udev = "start 03 S ."
706
707python __anonymous() {
708 if not bb.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d):
709 d.setVar("INHIBIT_UPDATERCD_BBCLASS", "1")
710}
711
712python do_warn_musl() {
713 if d.getVar('TCLIBC') == "musl":
714 bb.warn("Using systemd with musl is not recommended since it is not supported upstream and some patches are known to be problematic.")
715}
716addtask warn_musl before do_configure
717
718ALTERNATIVE_${PN} = "halt reboot shutdown poweroff runlevel ${@bb.utils.contains('PACKAGECONFIG', 'resolved', 'resolv-conf', '', d)}"
719
720ALTERNATIVE_TARGET[resolv-conf] = "${sysconfdir}/resolv-conf.systemd"
721ALTERNATIVE_LINK_NAME[resolv-conf] = "${sysconfdir}/resolv.conf"
722ALTERNATIVE_PRIORITY[resolv-conf] ?= "50"
723
724ALTERNATIVE_TARGET[halt] = "${base_bindir}/systemctl"
725ALTERNATIVE_LINK_NAME[halt] = "${base_sbindir}/halt"
726ALTERNATIVE_PRIORITY[halt] ?= "300"
727
728ALTERNATIVE_TARGET[reboot] = "${base_bindir}/systemctl"
729ALTERNATIVE_LINK_NAME[reboot] = "${base_sbindir}/reboot"
730ALTERNATIVE_PRIORITY[reboot] ?= "300"
731
732ALTERNATIVE_TARGET[shutdown] = "${base_bindir}/systemctl"
733ALTERNATIVE_LINK_NAME[shutdown] = "${base_sbindir}/shutdown"
734ALTERNATIVE_PRIORITY[shutdown] ?= "300"
735
736ALTERNATIVE_TARGET[poweroff] = "${base_bindir}/systemctl"
737ALTERNATIVE_LINK_NAME[poweroff] = "${base_sbindir}/poweroff"
738ALTERNATIVE_PRIORITY[poweroff] ?= "300"
739
740ALTERNATIVE_TARGET[runlevel] = "${base_bindir}/systemctl"
741ALTERNATIVE_LINK_NAME[runlevel] = "${base_sbindir}/runlevel"
742ALTERNATIVE_PRIORITY[runlevel] ?= "300"
743
744pkg_postinst_${PN}_libc-glibc () {
745 sed -e '/^hosts:/s/\s*\<myhostname\>//' \
746 -e 's/\(^hosts:.*\)\(\<files\>\)\(.*\)\(\<dns\>\)\(.*\)/\1\2 myhostname \3\4\5/' \
747 -i $D${sysconfdir}/nsswitch.conf
748}
749
750pkg_prerm_${PN}_libc-glibc () {
751 sed -e '/^hosts:/s/\s*\<myhostname\>//' \
752 -e '/^hosts:/s/\s*myhostname//' \
753 -i $D${sysconfdir}/nsswitch.conf
754}
755
756PACKAGE_WRITE_DEPS += "qemu-native"
757pkg_postinst_udev-hwdb () {
758 if test -n "$D"; then
759 $INTERCEPT_DIR/postinst_intercept update_udev_hwdb ${PKG} mlprefix=${MLPREFIX} binprefix=${MLPREFIX} rootlibexecdir="${rootlibexecdir}" PREFERRED_PROVIDER_udev="${PREFERRED_PROVIDER_udev}"
760 else
761 udevadm hwdb --update
762 fi
763}
764
765pkg_prerm_udev-hwdb () {
766 rm -f $D${sysconfdir}/udev/hwdb.bin
767}