blob: 05cfc734bffa911d003f851756147fbddcd438d0 [file] [log] [blame]
Andrew Geissler517393d2023-01-13 08:55:19 -06001require systemd.inc
2
3PROVIDES = "udev"
4
5PE = "1"
6
7DEPENDS = "intltool-native gperf-native libcap util-linux python3-jinja2-native"
8
9SECTION = "base/shell"
10
11inherit useradd pkgconfig meson perlnative update-rc.d update-alternatives qemu systemd gettext bash-completion manpages features_check
12
Patrick Williams2a254922023-08-11 09:48:11 -050013# unmerged-usr support is deprecated upstream, taints the system and will be
14# removed in the near future. Fail the build if it is not enabled.
15REQUIRED_DISTRO_FEATURES += "usrmerge"
16
Andrew Geissler517393d2023-01-13 08:55:19 -060017# As this recipe builds udev, respect systemd being in DISTRO_FEATURES so
18# that we don't build both udev and systemd in world builds.
Patrick Williams2a254922023-08-11 09:48:11 -050019REQUIRED_DISTRO_FEATURES += "systemd"
Andrew Geissler517393d2023-01-13 08:55:19 -060020
21SRC_URI += " \
22 file://touchscreen.rules \
23 file://00-create-volatile.conf \
Patrick Williams520786c2023-06-25 16:20:36 -050024 file://basic.conf.in \
Andrew Geissler517393d2023-01-13 08:55:19 -060025 ${@bb.utils.contains('PACKAGECONFIG', 'polkit_hostnamed_fallback', 'file://org.freedesktop.hostname1_no_polkit.conf', '', d)} \
26 ${@bb.utils.contains('PACKAGECONFIG', 'polkit_hostnamed_fallback', 'file://00-hostnamed-network-user.conf', '', d)} \
27 file://init \
28 file://99-default.preset \
29 file://systemd-pager.sh \
Andrew Geisslerfc113ea2023-03-31 09:59:46 -050030 file://0002-binfmt-Don-t-install-dependency-links-at-install-tim.patch \
31 file://0008-implment-systemd-sysv-install-for-OE.patch \
32 file://0004-Move-sysusers.d-sysctl.d-binfmt.d-modules-load.d-to-.patch \
Andrew Geissler517393d2023-01-13 08:55:19 -060033 "
34
35# patches needed by musl
36SRC_URI:append:libc-musl = " ${SRC_URI_MUSL}"
37SRC_URI_MUSL = "\
Andrew Geisslerfc113ea2023-03-31 09:59:46 -050038 file://0009-missing_type.h-add-comparison_fn_t.patch \
39 file://0010-add-fallback-parse_printf_format-implementation.patch \
40 file://0011-src-basic-missing.h-check-for-missing-strndupa.patch \
41 file://0012-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch \
42 file://0013-add-missing-FTW_-macros-for-musl.patch \
43 file://0014-Use-uintmax_t-for-handling-rlim_t.patch \
Andrew Geisslerfc113ea2023-03-31 09:59:46 -050044 file://0016-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch \
45 file://0017-Define-glibc-compatible-basename-for-non-glibc-syste.patch \
46 file://0018-Do-not-disable-buffering-when-writing-to-oom_score_a.patch \
47 file://0019-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch \
48 file://0020-avoid-redefinition-of-prctl_mm_map-structure.patch \
49 file://0021-do-not-disable-buffer-in-writing-files.patch \
50 file://0022-Handle-__cpu_mask-usage.patch \
51 file://0023-Handle-missing-gshadow.patch \
52 file://0024-missing_syscall.h-Define-MIPS-ABI-defines-for-musl.patch \
53 file://0005-pass-correct-parameters-to-getdents64.patch \
Andrew Geissler517393d2023-01-13 08:55:19 -060054 file://0001-Adjust-for-musl-headers.patch \
Andrew Geisslerfc113ea2023-03-31 09:59:46 -050055 file://0006-test-bus-error-strerror-is-assumed-to-be-GNU-specifi.patch \
56 file://0003-errno-util-Make-STRERROR-portable-for-musl.patch \
Patrick Williams2a254922023-08-11 09:48:11 -050057 file://0028-sd-event-Make-malloc_trim-conditional-on-glibc.patch \
58 file://0029-shared-Do-not-use-malloc_info-on-musl.patch \
Andrew Geissler517393d2023-01-13 08:55:19 -060059 "
60
61PAM_PLUGINS = " \
62 pam-plugin-unix \
63 pam-plugin-loginuid \
64 pam-plugin-keyinit \
Andrew Geisslerfc113ea2023-03-31 09:59:46 -050065 pam-plugin-namespace \
Andrew Geissler517393d2023-01-13 08:55:19 -060066"
67
68PACKAGECONFIG ??= " \
69 ${@bb.utils.filter('DISTRO_FEATURES', 'acl audit efi ldconfig pam selinux smack usrmerge polkit seccomp', d)} \
Patrick Williams169d7bc2024-01-05 11:33:25 -060070 ${@bb.utils.contains('DISTRO_FEATURES', 'minidebuginfo', 'coredump elfutils', '', d)} \
Andrew Geissler517393d2023-01-13 08:55:19 -060071 ${@bb.utils.contains('DISTRO_FEATURES', 'wifi', 'rfkill', '', d)} \
72 ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'xkbcommon', '', d)} \
73 ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', '', 'link-udev-shared', d)} \
74 backlight \
75 binfmt \
76 gshadow \
77 hibernate \
78 hostnamed \
79 idn \
80 ima \
81 kmod \
82 localed \
83 logind \
84 machined \
85 myhostname \
86 networkd \
87 nss \
88 nss-mymachines \
89 nss-resolve \
90 quotacheck \
91 randomseed \
92 resolved \
93 set-time-epoch \
94 sysusers \
95 sysvinit \
96 timedated \
97 timesyncd \
98 userdb \
99 utmp \
100 vconsole \
101 wheel-group \
102 zstd \
103"
104
105PACKAGECONFIG:remove:libc-musl = " \
106 gshadow \
107 idn \
108 localed \
109 myhostname \
110 nss \
111 nss-mymachines \
112 nss-resolve \
113 sysusers \
114 userdb \
115 utmp \
116"
117
118# https://github.com/seccomp/libseccomp/issues/347
119PACKAGECONFIG:remove:mipsarch = "seccomp"
120
121TARGET_CC_ARCH:append:libc-musl = " -D__UAPI_DEF_ETHHDR=0 -D_LARGEFILE64_SOURCE"
122
123# Some of the dependencies are weak-style recommends - if not available at runtime,
124# systemd won't fail but the library-related feature will be skipped with a warning.
125
126# Use the upstream systemd serial-getty@.service and rely on
127# systemd-getty-generator instead of using the OE-core specific
128# systemd-serialgetty.bb - not enabled by default.
129PACKAGECONFIG[serial-getty-generator] = ""
130
131PACKAGECONFIG[acl] = "-Dacl=true,-Dacl=false,acl"
132PACKAGECONFIG[audit] = "-Daudit=true,-Daudit=false,audit"
133PACKAGECONFIG[backlight] = "-Dbacklight=true,-Dbacklight=false"
134PACKAGECONFIG[binfmt] = "-Dbinfmt=true,-Dbinfmt=false"
135PACKAGECONFIG[bzip2] = "-Dbzip2=true,-Dbzip2=false,bzip2"
136PACKAGECONFIG[cgroupv2] = "-Ddefault-hierarchy=unified,-Ddefault-hierarchy=hybrid"
137PACKAGECONFIG[coredump] = "-Dcoredump=true,-Dcoredump=false"
138PACKAGECONFIG[cryptsetup] = "-Dlibcryptsetup=true,-Dlibcryptsetup=false,cryptsetup,,cryptsetup"
Patrick Williamsac13d5f2023-11-24 18:59:46 -0600139PACKAGECONFIG[cryptsetup-plugins] = "-Dlibcryptsetup-plugins=true,-Dlibcryptsetup-plugins=false,cryptsetup,,cryptsetup"
Andrew Geissler517393d2023-01-13 08:55:19 -0600140PACKAGECONFIG[tpm2] = "-Dtpm2=true,-Dtpm2=false,tpm2-tss,tpm2-tss libtss2 libtss2-tcti-device"
Andrew Geisslerc5535c92023-01-27 16:10:19 -0600141# If multiple compression libraries are enabled, the format to use for compression is chosen implicitly,
142# so if you want to compress with e.g. lz4 you cannot enable zstd, so you cannot read zstd-compressed journal files.
143# This option allows to enable all compression formats for reading, but choosing a specific one for writing.
144PACKAGECONFIG[default-compression-lz4] = "-Dlz4=true -Ddefault-compression=lz4,,lz4"
145PACKAGECONFIG[default-compression-xz] = "-Dxz=true -Ddefault-compression=xz,,xz"
146PACKAGECONFIG[default-compression-zstd] = "-Dzstd=true -Ddefault-compression=zstd,,zstd"
Andrew Geissler517393d2023-01-13 08:55:19 -0600147PACKAGECONFIG[dbus] = "-Ddbus=true,-Ddbus=false,dbus"
Andrew Geissler5082cc72023-09-11 08:41:39 -0400148PACKAGECONFIG[efi] = "-Defi=true -Dbootloader=true,-Defi=false -Dbootloader=false,python3-pyelftools-native"
Andrew Geissler517393d2023-01-13 08:55:19 -0600149PACKAGECONFIG[elfutils] = "-Delfutils=true,-Delfutils=false,elfutils"
150PACKAGECONFIG[firstboot] = "-Dfirstboot=true,-Dfirstboot=false"
151PACKAGECONFIG[repart] = "-Drepart=true,-Drepart=false"
152PACKAGECONFIG[homed] = "-Dhomed=true,-Dhomed=false"
153# Sign the journal for anti-tampering
154PACKAGECONFIG[gcrypt] = "-Dgcrypt=true,-Dgcrypt=false,libgcrypt"
155PACKAGECONFIG[gnutls] = "-Dgnutls=true,-Dgnutls=false,gnutls"
156PACKAGECONFIG[gshadow] = "-Dgshadow=true,-Dgshadow=false"
157PACKAGECONFIG[hibernate] = "-Dhibernate=true,-Dhibernate=false"
158PACKAGECONFIG[hostnamed] = "-Dhostnamed=true,-Dhostnamed=false"
159PACKAGECONFIG[idn] = "-Didn=true,-Didn=false"
160PACKAGECONFIG[ima] = "-Dima=true,-Dima=false"
161# importd requires journal-upload/xz/zlib/bzip2/gcrypt
162PACKAGECONFIG[importd] = "-Dimportd=true,-Dimportd=false,glib-2.0"
163# Update NAT firewall rules
164PACKAGECONFIG[iptc] = "-Dlibiptc=true,-Dlibiptc=false,iptables"
Patrick Williams2a254922023-08-11 09:48:11 -0500165PACKAGECONFIG[journal-color] = ",,,less"
Andrew Geissler517393d2023-01-13 08:55:19 -0600166PACKAGECONFIG[journal-upload] = "-Dlibcurl=true,-Dlibcurl=false,curl"
167PACKAGECONFIG[kmod] = "-Dkmod=true,-Dkmod=false,kmod"
168PACKAGECONFIG[ldconfig] = "-Dldconfig=true,-Dldconfig=false,,ldconfig"
169PACKAGECONFIG[libidn] = "-Dlibidn=true,-Dlibidn=false,libidn,,libidn"
170PACKAGECONFIG[libidn2] = "-Dlibidn2=true,-Dlibidn2=false,libidn2,,libidn2"
171# Link udev shared with systemd helper library.
172# If enabled the udev package depends on the systemd package (which has the needed shared library).
173PACKAGECONFIG[link-udev-shared] = "-Dlink-udev-shared=true,-Dlink-udev-shared=false"
174PACKAGECONFIG[localed] = "-Dlocaled=true,-Dlocaled=false"
175PACKAGECONFIG[logind] = "-Dlogind=true,-Dlogind=false"
176PACKAGECONFIG[lz4] = "-Dlz4=true,-Dlz4=false,lz4"
177PACKAGECONFIG[machined] = "-Dmachined=true,-Dmachined=false"
178PACKAGECONFIG[manpages] = "-Dman=true,-Dman=false,libxslt-native xmlto-native docbook-xml-dtd4-native docbook-xsl-stylesheets-native"
179PACKAGECONFIG[microhttpd] = "-Dmicrohttpd=true,-Dmicrohttpd=false,libmicrohttpd"
180PACKAGECONFIG[myhostname] = "-Dnss-myhostname=true,-Dnss-myhostname=false,,libnss-myhostname"
181PACKAGECONFIG[networkd] = "-Dnetworkd=true,-Dnetworkd=false"
182PACKAGECONFIG[no-dns-fallback] = "-Ddns-servers="
Patrick Williamsac13d5f2023-11-24 18:59:46 -0600183PACKAGECONFIG[no-ntp-fallback] = "-Dntp-servers="
184PACKAGECONFIG[nss] = "-Dnss-systemd=true,-Dnss-systemd=false,,libnss-systemd"
Andrew Geissler517393d2023-01-13 08:55:19 -0600185PACKAGECONFIG[nss-mymachines] = "-Dnss-mymachines=true,-Dnss-mymachines=false"
186PACKAGECONFIG[nss-resolve] = "-Dnss-resolve=true,-Dnss-resolve=false"
187PACKAGECONFIG[oomd] = "-Doomd=true,-Doomd=false"
188PACKAGECONFIG[openssl] = "-Dopenssl=true,-Dopenssl=false,openssl"
Patrick Williamsac13d5f2023-11-24 18:59:46 -0600189PACKAGECONFIG[p11kit] = "-Dp11kit=true,-Dp11kit=false,p11-kit"
Andrew Geissler517393d2023-01-13 08:55:19 -0600190PACKAGECONFIG[pam] = "-Dpam=true,-Dpam=false,libpam,${PAM_PLUGINS}"
191PACKAGECONFIG[pcre2] = "-Dpcre2=true,-Dpcre2=false,libpcre2"
192PACKAGECONFIG[polkit] = "-Dpolkit=true,-Dpolkit=false"
193# If polkit is disabled and networkd+hostnamed are in use, enabling this option and
194# using dbus-broker will allow networkd to be authorized to change the
195# hostname without acquiring additional privileges
196PACKAGECONFIG[polkit_hostnamed_fallback] = ",,,,dbus-broker,polkit"
197PACKAGECONFIG[portabled] = "-Dportabled=true,-Dportabled=false"
Patrick Williams864cc432023-02-09 14:54:44 -0600198PACKAGECONFIG[pstore] = "-Dpstore=true,-Dpstore=false"
Andrew Geissler517393d2023-01-13 08:55:19 -0600199PACKAGECONFIG[qrencode] = "-Dqrencode=true,-Dqrencode=false,qrencode,,qrencode"
200PACKAGECONFIG[quotacheck] = "-Dquotacheck=true,-Dquotacheck=false"
201PACKAGECONFIG[randomseed] = "-Drandomseed=true,-Drandomseed=false"
202PACKAGECONFIG[resolved] = "-Dresolve=true,-Dresolve=false"
203PACKAGECONFIG[rfkill] = "-Drfkill=true,-Drfkill=false"
204PACKAGECONFIG[seccomp] = "-Dseccomp=true,-Dseccomp=false,libseccomp"
205PACKAGECONFIG[selinux] = "-Dselinux=true,-Dselinux=false,libselinux,initscripts-sushell"
206PACKAGECONFIG[smack] = "-Dsmack=true,-Dsmack=false"
207PACKAGECONFIG[sysext] = "-Dsysext=true, -Dsysext=false"
208PACKAGECONFIG[sysusers] = "-Dsysusers=true,-Dsysusers=false"
209PACKAGECONFIG[sysvinit] = "-Dsysvinit-path=${sysconfdir}/init.d -Dsysvrcnd-path=${sysconfdir},-Dsysvinit-path= -Dsysvrcnd-path=,,systemd-compat-units update-rc.d"
Patrick Williamsda295312023-12-05 16:48:56 -0600210# When enabled use reproducible build timestamp if set as time epoch,
Andrew Geissler517393d2023-01-13 08:55:19 -0600211# or build time if not. When disabled, time epoch is unset.
212def build_epoch(d):
213 epoch = d.getVar('SOURCE_DATE_EPOCH') or "-1"
214 return '-Dtime-epoch=%d' % int(epoch)
215PACKAGECONFIG[set-time-epoch] = "${@build_epoch(d)},-Dtime-epoch=0"
216PACKAGECONFIG[timedated] = "-Dtimedated=true,-Dtimedated=false"
217PACKAGECONFIG[timesyncd] = "-Dtimesyncd=true,-Dtimesyncd=false"
218PACKAGECONFIG[usrmerge] = "-Dsplit-usr=false,-Dsplit-usr=true"
219PACKAGECONFIG[sbinmerge] = "-Dsplit-bin=false,-Dsplit-bin=true"
220PACKAGECONFIG[userdb] = "-Duserdb=true,-Duserdb=false"
221PACKAGECONFIG[utmp] = "-Dutmp=true,-Dutmp=false"
222PACKAGECONFIG[valgrind] = "-DVALGRIND=1,,valgrind"
223PACKAGECONFIG[vconsole] = "-Dvconsole=true,-Dvconsole=false,,${PN}-vconsole-setup"
224PACKAGECONFIG[wheel-group] = "-Dwheel-group=true, -Dwheel-group=false"
225PACKAGECONFIG[xdg-autostart] = "-Dxdg-autostart=true,-Dxdg-autostart=false"
226# Verify keymaps on locale change
227PACKAGECONFIG[xkbcommon] = "-Dxkbcommon=true,-Dxkbcommon=false,libxkbcommon"
228PACKAGECONFIG[xz] = "-Dxz=true,-Dxz=false,xz"
229PACKAGECONFIG[zlib] = "-Dzlib=true,-Dzlib=false,zlib"
230PACKAGECONFIG[zstd] = "-Dzstd=true,-Dzstd=false,zstd"
231
Patrick Williamsac13d5f2023-11-24 18:59:46 -0600232RESOLV_CONF ??= ""
233
Andrew Geissler517393d2023-01-13 08:55:19 -0600234# Helper variables to clarify locations. This mirrors the logic in systemd's
235# build system.
236rootprefix ?= "${root_prefix}"
237rootlibdir ?= "${base_libdir}"
238rootlibexecdir = "${rootprefix}/lib"
239
240EXTRA_OEMESON += "-Dnobody-user=nobody \
Andrew Geisslerfc113ea2023-03-31 09:59:46 -0500241 -Dnobody-group=nogroup \
Andrew Geissler517393d2023-01-13 08:55:19 -0600242 -Drootlibdir=${rootlibdir} \
243 -Drootprefix=${rootprefix} \
244 -Ddefault-locale=C \
245 -Dmode=release \
246 -Dsystem-alloc-uid-min=101 \
247 -Dsystem-uid-max=999 \
248 -Dsystem-alloc-gid-min=101 \
249 -Dsystem-gid-max=999 \
250 "
251
Patrick Williams2a254922023-08-11 09:48:11 -0500252# Hardcode target binary paths to avoid using paths from sysroot or worse
253# it pokes for these binaries on build host and encodes that distro assumption
254# into target
Andrew Geissler517393d2023-01-13 08:55:19 -0600255EXTRA_OEMESON += "-Dkexec-path=${sbindir}/kexec \
256 -Dkmod-path=${base_bindir}/kmod \
257 -Dmount-path=${base_bindir}/mount \
258 -Dquotacheck-path=${sbindir}/quotacheck \
259 -Dquotaon-path=${sbindir}/quotaon \
260 -Dsulogin-path=${base_sbindir}/sulogin \
261 -Dnologin-path=${base_sbindir}/nologin \
Patrick Williams2a254922023-08-11 09:48:11 -0500262 -Dumount-path=${base_bindir}/umount \
263 -Dloadkeys-path=${bindir}/loadkeys \
264 -Dsetfont-path=${bindir}/setfont"
Andrew Geissler517393d2023-01-13 08:55:19 -0600265
266# The 60 seconds is watchdog's default vaule.
267WATCHDOG_TIMEOUT ??= "60"
268
Patrick Williams520786c2023-06-25 16:20:36 -0500269do_configure:prepend() {
270 sed s@:ROOT_HOME:@${ROOT_HOME}@g ${WORKDIR}/basic.conf.in > ${S}/sysusers.d/basic.conf.in
271}
272
Andrew Geissler517393d2023-01-13 08:55:19 -0600273do_install() {
274 meson_do_install
275 install -d ${D}/${base_sbindir}
276 if ${@bb.utils.contains('PACKAGECONFIG', 'serial-getty-generator', 'false', 'true', d)}; then
277 # Provided by a separate recipe
278 rm ${D}${systemd_system_unitdir}/serial-getty* -f
279 fi
280
281 # Provide support for initramfs
282 [ ! -e ${D}/init ] && ln -s ${rootlibexecdir}/systemd/systemd ${D}/init
283 [ ! -e ${D}/${base_sbindir}/udevd ] && ln -s ${rootlibexecdir}/systemd/systemd-udevd ${D}/${base_sbindir}/udevd
284
285 install -d ${D}${sysconfdir}/udev/rules.d/
Patrick Williamsac13d5f2023-11-24 18:59:46 -0600286 install -d ${D}${nonarch_libdir}/tmpfiles.d
Andrew Geissler517393d2023-01-13 08:55:19 -0600287 for rule in $(find ${WORKDIR} -maxdepth 1 -type f -name "*.rules"); do
288 install -m 0644 $rule ${D}${sysconfdir}/udev/rules.d/
289 done
290
Patrick Williamsac13d5f2023-11-24 18:59:46 -0600291 install -m 0644 ${WORKDIR}/00-create-volatile.conf ${D}${nonarch_libdir}/tmpfiles.d/
Andrew Geissler517393d2023-01-13 08:55:19 -0600292
293 if ${@bb.utils.contains('DISTRO_FEATURES','sysvinit','true','false',d)}; then
294 install -d ${D}${sysconfdir}/init.d
295 install -m 0755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/systemd-udevd
296 sed -i s%@UDEVD@%${rootlibexecdir}/systemd/systemd-udevd% ${D}${sysconfdir}/init.d/systemd-udevd
297 install -Dm 0755 ${S}/src/systemctl/systemd-sysv-install.SKELETON ${D}${systemd_unitdir}/systemd-sysv-install
298 fi
299
300 if "${@'true' if oe.types.boolean(d.getVar('VOLATILE_LOG_DIR')) else 'false'}"; then
301 # /var/log is typically a symbolic link to inside /var/volatile,
302 # which is expected to be empty.
303 rm -rf ${D}${localstatedir}/log
304 else
305 chown root:systemd-journal ${D}${localstatedir}/log/journal
306
307 # journal-remote creates this at start
308 rm -rf ${D}${localstatedir}/log/journal/remote
309 fi
310
Andrew Geissler6aa7eec2023-03-03 12:41:14 -0600311 # if the user requests /tmp be on persistent storage (i.e. not volatile)
312 # then don't use a tmpfs for /tmp
313 if [ "${VOLATILE_TMP_DIR}" != "yes" ]; then
314 rm -f ${D}${rootlibdir}/systemd/system/tmp.mount
315 rm -f ${D}${rootlibdir}/systemd/system/local-fs.target.wants/tmp.mount
316 fi
317
Andrew Geissler517393d2023-01-13 08:55:19 -0600318 install -d ${D}${systemd_system_unitdir}/graphical.target.wants
319 install -d ${D}${systemd_system_unitdir}/multi-user.target.wants
320 install -d ${D}${systemd_system_unitdir}/poweroff.target.wants
321 install -d ${D}${systemd_system_unitdir}/reboot.target.wants
322 install -d ${D}${systemd_system_unitdir}/rescue.target.wants
323
324 # Create symlinks for systemd-update-utmp-runlevel.service
325 if ${@bb.utils.contains('PACKAGECONFIG', 'utmp', 'true', 'false', d)}; then
326 ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_system_unitdir}/graphical.target.wants/systemd-update-utmp-runlevel.service
327 ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_system_unitdir}/multi-user.target.wants/systemd-update-utmp-runlevel.service
328 ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_system_unitdir}/poweroff.target.wants/systemd-update-utmp-runlevel.service
329 ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_system_unitdir}/reboot.target.wants/systemd-update-utmp-runlevel.service
330 ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_system_unitdir}/rescue.target.wants/systemd-update-utmp-runlevel.service
331 fi
332
333 # this file is needed to exist if networkd is disabled but timesyncd is still in use since timesyncd checks it
334 # for existence else it fails
335 if [ -s ${D}${exec_prefix}/lib/tmpfiles.d/systemd.conf ] &&
336 ! ${@bb.utils.contains('PACKAGECONFIG', 'networkd', 'true', 'false', d)}; then
337 echo 'd /run/systemd/netif/links 0755 root root -' >>${D}${exec_prefix}/lib/tmpfiles.d/systemd.conf
338 fi
339 if ! ${@bb.utils.contains('PACKAGECONFIG', 'resolved', 'true', 'false', d)}; then
340 echo 'L! ${sysconfdir}/resolv.conf - - - - ../run/systemd/resolve/resolv.conf' >>${D}${exec_prefix}/lib/tmpfiles.d/etc.conf
341 echo 'd /run/systemd/resolve 0755 root root -' >>${D}${exec_prefix}/lib/tmpfiles.d/systemd.conf
342 echo 'f /run/systemd/resolve/resolv.conf 0644 root root' >>${D}${exec_prefix}/lib/tmpfiles.d/systemd.conf
343 ln -s ../run/systemd/resolve/resolv.conf ${D}${sysconfdir}/resolv-conf.systemd
344 else
Patrick Williamsac13d5f2023-11-24 18:59:46 -0600345 resolv_conf="${@bb.utils.contains('RESOLV_CONF', 'stub-resolv', 'run/systemd/resolve/stub-resolv.conf', 'run/systemd/resolve/resolv.conf', d)}"
346 sed -i -e "s%^L! /etc/resolv.conf.*$%L! /etc/resolv.conf - - - - ../${resolv_conf}%g" ${D}${exec_prefix}/lib/tmpfiles.d/etc.conf
347 ln -s ../${resolv_conf} ${D}${sysconfdir}/resolv-conf.systemd
Andrew Geissler517393d2023-01-13 08:55:19 -0600348 fi
349 if ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'false', 'true', d)}; then
350 rm ${D}${exec_prefix}/lib/tmpfiles.d/x11.conf
351 rm -r ${D}${sysconfdir}/X11
352 fi
353
354 # If polkit is setup fixup permissions and ownership
355 if ${@bb.utils.contains('PACKAGECONFIG', 'polkit', 'true', 'false', d)}; then
356 if [ -d ${D}${datadir}/polkit-1/rules.d ]; then
357 chmod 700 ${D}${datadir}/polkit-1/rules.d
358 chown polkitd:root ${D}${datadir}/polkit-1/rules.d
359 fi
360 fi
361
362 # If polkit is not available and a fallback was requested, install a drop-in that allows networkd to
363 # request hostname changes via DBUS without elevating its privileges
364 if ${@bb.utils.contains('PACKAGECONFIG', 'polkit_hostnamed_fallback', 'true', 'false', d)}; then
365 install -d ${D}${systemd_system_unitdir}/systemd-hostnamed.service.d/
366 install -m 0644 ${WORKDIR}/00-hostnamed-network-user.conf ${D}${systemd_system_unitdir}/systemd-hostnamed.service.d/
367 install -d ${D}${datadir}/dbus-1/system.d/
368 install -m 0644 ${WORKDIR}/org.freedesktop.hostname1_no_polkit.conf ${D}${datadir}/dbus-1/system.d/
369 fi
370
371 # create link for existing udev rules
372 ln -s ${base_bindir}/udevadm ${D}${base_sbindir}/udevadm
373
374 # install default policy for presets
375 # https://www.freedesktop.org/wiki/Software/systemd/Preset/#howto
376 install -Dm 0644 ${WORKDIR}/99-default.preset ${D}${systemd_unitdir}/system-preset/99-default.preset
377
378 # add a profile fragment to disable systemd pager with busybox less
379 install -Dm 0644 ${WORKDIR}/systemd-pager.sh ${D}${sysconfdir}/profile.d/systemd-pager.sh
380
381 if [ -n "${WATCHDOG_TIMEOUT}" ]; then
382 sed -i -e 's/#RebootWatchdogSec=10min/RebootWatchdogSec=${WATCHDOG_TIMEOUT}/' \
383 ${D}/${sysconfdir}/systemd/system.conf
384 fi
385}
386
387python populate_packages:prepend (){
388 systemdlibdir = d.getVar("rootlibdir")
389 do_split_packages(d, systemdlibdir, r'^lib(.*)\.so\.*', 'lib%s', 'Systemd %s library', extra_depends='', allow_links=True)
390}
391PACKAGES_DYNAMIC += "^lib(udev|systemd|nss).*"
392
393PACKAGE_BEFORE_PN = "\
Andrew Geissler517393d2023-01-13 08:55:19 -0600394 ${PN}-analyze \
Andrew Geissler517393d2023-01-13 08:55:19 -0600395 ${PN}-binfmt \
Andrew Geissler517393d2023-01-13 08:55:19 -0600396 ${PN}-container \
Patrick Williamsac13d5f2023-11-24 18:59:46 -0600397 ${PN}-crypt \
398 ${PN}-extra-utils \
399 ${PN}-gui \
400 ${PN}-initramfs \
Andrew Geissler517393d2023-01-13 08:55:19 -0600401 ${PN}-journal-gatewayd \
402 ${PN}-journal-upload \
403 ${PN}-journal-remote \
Patrick Williamsac13d5f2023-11-24 18:59:46 -0600404 ${PN}-kernel-install \
405 ${PN}-rpm-macros \
Andrew Geissler517393d2023-01-13 08:55:19 -0600406 ${PN}-udev-rules \
Patrick Williamsac13d5f2023-11-24 18:59:46 -0600407 ${PN}-vconsole-setup \
408 ${PN}-zsh-completion \
Andrew Geissler517393d2023-01-13 08:55:19 -0600409 libsystemd-shared \
410 udev \
Patrick Williams705982a2024-01-12 09:51:57 -0600411 udev-bash-completion \
Andrew Geissler517393d2023-01-13 08:55:19 -0600412 udev-hwdb \
413"
414
415SUMMARY:${PN}-container = "Tools for containers and VMs"
416DESCRIPTION:${PN}-container = "Systemd tools to spawn and manage containers and virtual machines."
417
418SUMMARY:${PN}-journal-gatewayd = "HTTP server for journal events"
419DESCRIPTION:${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."
420
421SUMMARY:${PN}-journal-upload = "Send journal messages over the network"
422DESCRIPTION:${PN}-journal-upload = "systemd-journal-upload uploads journal entries to a specified URL."
423
424SUMMARY:${PN}-journal-remote = "Receive journal messages over the network"
425DESCRIPTION:${PN}-journal-remote = "systemd-journal-remote is a command to receive serialized journal events and store them to journal files."
426
427SUMMARY:libsystemd-shared = "Systemd shared library"
428
429SYSTEMD_PACKAGES = "${@bb.utils.contains('PACKAGECONFIG', 'binfmt', '${PN}-binfmt', '', d)} \
430 ${@bb.utils.contains('PACKAGECONFIG', 'microhttpd', '${PN}-journal-gatewayd', '', d)} \
431 ${@bb.utils.contains('PACKAGECONFIG', 'microhttpd', '${PN}-journal-remote', '', d)} \
432 ${@bb.utils.contains('PACKAGECONFIG', 'journal-upload', '${PN}-journal-upload', '', d)} \
433"
434SYSTEMD_SERVICE:${PN}-binfmt = "systemd-binfmt.service"
435
436USERADD_PACKAGES = "${PN} ${PN}-extra-utils \
437 udev \
438 ${@bb.utils.contains('PACKAGECONFIG', 'microhttpd', '${PN}-journal-gatewayd', '', d)} \
439 ${@bb.utils.contains('PACKAGECONFIG', 'microhttpd', '${PN}-journal-remote', '', d)} \
440 ${@bb.utils.contains('PACKAGECONFIG', 'journal-upload', '${PN}-journal-upload', '', d)} \
441"
442GROUPADD_PARAM:${PN} = "-r systemd-journal;"
Patrick Williams2a254922023-08-11 09:48:11 -0500443GROUPADD_PARAM:udev = "-r render"
Andrew Geissler517393d2023-01-13 08:55:19 -0600444GROUPADD_PARAM:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'polkit_hostnamed_fallback', '-r systemd-hostname;', '', d)}"
445USERADD_PARAM:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'coredump', '--system -d / -M --shell /sbin/nologin systemd-coredump;', '', d)}"
446USERADD_PARAM:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'networkd', '--system -d / -M --shell /sbin/nologin systemd-network;', '', d)}"
447USERADD_PARAM:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'polkit', '--system --no-create-home --user-group --home-dir ${sysconfdir}/polkit-1 polkitd;', '', d)}"
448USERADD_PARAM:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'resolved', '--system -d / -M --shell /sbin/nologin systemd-resolve;', '', d)}"
449USERADD_PARAM:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'timesyncd', '--system -d / -M --shell /sbin/nologin systemd-timesync;', '', d)}"
Andrew Geissler6aa7eec2023-03-03 12:41:14 -0600450USERADD_PARAM:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'oomd', '--system -d / -M --shell /sbin/nologin systemd-oom;', '', d)}"
Andrew Geissler517393d2023-01-13 08:55:19 -0600451USERADD_PARAM:${PN}-extra-utils = "--system -d / -M --shell /sbin/nologin systemd-bus-proxy"
452USERADD_PARAM:${PN}-journal-gatewayd = "--system -d / -M --shell /sbin/nologin systemd-journal-gateway"
453USERADD_PARAM:${PN}-journal-remote = "--system -d / -M --shell /sbin/nologin systemd-journal-remote"
454USERADD_PARAM:${PN}-journal-upload = "--system -d / -M --shell /sbin/nologin systemd-journal-upload"
455
456FILES:${PN}-analyze = "${bindir}/systemd-analyze"
457
Patrick Williamsac13d5f2023-11-24 18:59:46 -0600458FILES:${PN}-crypt = "${bindir}/systemd-cryptenroll \
459 ${libdir}/cryptsetup \
460 "
461RRECOMMENDS:${PN} += "${PN}-crypt"
462
Andrew Geissler517393d2023-01-13 08:55:19 -0600463FILES:${PN}-initramfs = "/init"
464RDEPENDS:${PN}-initramfs = "${PN}"
465
466FILES:${PN}-gui = "${bindir}/systemadm"
467
468FILES:${PN}-vconsole-setup = "${rootlibexecdir}/systemd/systemd-vconsole-setup \
469 ${systemd_system_unitdir}/systemd-vconsole-setup.service \
470 ${systemd_system_unitdir}/sysinit.target.wants/systemd-vconsole-setup.service"
471
472RDEPENDS:${PN}-kernel-install += "bash"
473FILES:${PN}-kernel-install = "${bindir}/kernel-install \
474 ${sysconfdir}/kernel/ \
475 ${exec_prefix}/lib/kernel \
476 "
477FILES:${PN}-rpm-macros = "${exec_prefix}/lib/rpm \
478 "
479
480FILES:${PN}-zsh-completion = "${datadir}/zsh/site-functions"
481
482FILES:${PN}-binfmt = "${sysconfdir}/binfmt.d/ \
483 ${exec_prefix}/lib/binfmt.d \
484 ${rootlibexecdir}/systemd/systemd-binfmt \
485 ${systemd_system_unitdir}/proc-sys-fs-binfmt_misc.* \
486 ${systemd_system_unitdir}/systemd-binfmt.service"
487RRECOMMENDS:${PN}-binfmt = "${@bb.utils.contains('PACKAGECONFIG', 'binfmt', 'kernel-module-binfmt-misc', '', d)}"
488
489RRECOMMENDS:${PN}-vconsole-setup = "${@bb.utils.contains('PACKAGECONFIG', 'vconsole', 'kbd kbd-consolefonts kbd-keymaps', '', d)}"
490
491
492FILES:${PN}-journal-gatewayd = "${rootlibexecdir}/systemd/systemd-journal-gatewayd \
493 ${systemd_system_unitdir}/systemd-journal-gatewayd.service \
494 ${systemd_system_unitdir}/systemd-journal-gatewayd.socket \
495 ${systemd_system_unitdir}/sockets.target.wants/systemd-journal-gatewayd.socket \
496 ${datadir}/systemd/gatewayd/browse.html \
497 "
498SYSTEMD_SERVICE:${PN}-journal-gatewayd = "systemd-journal-gatewayd.socket"
499
500FILES:${PN}-journal-upload = "${rootlibexecdir}/systemd/systemd-journal-upload \
501 ${systemd_system_unitdir}/systemd-journal-upload.service \
502 ${sysconfdir}/systemd/journal-upload.conf \
503 "
504SYSTEMD_SERVICE:${PN}-journal-upload = "systemd-journal-upload.service"
505
506FILES:${PN}-journal-remote = "${rootlibexecdir}/systemd/systemd-journal-remote \
507 ${sysconfdir}/systemd/journal-remote.conf \
508 ${systemd_system_unitdir}/systemd-journal-remote.service \
509 ${systemd_system_unitdir}/systemd-journal-remote.socket \
510 "
511SYSTEMD_SERVICE:${PN}-journal-remote = "systemd-journal-remote.socket"
512
513
514FILES:${PN}-container = "${sysconfdir}/dbus-1/system.d/org.freedesktop.import1.conf \
515 ${sysconfdir}/dbus-1/system.d/org.freedesktop.machine1.conf \
516 ${sysconfdir}/systemd/system/multi-user.target.wants/machines.target \
517 ${base_bindir}/machinectl \
518 ${bindir}/systemd-nspawn \
519 ${nonarch_libdir}/systemd/import-pubring.gpg \
520 ${systemd_system_unitdir}/busnames.target.wants/org.freedesktop.import1.busname \
521 ${systemd_system_unitdir}/busnames.target.wants/org.freedesktop.machine1.busname \
522 ${systemd_system_unitdir}/local-fs.target.wants/var-lib-machines.mount \
523 ${systemd_system_unitdir}/machines.target.wants/var-lib-machines.mount \
524 ${systemd_system_unitdir}/remote-fs.target.wants/var-lib-machines.mount \
525 ${systemd_system_unitdir}/machine.slice \
526 ${systemd_system_unitdir}/machines.target \
527 ${systemd_system_unitdir}/org.freedesktop.import1.busname \
528 ${systemd_system_unitdir}/org.freedesktop.machine1.busname \
529 ${systemd_system_unitdir}/systemd-importd.service \
530 ${systemd_system_unitdir}/systemd-machined.service \
531 ${systemd_system_unitdir}/dbus-org.freedesktop.machine1.service \
532 ${systemd_system_unitdir}/var-lib-machines.mount \
533 ${rootlibexecdir}/systemd/systemd-import \
534 ${rootlibexecdir}/systemd/systemd-importd \
535 ${rootlibexecdir}/systemd/systemd-machined \
536 ${rootlibexecdir}/systemd/systemd-pull \
537 ${exec_prefix}/lib/tmpfiles.d/systemd-nspawn.conf \
538 ${exec_prefix}/lib/tmpfiles.d/README \
539 ${systemd_system_unitdir}/systemd-nspawn@.service \
Andrew Geissler517393d2023-01-13 08:55:19 -0600540 ${datadir}/dbus-1/system-services/org.freedesktop.import1.service \
541 ${datadir}/dbus-1/system-services/org.freedesktop.machine1.service \
542 ${datadir}/dbus-1/system.d/org.freedesktop.import1.conf \
543 ${datadir}/dbus-1/system.d/org.freedesktop.machine1.conf \
544 ${datadir}/polkit-1/actions/org.freedesktop.import1.policy \
545 ${datadir}/polkit-1/actions/org.freedesktop.machine1.policy \
546 "
547
Patrick Williamsac13d5f2023-11-24 18:59:46 -0600548RDEPENDS:${PN}-container = "${@bb.utils.contains('PACKAGECONFIG', 'nss-mymachines', 'libnss-mymachines', '', d)}"
549
Andrew Geissler517393d2023-01-13 08:55:19 -0600550# "machinectl import-tar" uses "tar --numeric-owner", not supported by busybox.
551RRECOMMENDS:${PN}-container += "\
552 ${PN}-journal-gatewayd \
553 ${PN}-journal-remote \
554 ${PN}-journal-upload \
555 kernel-module-dm-mod \
556 kernel-module-loop \
557 kernel-module-tun \
558 tar \
559 "
560
561FILES:${PN}-extra-utils = "\
562 ${base_bindir}/systemd-escape \
563 ${base_bindir}/systemd-inhibit \
564 ${bindir}/systemd-detect-virt \
565 ${bindir}/systemd-dissect \
566 ${bindir}/systemd-path \
567 ${bindir}/systemd-run \
568 ${bindir}/systemd-cat \
569 ${bindir}/systemd-creds \
Andrew Geissler517393d2023-01-13 08:55:19 -0600570 ${bindir}/systemd-delta \
571 ${bindir}/systemd-cgls \
572 ${bindir}/systemd-cgtop \
573 ${bindir}/systemd-stdio-bridge \
574 ${base_bindir}/systemd-ask-password \
575 ${base_bindir}/systemd-tty-ask-password-agent \
Patrick Williams2a254922023-08-11 09:48:11 -0500576 ${base_sbindir}/mount.ddi \
Andrew Geissler517393d2023-01-13 08:55:19 -0600577 ${systemd_system_unitdir}/initrd.target.wants/systemd-pcrphase-initrd.path \
578 ${systemd_system_unitdir}/systemd-ask-password-console.path \
579 ${systemd_system_unitdir}/systemd-ask-password-console.service \
580 ${systemd_system_unitdir}/systemd-ask-password-wall.path \
581 ${systemd_system_unitdir}/systemd-ask-password-wall.service \
582 ${systemd_system_unitdir}/sysinit.target.wants/systemd-ask-password-console.path \
583 ${systemd_system_unitdir}/sysinit.target.wants/systemd-ask-password-wall.path \
584 ${systemd_system_unitdir}/sysinit.target.wants/systemd-pcrphase.path \
585 ${systemd_system_unitdir}/sysinit.target.wants/systemd-pcrphase-sysinit.path \
586 ${systemd_system_unitdir}/multi-user.target.wants/systemd-ask-password-wall.path \
587 ${rootlibexecdir}/systemd/systemd-resolve-host \
588 ${rootlibexecdir}/systemd/systemd-ac-power \
589 ${rootlibexecdir}/systemd/systemd-activate \
590 ${rootlibexecdir}/systemd/systemd-bus-proxyd \
591 ${systemd_system_unitdir}/systemd-bus-proxyd.service \
592 ${systemd_system_unitdir}/systemd-bus-proxyd.socket \
593 ${rootlibexecdir}/systemd/systemd-measure \
594 ${rootlibexecdir}/systemd/systemd-pcrphase \
595 ${rootlibexecdir}/systemd/systemd-socket-proxyd \
596 ${rootlibexecdir}/systemd/systemd-reply-password \
597 ${rootlibexecdir}/systemd/systemd-sleep \
598 ${rootlibexecdir}/systemd/system-sleep \
599 ${systemd_system_unitdir}/systemd-hibernate.service \
600 ${systemd_system_unitdir}/systemd-hybrid-sleep.service \
601 ${systemd_system_unitdir}/systemd-pcrphase-initrd.service \
602 ${systemd_system_unitdir}/systemd-pcrphase.service \
603 ${systemd_system_unitdir}/systemd-pcrphase-sysinit.service \
604 ${systemd_system_unitdir}/systemd-suspend.service \
605 ${systemd_system_unitdir}/sleep.target \
606 ${rootlibexecdir}/systemd/systemd-initctl \
607 ${systemd_system_unitdir}/systemd-initctl.service \
608 ${systemd_system_unitdir}/systemd-initctl.socket \
609 ${systemd_system_unitdir}/sockets.target.wants/systemd-initctl.socket \
610 ${rootlibexecdir}/systemd/system-generators/systemd-gpt-auto-generator \
611 ${rootlibexecdir}/systemd/systemd-cgroups-agent \
612"
613
614FILES:${PN}-udev-rules = "\
615 ${rootlibexecdir}/udev/rules.d/70-uaccess.rules \
616 ${rootlibexecdir}/udev/rules.d/71-seat.rules \
617 ${rootlibexecdir}/udev/rules.d/73-seat-late.rules \
618 ${rootlibexecdir}/udev/rules.d/99-systemd.rules \
619"
620
621CONFFILES:${PN} = "${sysconfdir}/systemd/coredump.conf \
622 ${sysconfdir}/systemd/journald.conf \
623 ${sysconfdir}/systemd/logind.conf \
624 ${sysconfdir}/systemd/networkd.conf \
625 ${sysconfdir}/systemd/pstore.conf \
626 ${sysconfdir}/systemd/resolved.conf \
627 ${sysconfdir}/systemd/sleep.conf \
628 ${sysconfdir}/systemd/system.conf \
629 ${sysconfdir}/systemd/timesyncd.conf \
630 ${sysconfdir}/systemd/user.conf \
631"
632
633FILES:${PN} = " ${base_bindir}/* \
634 ${base_sbindir}/shutdown \
635 ${base_sbindir}/halt \
636 ${base_sbindir}/poweroff \
637 ${base_sbindir}/runlevel \
638 ${base_sbindir}/telinit \
639 ${base_sbindir}/resolvconf \
640 ${base_sbindir}/reboot \
641 ${base_sbindir}/init \
642 ${datadir}/dbus-1/services \
643 ${datadir}/dbus-1/system-services \
644 ${datadir}/polkit-1 \
645 ${datadir}/${BPN} \
646 ${datadir}/factory \
Patrick Williams2a254922023-08-11 09:48:11 -0500647 ${sysconfdir}/credstore/ \
648 ${sysconfdir}/credstore.encrypted/ \
Andrew Geissler517393d2023-01-13 08:55:19 -0600649 ${sysconfdir}/dbus-1/ \
650 ${sysconfdir}/modules-load.d/ \
651 ${sysconfdir}/pam.d/ \
652 ${sysconfdir}/profile.d/ \
653 ${sysconfdir}/sysctl.d/ \
654 ${sysconfdir}/systemd/ \
655 ${sysconfdir}/tmpfiles.d/ \
656 ${sysconfdir}/xdg/ \
657 ${sysconfdir}/init.d/README \
658 ${sysconfdir}/resolv-conf.systemd \
659 ${sysconfdir}/X11/xinit/xinitrc.d/* \
660 ${rootlibexecdir}/systemd/* \
661 ${rootlibdir}/systemd/libsystemd-core* \
662 ${libdir}/pam.d \
663 ${nonarch_libdir}/pam.d \
664 ${systemd_unitdir}/* \
665 ${base_libdir}/security/*.so \
666 /cgroup \
667 ${bindir}/systemd* \
668 ${bindir}/busctl \
669 ${bindir}/coredumpctl \
670 ${bindir}/localectl \
671 ${bindir}/hostnamectl \
672 ${bindir}/resolvectl \
673 ${bindir}/timedatectl \
674 ${bindir}/bootctl \
675 ${bindir}/oomctl \
676 ${bindir}/userdbctl \
Patrick Williams2a254922023-08-11 09:48:11 -0500677 ${exec_prefix}/lib/credstore \
Andrew Geissler517393d2023-01-13 08:55:19 -0600678 ${exec_prefix}/lib/tmpfiles.d/*.conf \
679 ${exec_prefix}/lib/systemd \
680 ${exec_prefix}/lib/modules-load.d \
681 ${exec_prefix}/lib/sysctl.d \
682 ${exec_prefix}/lib/sysusers.d \
683 ${exec_prefix}/lib/environment.d \
684 ${localstatedir} \
685 ${rootlibexecdir}/modprobe.d/systemd.conf \
686 ${rootlibexecdir}/modprobe.d/README \
687 ${datadir}/dbus-1/system.d/org.freedesktop.timedate1.conf \
688 ${datadir}/dbus-1/system.d/org.freedesktop.locale1.conf \
689 ${datadir}/dbus-1/system.d/org.freedesktop.network1.conf \
690 ${datadir}/dbus-1/system.d/org.freedesktop.resolve1.conf \
691 ${datadir}/dbus-1/system.d/org.freedesktop.systemd1.conf \
692 ${@bb.utils.contains('PACKAGECONFIG', 'polkit_hostnamed_fallback', '${datadir}/dbus-1/system.d/org.freedesktop.hostname1_no_polkit.conf', '', d)} \
693 ${datadir}/dbus-1/system.d/org.freedesktop.hostname1.conf \
694 ${datadir}/dbus-1/system.d/org.freedesktop.login1.conf \
695 ${datadir}/dbus-1/system.d/org.freedesktop.timesync1.conf \
696 ${datadir}/dbus-1/system.d/org.freedesktop.portable1.conf \
697 ${datadir}/dbus-1/system.d/org.freedesktop.oom1.conf \
698 ${datadir}/dbus-1/system.d/org.freedesktop.home1.conf \
699 "
700
701FILES:${PN}-dev += "${base_libdir}/security/*.la ${datadir}/dbus-1/interfaces/ ${sysconfdir}/rpm/macros.systemd"
702
Patrick Williams2a254922023-08-11 09:48:11 -0500703RDEPENDS:${PN} += "kmod dbus util-linux-mount util-linux-umount udev (= ${EXTENDPKGV}) systemd-udev-rules util-linux-agetty util-linux-fsck util-linux-swaponoff"
Andrew Geissler517393d2023-01-13 08:55:19 -0600704RDEPENDS:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'serial-getty-generator', '', 'systemd-serialgetty', d)}"
705RDEPENDS:${PN} += "volatile-binds"
706
707RRECOMMENDS:${PN} += "systemd-extra-utils \
708 udev-hwdb \
709 e2fsprogs-e2fsck \
710 kernel-module-autofs4 kernel-module-unix kernel-module-ipv6 kernel-module-sch-fq-codel \
711 os-release \
712 systemd-conf \
Patrick Williams2a254922023-08-11 09:48:11 -0500713 ${@bb.utils.contains('PACKAGECONFIG', 'logind', 'pam-plugin-umask', '', d)} \
Andrew Geissler517393d2023-01-13 08:55:19 -0600714"
715
716INSANE_SKIP:${PN} += "dev-so libdir"
717INSANE_SKIP:${PN}-dbg += "libdir"
718INSANE_SKIP:${PN}-doc += " libdir"
719INSANE_SKIP:libsystemd-shared += "libdir"
720
721FILES:libsystemd-shared = "${rootlibdir}/systemd/libsystemd-shared*.so"
722
723RPROVIDES:udev = "hotplug"
724
Patrick Williams705982a2024-01-12 09:51:57 -0600725RDEPENDS:udev-bash-completion += "bash-completion"
Andrew Geissler517393d2023-01-13 08:55:19 -0600726RDEPENDS:udev-hwdb += "udev"
727
728FILES:udev += "${base_sbindir}/udevd \
729 ${rootlibexecdir}/systemd/network/99-default.link \
730 ${rootlibexecdir}/systemd/systemd-udevd \
731 ${rootlibexecdir}/udev/accelerometer \
732 ${rootlibexecdir}/udev/ata_id \
733 ${rootlibexecdir}/udev/cdrom_id \
734 ${rootlibexecdir}/udev/collect \
735 ${rootlibexecdir}/udev/dmi_memory_id \
736 ${rootlibexecdir}/udev/fido_id \
737 ${rootlibexecdir}/udev/findkeyboards \
Patrick Williams2a254922023-08-11 09:48:11 -0500738 ${rootlibexecdir}/udev/iocost \
Andrew Geissler517393d2023-01-13 08:55:19 -0600739 ${rootlibexecdir}/udev/keyboard-force-release.sh \
740 ${rootlibexecdir}/udev/keymap \
741 ${rootlibexecdir}/udev/mtd_probe \
742 ${rootlibexecdir}/udev/scsi_id \
743 ${rootlibexecdir}/udev/v4l_id \
744 ${rootlibexecdir}/udev/keymaps \
745 ${rootlibexecdir}/udev/rules.d/50-udev-default.rules \
746 ${rootlibexecdir}/udev/rules.d/60-autosuspend.rules \
747 ${rootlibexecdir}/udev/rules.d/60-autosuspend-chromiumos.rules \
748 ${rootlibexecdir}/udev/rules.d/60-block.rules \
749 ${rootlibexecdir}/udev/rules.d/60-cdrom_id.rules \
Patrick Williams2a254922023-08-11 09:48:11 -0500750 ${rootlibexecdir}/udev/rules.d/60-dmi-id.rules \
Andrew Geissler517393d2023-01-13 08:55:19 -0600751 ${rootlibexecdir}/udev/rules.d/60-drm.rules \
752 ${rootlibexecdir}/udev/rules.d/60-evdev.rules \
753 ${rootlibexecdir}/udev/rules.d/60-fido-id.rules \
Andrew Geisslerfc113ea2023-03-31 09:59:46 -0500754 ${rootlibexecdir}/udev/rules.d/60-infiniband.rules \
Andrew Geissler517393d2023-01-13 08:55:19 -0600755 ${rootlibexecdir}/udev/rules.d/60-input-id.rules \
756 ${rootlibexecdir}/udev/rules.d/60-persistent-alsa.rules \
757 ${rootlibexecdir}/udev/rules.d/60-persistent-input.rules \
758 ${rootlibexecdir}/udev/rules.d/60-persistent-storage.rules \
759 ${rootlibexecdir}/udev/rules.d/60-persistent-storage-tape.rules \
760 ${rootlibexecdir}/udev/rules.d/60-persistent-v4l.rules \
761 ${rootlibexecdir}/udev/rules.d/60-sensor.rules \
762 ${rootlibexecdir}/udev/rules.d/60-serial.rules \
763 ${rootlibexecdir}/udev/rules.d/61-autosuspend-manual.rules \
764 ${rootlibexecdir}/udev/rules.d/64-btrfs.rules \
765 ${rootlibexecdir}/udev/rules.d/70-camera.rules \
766 ${rootlibexecdir}/udev/rules.d/70-joystick.rules \
767 ${rootlibexecdir}/udev/rules.d/70-memory.rules \
768 ${rootlibexecdir}/udev/rules.d/70-mouse.rules \
769 ${rootlibexecdir}/udev/rules.d/70-power-switch.rules \
770 ${rootlibexecdir}/udev/rules.d/70-touchpad.rules \
771 ${rootlibexecdir}/udev/rules.d/75-net-description.rules \
772 ${rootlibexecdir}/udev/rules.d/75-probe_mtd.rules \
773 ${rootlibexecdir}/udev/rules.d/78-sound-card.rules \
774 ${rootlibexecdir}/udev/rules.d/80-drivers.rules \
775 ${rootlibexecdir}/udev/rules.d/80-net-setup-link.rules \
776 ${rootlibexecdir}/udev/rules.d/81-net-dhcp.rules \
777 ${rootlibexecdir}/udev/rules.d/90-vconsole.rules \
Patrick Williams2a254922023-08-11 09:48:11 -0500778 ${rootlibexecdir}/udev/rules.d/90-iocost.rules \
Andrew Geissler517393d2023-01-13 08:55:19 -0600779 ${rootlibexecdir}/udev/rules.d/README \
780 ${sysconfdir}/udev \
781 ${sysconfdir}/init.d/systemd-udevd \
782 ${systemd_system_unitdir}/*udev* \
783 ${systemd_system_unitdir}/*.wants/*udev* \
784 ${base_bindir}/systemd-hwdb \
785 ${base_bindir}/udevadm \
786 ${base_sbindir}/udevadm \
Andrew Geissler517393d2023-01-13 08:55:19 -0600787 ${systemd_system_unitdir}/systemd-hwdb-update.service \
788 "
789
Patrick Williams705982a2024-01-12 09:51:57 -0600790FILES:udev-bash-completion = "${datadir}/bash-completion/completions/udevadm"
Andrew Geissler517393d2023-01-13 08:55:19 -0600791FILES:udev-hwdb = "${rootlibexecdir}/udev/hwdb.d \
792 "
793
794RCONFLICTS:${PN} = "tiny-init ${@bb.utils.contains('PACKAGECONFIG', 'resolved', 'resolvconf', '', d)}"
795
796INITSCRIPT_PACKAGES = "udev"
797INITSCRIPT_NAME:udev = "systemd-udevd"
798INITSCRIPT_PARAMS:udev = "start 03 S ."
799
800python __anonymous() {
801 if not bb.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d):
802 d.setVar("INHIBIT_UPDATERCD_BBCLASS", "1")
803
Patrick Williamsac13d5f2023-11-24 18:59:46 -0600804 if bb.utils.contains('DISTRO_FEATURES', 'systemd-resolved', True, False, d) and not bb.utils.contains('PACKAGECONFIG', 'nss-resolve resolved', True, False, d):
805 bb.error("DISTRO_FEATURES[systemd-resolved] requires PACKAGECONFIG[nss-resolve, resolved]")
806
Andrew Geissler517393d2023-01-13 08:55:19 -0600807 if bb.utils.contains('PACKAGECONFIG', 'repart', True, False, d) and not bb.utils.contains('PACKAGECONFIG', 'openssl', True, False, d):
808 bb.error("PACKAGECONFIG[repart] requires PACKAGECONFIG[openssl]")
809
810 if bb.utils.contains('PACKAGECONFIG', 'homed', True, False, d) and not bb.utils.contains('PACKAGECONFIG', 'userdb openssl cryptsetup', True, False, d):
811 bb.error("PACKAGECONFIG[homed] requires PACKAGECONFIG[userdb], PACKAGECONFIG[openssl] and PACKAGECONFIG[cryptsetup]")
812}
813
814python do_warn_musl() {
815 if d.getVar('TCLIBC') == "musl":
816 bb.warn("Using systemd with musl is not recommended since it is not supported upstream and some patches are known to be problematic.")
817}
818addtask warn_musl before do_configure
819
820ALTERNATIVE:${PN} = "halt reboot shutdown poweroff runlevel ${@bb.utils.contains('PACKAGECONFIG', 'resolved', 'resolv-conf', '', d)}"
821
822ALTERNATIVE_TARGET[resolv-conf] = "${sysconfdir}/resolv-conf.systemd"
823ALTERNATIVE_LINK_NAME[resolv-conf] = "${sysconfdir}/resolv.conf"
824ALTERNATIVE_PRIORITY[resolv-conf] ?= "50"
825
826ALTERNATIVE_TARGET[halt] = "${base_bindir}/systemctl"
827ALTERNATIVE_LINK_NAME[halt] = "${base_sbindir}/halt"
828ALTERNATIVE_PRIORITY[halt] ?= "300"
829
830ALTERNATIVE_TARGET[reboot] = "${base_bindir}/systemctl"
831ALTERNATIVE_LINK_NAME[reboot] = "${base_sbindir}/reboot"
832ALTERNATIVE_PRIORITY[reboot] ?= "300"
833
834ALTERNATIVE_TARGET[shutdown] = "${base_bindir}/systemctl"
835ALTERNATIVE_LINK_NAME[shutdown] = "${base_sbindir}/shutdown"
836ALTERNATIVE_PRIORITY[shutdown] ?= "300"
837
838ALTERNATIVE_TARGET[poweroff] = "${base_bindir}/systemctl"
839ALTERNATIVE_LINK_NAME[poweroff] = "${base_sbindir}/poweroff"
840ALTERNATIVE_PRIORITY[poweroff] ?= "300"
841
842ALTERNATIVE_TARGET[runlevel] = "${base_bindir}/systemctl"
843ALTERNATIVE_LINK_NAME[runlevel] = "${base_sbindir}/runlevel"
844ALTERNATIVE_PRIORITY[runlevel] ?= "300"
845
846pkg_postinst:${PN}:libc-glibc () {
Patrick Williamsac13d5f2023-11-24 18:59:46 -0600847 if ${@bb.utils.contains('PACKAGECONFIG', 'myhostname', 'true', 'false', d)}; then
848 sed -e '/^hosts:/s/\s*\<myhostname\>//' \
849 -e 's/\(^hosts:.*\)\(\<files\>\)\(.*\)\(\<dns\>\)\(.*\)/\1\2 myhostname \3\4\5/' \
850 -i $D${sysconfdir}/nsswitch.conf
851 fi
852 if ${@bb.utils.contains('PACKAGECONFIG', 'nss', 'true', 'false', d)}; then
853 sed -e 's#\(^passwd:.*\)#\1 systemd#' \
854 -e 's#\(^group:.*\)#\1 systemd#' \
855 -e 's#\(^shadow:.*\)#\1 systemd#' \
856 -i $D${sysconfdir}/nsswitch.conf
857 fi
Andrew Geissler517393d2023-01-13 08:55:19 -0600858}
859
860pkg_prerm:${PN}:libc-glibc () {
Patrick Williamsac13d5f2023-11-24 18:59:46 -0600861 if ${@bb.utils.contains('PACKAGECONFIG', 'myhostname', 'true', 'false', d)}; then
862 sed -e '/^hosts:/s/\s*\<myhostname\>//' \
863 -e '/^hosts:/s/\s*myhostname//' \
864 -i $D${sysconfdir}/nsswitch.conf
865 fi
866 if ${@bb.utils.contains('PACKAGECONFIG', 'nss', 'true', 'false', d)}; then
867 sed -e '/^passwd:/s#\s*systemd##' \
868 -e '/^group:/s#\s*systemd##' \
869 -e '/^shadow:/s#\s*systemd##' \
870 -i $D${sysconfdir}/nsswitch.conf
871 fi
Andrew Geissler517393d2023-01-13 08:55:19 -0600872}
873
874PACKAGE_WRITE_DEPS += "qemu-native"
875pkg_postinst:udev-hwdb () {
876 if test -n "$D"; then
877 $INTERCEPT_DIR/postinst_intercept update_udev_hwdb ${PKG} mlprefix=${MLPREFIX} binprefix=${MLPREFIX} rootlibexecdir="${rootlibexecdir}" PREFERRED_PROVIDER_udev="${PREFERRED_PROVIDER_udev}" base_bindir="${base_bindir}"
878 else
879 udevadm hwdb --update
880 fi
881}
882
883pkg_prerm:udev-hwdb () {
884 rm -f $D${sysconfdir}/udev/hwdb.bin
885}