Gentoo Archives: gentoo-commits

From: Sam James <sam@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-apps/systemd/
Date: Fri, 03 Jun 2022 00:37:33
Message-Id: 1654216131.80b4cae789624e6be3e39dbc4fefbf6a16e908f9.sam@gentoo
1 commit: 80b4cae789624e6be3e39dbc4fefbf6a16e908f9
2 Author: Sam James <sam <AT> gentoo <DOT> org>
3 AuthorDate: Fri Jun 3 00:28:51 2022 +0000
4 Commit: Sam James <sam <AT> gentoo <DOT> org>
5 CommitDate: Fri Jun 3 00:28:51 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=80b4cae7
7
8 sys-apps/systemd: add 250.7
9
10 Signed-off-by: Sam James <sam <AT> gentoo.org>
11
12 sys-apps/systemd/Manifest | 1 +
13 sys-apps/systemd/systemd-250.7.ebuild | 552 ++++++++++++++++++++++++++++++++++
14 2 files changed, 553 insertions(+)
15
16 diff --git a/sys-apps/systemd/Manifest b/sys-apps/systemd/Manifest
17 index af4ed419db68..2828ccc0b918 100644
18 --- a/sys-apps/systemd/Manifest
19 +++ b/sys-apps/systemd/Manifest
20 @@ -2,4 +2,5 @@ DIST systemd-251.tar.gz 11431104 BLAKE2B da783d815adf244defc3c1ec8a788fffdff4521
21 DIST systemd-stable-250.4.tar.gz 11132786 BLAKE2B 8fdfe1bad76e572dc1be0955f3d1c4080f2beb81a2f9670f80827899f5406ab8ed8675400c2f5e8ccef44cf1bceff42ceae12a42e1b67d46c0deb523e6495f25 SHA512 307ed0920da660b6c45d909fea66864fb98db8b2f6905d629fb2012fc4bf64dd25fd61168c22bf4098200be541be9b0e815fbde98806a99c85cb33d49d8b63d0
22 DIST systemd-stable-250.5.tar.gz 11212059 BLAKE2B b7dbcb9e82c51e966db20a92ccd59ac19309702c481dd575c4e6367ca5ade10fe4b689925416ce1169682380cbf22d7d692b2378ef091f3007c16891992e3f92 SHA512 ad864b67bd5e2f5fd5705b636467827e4735142cefba150d24bb8e51ac0263650b2b0e53d4426eb509d1db59b83dc3b4c4bf157cc355fc2b7524db6bc4a9b5cd
23 DIST systemd-stable-250.6.tar.gz 11212534 BLAKE2B faf065dbe5c02d9d3311202f93b9ad8984c4c9d127d32c17f305b81046f9e29cfc731cdd4abbd073965f448f4e1dff81d80313896b346548d2640939ad509365 SHA512 b625d5fb419370d238cf72f2e59c8fa6782972d94746835bde3a64a7746edd1d5fad901bbb01311f858b7dbdff6d759518b615708bb835a81964c16878d5644e
24 +DIST systemd-stable-250.7.tar.gz 11214975 BLAKE2B 5d94b4b1f8b0cd6e8284a89ac0d4bd373eccdad2c3d6e6c453df79c8df47ee0f9cfbde764b72b1f9d172d07e2d9f1f1f41c1ab254cf4abd0722469ebc3ad7cf8 SHA512 99bc6f0c9757b280cb694f3fb4d6fe04d5ce55583eb2bae5ddeb324bb5ee9930c1720fcc27293d90cddba188473653ec541a471ae8115710a5850c26d0ba215d
25 DIST systemd-stable-251.1.tar.gz 11431880 BLAKE2B 0442489242b2fbfb316f207c7c8c718322a1ea2af8176378fb39bea441fdd8bbb36ea840af9bdec257b714f5f3099daa1139bc6df6ca6f0c2f467c59013fba92 SHA512 6fc72197b684abc343480acb66b8f749c186bd7a031ddd757c4a0e5fd8fdeda0cde9c9e634fd3d9e2b2d1ed96019c5f8e7119ad10a7f51d5dc13fac2571c6c70
26
27 diff --git a/sys-apps/systemd/systemd-250.7.ebuild b/sys-apps/systemd/systemd-250.7.ebuild
28 new file mode 100644
29 index 000000000000..d644c2095a47
30 --- /dev/null
31 +++ b/sys-apps/systemd/systemd-250.7.ebuild
32 @@ -0,0 +1,552 @@
33 +# Copyright 2011-2022 Gentoo Authors
34 +# Distributed under the terms of the GNU General Public License v2
35 +
36 +EAPI=7
37 +PYTHON_COMPAT=( python3_{8..10} )
38 +
39 +# Avoid QA warnings
40 +TMPFILES_OPTIONAL=1
41 +
42 +QA_PKGCONFIG_VERSION=$(ver_cut 1)
43 +
44 +if [[ ${PV} == 9999 ]]; then
45 + EGIT_REPO_URI="https://github.com/systemd/systemd.git"
46 + inherit git-r3
47 +else
48 + if [[ ${PV} == *.* ]]; then
49 + MY_PN=systemd-stable
50 + else
51 + MY_PN=systemd
52 + fi
53 + MY_PV=${PV/_/-}
54 + MY_P=${MY_PN}-${MY_PV}
55 + S=${WORKDIR}/${MY_P}
56 + SRC_URI="https://github.com/systemd/${MY_PN}/archive/v${MY_PV}/${MY_P}.tar.gz"
57 + KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
58 +fi
59 +
60 +inherit bash-completion-r1 flag-o-matic linux-info meson-multilib pam python-any-r1 systemd toolchain-funcs udev usr-ldscript
61 +
62 +DESCRIPTION="System and service manager for Linux"
63 +HOMEPAGE="http://systemd.io/"
64 +
65 +LICENSE="GPL-2 LGPL-2.1 MIT public-domain"
66 +SLOT="0/2"
67 +IUSE="
68 + acl apparmor audit build cgroup-hybrid cryptsetup curl +dns-over-tls elfutils
69 + fido2 +gcrypt gnuefi gnutls homed hostnamed-fallback http idn importd +kmod
70 + +lz4 lzma nat +openssl pam pcre pkcs11 policykit pwquality qrcode
71 + +resolvconf +seccomp selinux split-usr +sysv-utils test tpm vanilla xkb +zstd
72 +"
73 +REQUIRED_USE="
74 + dns-over-tls? ( || ( gnutls openssl ) )
75 + homed? ( cryptsetup pam openssl )
76 + importd? ( curl lzma || ( gcrypt openssl ) )
77 + policykit? ( !hostnamed-fallback )
78 + pwquality? ( homed )
79 +"
80 +RESTRICT="!test? ( test )"
81 +
82 +MINKV="3.11"
83 +
84 +COMMON_DEPEND="
85 + >=sys-apps/util-linux-2.30:0=[${MULTILIB_USEDEP}]
86 + sys-libs/libcap:0=[${MULTILIB_USEDEP}]
87 + virtual/libcrypt:=[${MULTILIB_USEDEP}]
88 + acl? ( sys-apps/acl:0= )
89 + apparmor? ( sys-libs/libapparmor:0= )
90 + audit? ( >=sys-process/audit-2:0= )
91 + cryptsetup? ( >=sys-fs/cryptsetup-2.0.1:0= )
92 + curl? ( net-misc/curl:0= )
93 + elfutils? ( >=dev-libs/elfutils-0.158:0= )
94 + fido2? ( dev-libs/libfido2:0= )
95 + gcrypt? ( >=dev-libs/libgcrypt-1.4.5:0=[${MULTILIB_USEDEP}] )
96 + gnutls? ( >=net-libs/gnutls-3.6.0:0= )
97 + http? ( >=net-libs/libmicrohttpd-0.9.33:0=[epoll(+)] )
98 + idn? ( net-dns/libidn2:= )
99 + importd? (
100 + app-arch/bzip2:0=
101 + sys-libs/zlib:0=
102 + )
103 + kmod? ( >=sys-apps/kmod-15:0= )
104 + lz4? ( >=app-arch/lz4-0_p131:0=[${MULTILIB_USEDEP}] )
105 + lzma? ( >=app-arch/xz-utils-5.0.5-r1:0=[${MULTILIB_USEDEP}] )
106 + nat? ( net-firewall/iptables:0= )
107 + openssl? ( >=dev-libs/openssl-1.1.0:0= )
108 + pam? ( sys-libs/pam:=[${MULTILIB_USEDEP}] )
109 + pkcs11? ( app-crypt/p11-kit:0= )
110 + pcre? ( dev-libs/libpcre2 )
111 + pwquality? ( dev-libs/libpwquality:0= )
112 + qrcode? ( media-gfx/qrencode:0= )
113 + seccomp? ( >=sys-libs/libseccomp-2.3.3:0= )
114 + selinux? ( sys-libs/libselinux:0= )
115 + tpm? ( app-crypt/tpm2-tss:0= )
116 + xkb? ( >=x11-libs/libxkbcommon-0.4.1:0= )
117 + zstd? ( >=app-arch/zstd-1.4.0:0=[${MULTILIB_USEDEP}] )
118 +"
119 +
120 +# Newer linux-headers needed by ia64, bug #480218
121 +DEPEND="${COMMON_DEPEND}
122 + >=sys-kernel/linux-headers-${MINKV}
123 + gnuefi? ( >=sys-boot/gnu-efi-3.0.2 )
124 +"
125 +
126 +# baselayout-2.2 has /run
127 +RDEPEND="${COMMON_DEPEND}
128 + >=acct-group/adm-0-r1
129 + >=acct-group/wheel-0-r1
130 + >=acct-group/kmem-0-r1
131 + >=acct-group/tty-0-r1
132 + >=acct-group/utmp-0-r1
133 + >=acct-group/audio-0-r1
134 + >=acct-group/cdrom-0-r1
135 + >=acct-group/dialout-0-r1
136 + >=acct-group/disk-0-r1
137 + >=acct-group/input-0-r1
138 + >=acct-group/kvm-0-r1
139 + >=acct-group/lp-0-r1
140 + >=acct-group/render-0-r1
141 + acct-group/sgx
142 + >=acct-group/tape-0-r1
143 + acct-group/users
144 + >=acct-group/video-0-r1
145 + >=acct-group/systemd-journal-0-r1
146 + >=acct-user/root-0-r1
147 + acct-user/nobody
148 + >=acct-user/systemd-journal-remote-0-r1
149 + >=acct-user/systemd-coredump-0-r1
150 + >=acct-user/systemd-network-0-r1
151 + acct-user/systemd-oom
152 + >=acct-user/systemd-resolve-0-r1
153 + >=acct-user/systemd-timesync-0-r1
154 + >=sys-apps/baselayout-2.2
155 + hostnamed-fallback? (
156 + acct-group/systemd-hostname
157 + sys-apps/dbus-broker
158 + )
159 + selinux? ( sec-policy/selinux-base-policy[systemd] )
160 + sysv-utils? (
161 + !sys-apps/openrc[sysv-utils(-)]
162 + !sys-apps/sysvinit
163 + )
164 + !sysv-utils? ( sys-apps/sysvinit )
165 + resolvconf? ( !net-dns/openresolv )
166 + !build? ( || (
167 + sys-apps/util-linux[kill(-)]
168 + sys-process/procps[kill(+)]
169 + sys-apps/coreutils[kill(-)]
170 + ) )
171 + !sys-apps/hwids[udev]
172 + !sys-auth/nss-myhostname
173 + !sys-fs/eudev
174 + !sys-fs/udev
175 +"
176 +
177 +# sys-apps/dbus: the daemon only (+ build-time lib dep for tests)
178 +PDEPEND=">=sys-apps/dbus-1.9.8[systemd]
179 + >=sys-fs/udev-init-scripts-34
180 + policykit? ( sys-auth/polkit )
181 + !vanilla? ( sys-apps/gentoo-systemd-integration )"
182 +
183 +BDEPEND="
184 + app-arch/xz-utils:0
185 + dev-util/gperf
186 + >=dev-util/meson-0.46
187 + >=sys-apps/coreutils-8.16
188 + sys-devel/gettext
189 + virtual/pkgconfig
190 + test? (
191 + app-text/tree
192 + dev-lang/perl
193 + sys-apps/dbus
194 + )
195 + app-text/docbook-xml-dtd:4.2
196 + app-text/docbook-xml-dtd:4.5
197 + app-text/docbook-xsl-stylesheets
198 + dev-libs/libxslt:0
199 + $(python_gen_any_dep 'dev-python/jinja[${PYTHON_USEDEP}]')
200 + $(python_gen_any_dep 'dev-python/lxml[${PYTHON_USEDEP}]')
201 +"
202 +
203 +python_check_deps() {
204 + has_version -b "dev-python/jinja[${PYTHON_USEDEP}]" &&
205 + has_version -b "dev-python/lxml[${PYTHON_USEDEP}]"
206 +}
207 +
208 +QA_FLAGS_IGNORED="usr/lib/systemd/boot/efi/.*"
209 +QA_EXECSTACK="usr/lib/systemd/boot/efi/*"
210 +
211 +pkg_pretend() {
212 + if [[ ${MERGE_TYPE} != buildonly ]]; then
213 + if use test && has pid-sandbox ${FEATURES}; then
214 + ewarn "Tests are known to fail with PID sandboxing enabled."
215 + ewarn "See https://bugs.gentoo.org/674458."
216 + fi
217 +
218 + local CONFIG_CHECK=" ~BINFMT_MISC ~BLK_DEV_BSG ~CGROUPS
219 + ~DEVTMPFS ~EPOLL ~FANOTIFY ~FHANDLE
220 + ~INOTIFY_USER ~IPV6 ~NET ~NET_NS ~PROC_FS ~SIGNALFD ~SYSFS
221 + ~TIMERFD ~TMPFS_XATTR ~UNIX ~USER_NS
222 + ~CRYPTO_HMAC ~CRYPTO_SHA256 ~CRYPTO_USER_API_HASH
223 + ~!GRKERNSEC_PROC ~!IDE ~!SYSFS_DEPRECATED
224 + ~!SYSFS_DEPRECATED_V2"
225 +
226 + use acl && CONFIG_CHECK+=" ~TMPFS_POSIX_ACL"
227 + use seccomp && CONFIG_CHECK+=" ~SECCOMP ~SECCOMP_FILTER"
228 + kernel_is -lt 3 7 && CONFIG_CHECK+=" ~HOTPLUG"
229 + kernel_is -lt 4 7 && CONFIG_CHECK+=" ~DEVPTS_MULTIPLE_INSTANCES"
230 + kernel_is -ge 4 10 && CONFIG_CHECK+=" ~CGROUP_BPF"
231 +
232 + if kernel_is -ge 5 10 20; then
233 + CONFIG_CHECK+=" ~KCMP"
234 + else
235 + CONFIG_CHECK+=" ~CHECKPOINT_RESTORE"
236 + fi
237 +
238 + if kernel_is -ge 4 18; then
239 + CONFIG_CHECK+=" ~AUTOFS_FS"
240 + else
241 + CONFIG_CHECK+=" ~AUTOFS4_FS"
242 + fi
243 +
244 + if linux_config_exists; then
245 + local uevent_helper_path=$(linux_chkconfig_string UEVENT_HELPER_PATH)
246 + if [[ -n ${uevent_helper_path} ]] && [[ ${uevent_helper_path} != '""' ]]; then
247 + ewarn "It's recommended to set an empty value to the following kernel config option:"
248 + ewarn "CONFIG_UEVENT_HELPER_PATH=${uevent_helper_path}"
249 + fi
250 + if linux_chkconfig_present X86; then
251 + CONFIG_CHECK+=" ~DMIID"
252 + fi
253 + fi
254 +
255 + if kernel_is -lt ${MINKV//./ }; then
256 + ewarn "Kernel version at least ${MINKV} required"
257 + fi
258 +
259 + check_extra_config
260 + fi
261 +}
262 +
263 +pkg_setup() {
264 + :
265 +}
266 +
267 +src_unpack() {
268 + default
269 + [[ ${PV} != 9999 ]] || git-r3_src_unpack
270 +}
271 +
272 +src_prepare() {
273 + # Do NOT add patches here
274 + local PATCHES=()
275 +
276 + [[ -d "${WORKDIR}"/patches ]] && PATCHES+=( "${WORKDIR}"/patches )
277 +
278 + # Add local patches here
279 + PATCHES+=(
280 + )
281 +
282 + if ! use vanilla; then
283 + PATCHES+=(
284 + "${FILESDIR}/gentoo-generator-path-r2.patch"
285 + "${FILESDIR}/gentoo-systemctl-disable-sysv-sync-r1.patch"
286 + "${FILESDIR}/gentoo-journald-audit.patch"
287 + )
288 + fi
289 +
290 + default
291 +}
292 +
293 +src_configure() {
294 + # Prevent conflicts with i686 cross toolchain, bug 559726
295 + tc-export AR CC NM OBJCOPY RANLIB
296 +
297 + # Broken with FORTIFY_SOURCE=3 without a patch. And the patch
298 + # wasn't backported to 250.x, but it turns out to break Clang
299 + # anyway: bug #841770.
300 + #
301 + # Our toolchain sets F_S=2 by default w/ >= -O2, so we need
302 + # to unset F_S first, then explicitly set 2, to negate any default
303 + # and anything set by the user if they're choosing 3 (or if they've
304 + # modified GCC to set 3).
305 + #
306 + if is-flagq '-O[23]' || is-flagq '-Ofast' ; then
307 + # We can't unconditionally do this b/c we fortify needs
308 + # some level of optimisation.
309 + filter-flags -D_FORTIFY_SOURCE=3
310 + append-cppflags -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2
311 + fi
312 +
313 + python_setup
314 +
315 + multilib-minimal_src_configure
316 +}
317 +
318 +multilib_src_configure() {
319 + local myconf=(
320 + --localstatedir="${EPREFIX}/var"
321 + -Dsupport-url="https://gentoo.org/support/"
322 + -Dpamlibdir="$(getpam_mod_dir)"
323 + # avoid bash-completion dep
324 + -Dbashcompletiondir="$(get_bashcompdir)"
325 + # make sure we get /bin:/sbin in PATH
326 + $(meson_use split-usr)
327 + -Dsplit-bin=true
328 + -Drootprefix="$(usex split-usr "${EPREFIX:-/}" "${EPREFIX}/usr")"
329 + -Drootlibdir="${EPREFIX}/usr/$(get_libdir)"
330 + # Avoid infinite exec recursion, bug 642724
331 + -Dtelinit-path="${EPREFIX}/lib/sysvinit/telinit"
332 + # no deps
333 + -Dima=true
334 + -Ddefault-hierarchy=$(usex cgroup-hybrid hybrid unified)
335 + # Optional components/dependencies
336 + $(meson_native_use_bool acl)
337 + $(meson_native_use_bool apparmor)
338 + $(meson_native_use_bool audit)
339 + $(meson_native_use_bool cryptsetup libcryptsetup)
340 + $(meson_native_use_bool curl libcurl)
341 + $(meson_native_use_bool dns-over-tls dns-over-tls)
342 + $(meson_native_use_bool elfutils)
343 + $(meson_native_use_bool fido2 libfido2)
344 + $(meson_use gcrypt)
345 + $(meson_native_use_bool gnuefi gnu-efi)
346 + $(meson_native_use_bool gnutls)
347 + -Defi-includedir="${ESYSROOT}/usr/include/efi"
348 + -Defi-libdir="${ESYSROOT}/usr/$(get_libdir)"
349 + $(meson_native_use_bool homed)
350 + $(meson_native_use_bool http microhttpd)
351 + $(meson_native_use_bool idn)
352 + $(meson_native_use_bool importd)
353 + $(meson_native_use_bool importd bzip2)
354 + $(meson_native_use_bool importd zlib)
355 + $(meson_native_use_bool kmod)
356 + $(meson_use lz4)
357 + $(meson_use lzma xz)
358 + $(meson_use zstd)
359 + $(meson_native_use_bool nat libiptc)
360 + $(meson_native_use_bool openssl)
361 + $(meson_use pam)
362 + $(meson_native_use_bool pkcs11 p11kit)
363 + $(meson_native_use_bool pcre pcre2)
364 + $(meson_native_use_bool policykit polkit)
365 + $(meson_native_use_bool pwquality)
366 + $(meson_native_use_bool qrcode qrencode)
367 + $(meson_native_use_bool seccomp)
368 + $(meson_native_use_bool selinux)
369 + $(meson_native_use_bool tpm tpm2)
370 + $(meson_native_use_bool test dbus)
371 + $(meson_native_use_bool xkb xkbcommon)
372 + -Dntp-servers="0.gentoo.pool.ntp.org 1.gentoo.pool.ntp.org 2.gentoo.pool.ntp.org 3.gentoo.pool.ntp.org"
373 + # Breaks screen, tmux, etc.
374 + -Ddefault-kill-user-processes=false
375 + -Dcreate-log-dirs=false
376 +
377 + # multilib options
378 + $(meson_native_true backlight)
379 + $(meson_native_true binfmt)
380 + $(meson_native_true coredump)
381 + $(meson_native_true environment-d)
382 + $(meson_native_true firstboot)
383 + $(meson_native_true hibernate)
384 + $(meson_native_true hostnamed)
385 + $(meson_native_true ldconfig)
386 + $(meson_native_true localed)
387 + $(meson_native_true man)
388 + $(meson_native_true networkd)
389 + $(meson_native_true quotacheck)
390 + $(meson_native_true randomseed)
391 + $(meson_native_true rfkill)
392 + $(meson_native_true sysusers)
393 + $(meson_native_true timedated)
394 + $(meson_native_true timesyncd)
395 + $(meson_native_true tmpfiles)
396 + $(meson_native_true vconsole)
397 + )
398 +
399 + meson_src_configure "${myconf[@]}"
400 +}
401 +
402 +multilib_src_test() {
403 + unset DBUS_SESSION_BUS_ADDRESS XDG_RUNTIME_DIR
404 + meson_src_test
405 +}
406 +
407 +multilib_src_install_all() {
408 + local rootprefix=$(usex split-usr '' /usr)
409 +
410 + # meson doesn't know about docdir
411 + mv "${ED}"/usr/share/doc/{systemd,${PF}} || die
412 +
413 + einstalldocs
414 + dodoc "${FILESDIR}"/nsswitch.conf
415 +
416 + if ! use resolvconf; then
417 + rm -f "${ED}${rootprefix}"/sbin/resolvconf || die
418 + fi
419 +
420 + rm "${ED}"/etc/init.d/README || die
421 + rm "${ED}${rootprefix}"/lib/systemd/system-generators/systemd-sysv-generator || die
422 +
423 + if ! use sysv-utils; then
424 + rm "${ED}${rootprefix}"/sbin/{halt,init,poweroff,reboot,runlevel,shutdown,telinit} || die
425 + rm "${ED}"/usr/share/man/man1/init.1 || die
426 + rm "${ED}"/usr/share/man/man8/{halt,poweroff,reboot,runlevel,shutdown,telinit}.8 || die
427 + fi
428 +
429 + if ! use resolvconf && ! use sysv-utils; then
430 + rmdir "${ED}${rootprefix}"/sbin || die
431 + fi
432 +
433 + # https://bugs.gentoo.org/761763
434 + rm -r "${ED}"/usr/lib/sysusers.d || die
435 +
436 + # Preserve empty dirs in /etc & /var, bug #437008
437 + keepdir /etc/{binfmt.d,modules-load.d,tmpfiles.d}
438 + keepdir /etc/kernel/install.d
439 + keepdir /etc/systemd/{network,system,user}
440 + keepdir /etc/udev/rules.d
441 +
442 + keepdir /etc/udev/hwdb.d
443 +
444 + keepdir "${rootprefix}"/lib/systemd/{system-sleep,system-shutdown}
445 + keepdir /usr/lib/{binfmt.d,modules-load.d}
446 + keepdir /usr/lib/systemd/user-generators
447 + keepdir /var/lib/systemd
448 + keepdir /var/log/journal
449 +
450 + # Symlink /etc/sysctl.conf for easy migration.
451 + dosym ../../../etc/sysctl.conf /usr/lib/sysctl.d/99-sysctl.conf
452 +
453 + if use pam; then
454 + newpamd "${FILESDIR}"/systemd-user.pam systemd-user
455 + fi
456 +
457 + if use split-usr; then
458 + # Avoid breaking boot/reboot
459 + dosym ../../../lib/systemd/systemd /usr/lib/systemd/systemd
460 + dosym ../../../lib/systemd/systemd-shutdown /usr/lib/systemd/systemd-shutdown
461 + fi
462 +
463 + # workaround for https://github.com/systemd/systemd/issues/13501
464 + if use hostnamed-fallback; then
465 + # this file requires dbus-broker
466 + insinto /usr/share/dbus-1/system.d/
467 + doins "${FILESDIR}/org.freedesktop.hostname1_no_polkit.conf"
468 +
469 + insinto "${rootprefix}/lib/systemd/system/systemd-hostnamed.service.d/"
470 + doins "${FILESDIR}/00-hostnamed-network-user.conf"
471 + fi
472 +
473 + gen_usr_ldscript -a systemd udev
474 +}
475 +
476 +migrate_locale() {
477 + local envd_locale_def="${EROOT}/etc/env.d/02locale"
478 + local envd_locale=( "${EROOT}"/etc/env.d/??locale )
479 + local locale_conf="${EROOT}/etc/locale.conf"
480 +
481 + if [[ ! -L ${locale_conf} && ! -e ${locale_conf} ]]; then
482 + # If locale.conf does not exist...
483 + if [[ -e ${envd_locale} ]]; then
484 + # ...either copy env.d/??locale if there's one
485 + ebegin "Moving ${envd_locale} to ${locale_conf}"
486 + mv "${envd_locale}" "${locale_conf}"
487 + eend ${?} || FAIL=1
488 + else
489 + # ...or create a dummy default
490 + ebegin "Creating ${locale_conf}"
491 + cat > "${locale_conf}" <<-EOF
492 + # This file has been created by the sys-apps/systemd ebuild.
493 + # See locale.conf(5) and localectl(1).
494 +
495 + # LANG=${LANG}
496 + EOF
497 + eend ${?} || FAIL=1
498 + fi
499 + fi
500 +
501 + if [[ ! -L ${envd_locale} ]]; then
502 + # now, if env.d/??locale is not a symlink (to locale.conf)...
503 + if [[ -e ${envd_locale} ]]; then
504 + # ...warn the user that he has duplicate locale settings
505 + ewarn
506 + ewarn "To ensure consistent behavior, you should replace ${envd_locale}"
507 + ewarn "with a symlink to ${locale_conf}. Please migrate your settings"
508 + ewarn "and create the symlink with the following command:"
509 + ewarn "ln -s -n -f ../locale.conf ${envd_locale}"
510 + ewarn
511 + else
512 + # ...or just create the symlink if there's nothing here
513 + ebegin "Creating ${envd_locale_def} -> ../locale.conf symlink"
514 + ln -n -s ../locale.conf "${envd_locale_def}"
515 + eend ${?} || FAIL=1
516 + fi
517 + fi
518 +}
519 +
520 +pkg_preinst() {
521 + if ! use split-usr; then
522 + local dir
523 + for dir in bin sbin lib; do
524 + if [[ ! ${EROOT}/${dir} -ef ${EROOT}/usr/${dir} ]]; then
525 + eerror "\"${EROOT}/${dir}\" and \"${EROOT}/usr/${dir}\" are not merged."
526 + eerror "One of them should be a symbolic link to the other one."
527 + FAIL=1
528 + fi
529 + done
530 + if [[ ${FAIL} ]]; then
531 + eerror "Migration to system layout with merged directories must be performed before"
532 + eerror "rebuilding ${CATEGORY}/${PN} with USE=\"-split-usr\" to avoid run-time breakage."
533 + die "System layout with split directories still used"
534 + fi
535 + fi
536 +}
537 +
538 +pkg_postinst() {
539 + systemd_update_catalog
540 +
541 + # Keep this here in case the database format changes so it gets updated
542 + # when required.
543 + systemd-hwdb --root="${ROOT}" update
544 +
545 + udev_reload || FAIL=1
546 +
547 + # Bug 465468, make sure locales are respected, and ensure consistency
548 + # between OpenRC & systemd
549 + migrate_locale
550 +
551 + if [[ -z ${REPLACING_VERSIONS} ]]; then
552 + if type systemctl &>/dev/null; then
553 + systemctl --root="${ROOT:-/}" enable getty@.service remote-fs.target || FAIL=1
554 + fi
555 + elog "To enable a useful set of services, run the following:"
556 + elog " systemctl preset-all --preset-mode=enable-only"
557 + fi
558 +
559 + if [[ -L ${EROOT}/var/lib/systemd/timesync ]]; then
560 + rm "${EROOT}/var/lib/systemd/timesync"
561 + fi
562 +
563 + if [[ ${FAIL} ]]; then
564 + eerror "One of the postinst commands failed. Please check the postinst output"
565 + eerror "for errors. You may need to clean up your system and/or try installing"
566 + eerror "systemd again."
567 + eerror
568 + fi
569 +
570 + if use hostnamed-fallback; then
571 + if ! systemctl --root="${ROOT:-/}" is-enabled --quiet dbus-broker.service 2>/dev/null; then
572 + ewarn "dbus-broker.service is not enabled, systemd-hostnamed will fail to run."
573 + ewarn "To enable dbus-broker.service run the next command as root:"
574 + ewarn "systemctl enable dbus-broker.service"
575 + fi
576 + fi
577 +}
578 +
579 +pkg_prerm() {
580 + # If removing systemd completely, remove the catalog database.
581 + if [[ ! ${REPLACED_BY_VERSION} ]]; then
582 + rm -f -v "${EROOT}"/var/lib/systemd/catalog/database
583 + fi
584 +}