systemd_246.6.bb 36 KB

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