Gentoo Archives: gentoo-commits

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