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