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