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/, sys-apps/systemd/files/
Date: Wed, 05 Feb 2020 18:24:05
Message-Id: 1580927034.7b8918d1047cd2b707ea43dc1d7afcceb761f789.floppym@gentoo
1 commit: 7b8918d1047cd2b707ea43dc1d7afcceb761f789
2 Author: Mike Gilbert <floppym <AT> gentoo <DOT> org>
3 AuthorDate: Wed Feb 5 18:23:54 2020 +0000
4 Commit: Mike Gilbert <floppym <AT> gentoo <DOT> org>
5 CommitDate: Wed Feb 5 18:23:54 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7b8918d1
7
8 sys-apps/systemd: bump to 245-rc1
9
10 Package-Manager: Portage-2.3.86_p1, Repoman-2.3.20_p43
11 Signed-off-by: Mike Gilbert <floppym <AT> gentoo.org>
12
13 sys-apps/systemd/Manifest | 1 +
14 sys-apps/systemd/files/245-rc1-network-debug.patch | 45 ++
15 sys-apps/systemd/systemd-245_rc1.ebuild | 500 +++++++++++++++++++++
16 3 files changed, 546 insertions(+)
17
18 diff --git a/sys-apps/systemd/Manifest b/sys-apps/systemd/Manifest
19 index ca6af94c9ac..447ac0b12db 100644
20 --- a/sys-apps/systemd/Manifest
21 +++ b/sys-apps/systemd/Manifest
22 @@ -1,2 +1,3 @@
23 DIST systemd-243.tar.gz 8242522 BLAKE2B 89e3ebbea5a99061329f7c78220a66c1e075d5ba90dfdf5ee8d0d9b762ef4600dc82d8ca2054632e5e343b6272cd8046c92f7f99dcfa8287c5ef2b42fb96d4cb SHA512 56b52a297aa5ac04d9667eb3afb1598725b197de73ff72baa1aabbc2844e36fba7b7fccdf6d214ae8b5b926616b2b7e15772763aaa80ec938d74333ff9c8673e
24 DIST systemd-244.tar.gz 8445963 BLAKE2B 19751fb9c058a079694ee1b991259fd3f1fa30ae98ca38bbe8caadfc5628db7848c7f742a1b11781fbd67f911adda917d7a4da1dddb63064907f86f47e5a3256 SHA512 08f260fb15b5eb273faafda826dd9154e9a02841b4c5911cc1c7e1445072ad51389f8cced7b9acf112737c20fd56b2fbf48b3f914733c934c774d38a23b616fb
25 +DIST systemd-245-rc1.tar.gz 8961356 BLAKE2B ed04166ead57c2f1cc1a1ca2f0041cae134b503d3448ea9fdd799e12d81f45721ee304d4aabd96d3eab8ea1321b283820e8d2a850b41733e40f07fd419f67b95 SHA512 2ef9a295f3897c6642a2fac2e3c73467ece9bc6fc196cc4f3707b9c23af2581eb9f74def78909d57513b67604bf1cf6dc5dbb31c6d435f7997677d09a73d006b
26
27 diff --git a/sys-apps/systemd/files/245-rc1-network-debug.patch b/sys-apps/systemd/files/245-rc1-network-debug.patch
28 new file mode 100644
29 index 00000000000..e65035f2185
30 --- /dev/null
31 +++ b/sys-apps/systemd/files/245-rc1-network-debug.patch
32 @@ -0,0 +1,45 @@
33 +From 01ec0028d97fa97d2e433659e24a1517b0e2382e Mon Sep 17 00:00:00 2001
34 +From: Mike Gilbert <floppym@g.o>
35 +Date: Wed, 5 Feb 2020 11:04:50 -0500
36 +Subject: [PATCH] network: remove unnecessary link->ifname from debug log
37 + statements
38 +
39 +Since 98b0299479a68ffd414888368907fc776a46b82a, we log the interface
40 +name automatically via log_link_debug().
41 +
42 +Fixes: https://github.com/systemd/systemd/issues/14782
43 +---
44 + src/network/networkd-dhcp-server.c | 6 +++---
45 + 1 file changed, 3 insertions(+), 3 deletions(-)
46 +
47 +diff --git a/src/network/networkd-dhcp-server.c b/src/network/networkd-dhcp-server.c
48 +index a6dbe2e596c..bee75a6930e 100644
49 +--- a/src/network/networkd-dhcp-server.c
50 ++++ b/src/network/networkd-dhcp-server.c
51 +@@ -45,7 +45,7 @@ static int link_push_uplink_dns_to_dhcp_server(Link *link, sd_dhcp_server *s) {
52 + size_t n_addresses = 0, n_allocated = 0;
53 + unsigned i;
54 +
55 +- log_link_debug(link, "Copying DNS server information from %s", link->ifname);
56 ++ log_link_debug(link, "Copying DNS server information from link");
57 +
58 + if (!link->network)
59 + return 0;
60 +@@ -99,7 +99,7 @@ static int link_push_uplink_ntp_to_dhcp_server(Link *link, sd_dhcp_server *s) {
61 + if (!link->network)
62 + return 0;
63 +
64 +- log_link_debug(link, "Copying NTP server information from %s", link->ifname);
65 ++ log_link_debug(link, "Copying NTP server information from link");
66 +
67 + STRV_FOREACH(a, link->network->ntp) {
68 + union in_addr_union ia;
69 +@@ -148,7 +148,7 @@ static int link_push_uplink_sip_to_dhcp_server(Link *link, sd_dhcp_server *s) {
70 + if (!link->network)
71 + return 0;
72 +
73 +- log_link_debug(link, "Copying SIP server information from %s", link->ifname);
74 ++ log_link_debug(link, "Copying SIP server information from link");
75 +
76 + STRV_FOREACH(a, link->network->sip) {
77 + union in_addr_union ia;
78
79 diff --git a/sys-apps/systemd/systemd-245_rc1.ebuild b/sys-apps/systemd/systemd-245_rc1.ebuild
80 new file mode 100644
81 index 00000000000..7bb75c3ee62
82 --- /dev/null
83 +++ b/sys-apps/systemd/systemd-245_rc1.ebuild
84 @@ -0,0 +1,500 @@
85 +# Copyright 2011-2020 Gentoo Authors
86 +# Distributed under the terms of the GNU General Public License v2
87 +
88 +EAPI=7
89 +
90 +if [[ ${PV} == 9999 ]]; then
91 + EGIT_REPO_URI="https://github.com/systemd/systemd.git"
92 + inherit git-r3
93 +else
94 + MY_PV=${PV/_/-}
95 + MY_P=${PN}-${MY_PV}
96 + S=${WORKDIR}/${MY_P}
97 + SRC_URI="https://github.com/systemd/systemd/archive/v${MY_PV}/${MY_P}.tar.gz"
98 + KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86"
99 +fi
100 +
101 +PYTHON_COMPAT=( python{3_6,3_7} )
102 +
103 +inherit bash-completion-r1 linux-info meson multilib-minimal ninja-utils pam python-any-r1 systemd toolchain-funcs udev usr-ldscript
104 +
105 +DESCRIPTION="System and service manager for Linux"
106 +HOMEPAGE="https://www.freedesktop.org/wiki/Software/systemd"
107 +
108 +LICENSE="GPL-2 LGPL-2.1 MIT public-domain"
109 +SLOT="0/2"
110 +IUSE="acl apparmor audit build cgroup-hybrid cryptsetup curl dns-over-tls elfutils +gcrypt gnuefi http idn importd +kmod +lz4 lzma nat pam pcre policykit qrcode +resolvconf +seccomp selinux split-usr static-libs +sysv-utils test vanilla xkb"
111 +
112 +REQUIRED_USE="importd? ( curl gcrypt lzma )"
113 +RESTRICT="!test? ( test )"
114 +
115 +MINKV="3.11"
116 +
117 +COMMON_DEPEND=">=sys-apps/util-linux-2.30:0=[${MULTILIB_USEDEP}]
118 + sys-libs/libcap:0=[${MULTILIB_USEDEP}]
119 + !<sys-libs/glibc-2.16
120 + acl? ( sys-apps/acl:0= )
121 + apparmor? ( sys-libs/libapparmor:0= )
122 + audit? ( >=sys-process/audit-2:0= )
123 + cryptsetup? ( >=sys-fs/cryptsetup-2.0.1:0= )
124 + curl? ( net-misc/curl:0= )
125 + dns-over-tls? ( >=net-libs/gnutls-3.5.3:0= )
126 + elfutils? ( >=dev-libs/elfutils-0.158:0= )
127 + gcrypt? ( >=dev-libs/libgcrypt-1.4.5:0=[${MULTILIB_USEDEP}] )
128 + http? (
129 + >=net-libs/libmicrohttpd-0.9.33:0=[epoll(+)]
130 + >=net-libs/gnutls-3.1.4:0=
131 + )
132 + idn? ( net-dns/libidn2:= )
133 + importd? (
134 + app-arch/bzip2:0=
135 + sys-libs/zlib:0=
136 + )
137 + kmod? ( >=sys-apps/kmod-15:0= )
138 + lz4? ( >=app-arch/lz4-0_p131:0=[${MULTILIB_USEDEP}] )
139 + lzma? ( >=app-arch/xz-utils-5.0.5-r1:0=[${MULTILIB_USEDEP}] )
140 + nat? ( net-firewall/iptables:0= )
141 + pam? ( sys-libs/pam:=[${MULTILIB_USEDEP}] )
142 + pcre? ( dev-libs/libpcre2 )
143 + qrcode? ( media-gfx/qrencode:0= )
144 + seccomp? ( >=sys-libs/libseccomp-2.3.3:0= )
145 + selinux? ( sys-libs/libselinux:0= )
146 + xkb? ( >=x11-libs/libxkbcommon-0.4.1:0= )"
147 +
148 +# Newer linux-headers needed by ia64, bug #480218
149 +DEPEND="${COMMON_DEPEND}
150 + >=sys-kernel/linux-headers-${MINKV}
151 + gnuefi? ( >=sys-boot/gnu-efi-3.0.2 )
152 +"
153 +
154 +# baselayout-2.2 has /run
155 +RDEPEND="${COMMON_DEPEND}
156 + acct-group/adm
157 + acct-group/wheel
158 + acct-group/kmem
159 + acct-group/tty
160 + acct-group/utmp
161 + acct-group/audio
162 + acct-group/cdrom
163 + acct-group/dialout
164 + acct-group/disk
165 + acct-group/input
166 + acct-group/kvm
167 + acct-group/render
168 + acct-group/tape
169 + acct-group/video
170 + acct-group/systemd-journal
171 + acct-user/systemd-journal-remote
172 + acct-user/systemd-coredump
173 + acct-user/systemd-network
174 + acct-user/systemd-resolve
175 + acct-user/systemd-timesync
176 + >=sys-apps/baselayout-2.2
177 + selinux? ( sec-policy/selinux-base-policy[systemd] )
178 + sysv-utils? ( !sys-apps/sysvinit )
179 + !sysv-utils? ( sys-apps/sysvinit )
180 + resolvconf? ( !net-dns/openresolv )
181 + !build? ( || (
182 + sys-apps/util-linux[kill(-)]
183 + sys-process/procps[kill(+)]
184 + sys-apps/coreutils[kill(-)]
185 + ) )
186 + !sys-auth/nss-myhostname
187 + !<sys-kernel/dracut-044
188 + !sys-fs/eudev
189 + !sys-fs/udev
190 +"
191 +
192 +# sys-apps/dbus: the daemon only (+ build-time lib dep for tests)
193 +PDEPEND=">=sys-apps/dbus-1.9.8[systemd]
194 + >=sys-apps/hwids-20150417[udev]
195 + >=sys-fs/udev-init-scripts-25
196 + policykit? ( sys-auth/polkit )
197 + !vanilla? ( sys-apps/gentoo-systemd-integration )"
198 +
199 +BDEPEND="
200 + app-arch/xz-utils:0
201 + dev-util/gperf
202 + >=dev-util/meson-0.46
203 + >=dev-util/intltool-0.50
204 + >=sys-apps/coreutils-8.16
205 + sys-devel/m4
206 + virtual/pkgconfig[${MULTILIB_USEDEP}]
207 + test? ( sys-apps/dbus )
208 + app-text/docbook-xml-dtd:4.2
209 + app-text/docbook-xml-dtd:4.5
210 + app-text/docbook-xsl-stylesheets
211 + dev-libs/libxslt:0
212 + $(python_gen_any_dep 'dev-python/lxml[${PYTHON_USEDEP}]')
213 +"
214 +
215 +pkg_pretend() {
216 + if [[ ${MERGE_TYPE} != buildonly ]]; then
217 + if use test && has pid-sandbox ${FEATURES}; then
218 + ewarn "Tests are known to fail with PID sandboxing enabled."
219 + ewarn "See https://bugs.gentoo.org/674458."
220 + fi
221 +
222 + local CONFIG_CHECK="~AUTOFS4_FS ~BLK_DEV_BSG ~CGROUPS
223 + ~CHECKPOINT_RESTORE ~DEVTMPFS ~EPOLL ~FANOTIFY ~FHANDLE
224 + ~INOTIFY_USER ~IPV6 ~NET ~NET_NS ~PROC_FS ~SIGNALFD ~SYSFS
225 + ~TIMERFD ~TMPFS_XATTR ~UNIX
226 + ~CRYPTO_HMAC ~CRYPTO_SHA256 ~CRYPTO_USER_API_HASH
227 + ~!FW_LOADER_USER_HELPER_FALLBACK ~!GRKERNSEC_PROC ~!IDE ~!SYSFS_DEPRECATED
228 + ~!SYSFS_DEPRECATED_V2"
229 +
230 + use acl && CONFIG_CHECK+=" ~TMPFS_POSIX_ACL"
231 + use seccomp && CONFIG_CHECK+=" ~SECCOMP ~SECCOMP_FILTER"
232 + kernel_is -lt 3 7 && CONFIG_CHECK+=" ~HOTPLUG"
233 + kernel_is -lt 4 7 && CONFIG_CHECK+=" ~DEVPTS_MULTIPLE_INSTANCES"
234 + kernel_is -ge 4 10 && CONFIG_CHECK+=" ~CGROUP_BPF"
235 +
236 + if linux_config_exists; then
237 + local uevent_helper_path=$(linux_chkconfig_string UEVENT_HELPER_PATH)
238 + if [[ -n ${uevent_helper_path} ]] && [[ ${uevent_helper_path} != '""' ]]; then
239 + ewarn "It's recommended to set an empty value to the following kernel config option:"
240 + ewarn "CONFIG_UEVENT_HELPER_PATH=${uevent_helper_path}"
241 + fi
242 + if linux_chkconfig_present X86; then
243 + CONFIG_CHECK+=" ~DMIID"
244 + fi
245 + fi
246 +
247 + if kernel_is -lt ${MINKV//./ }; then
248 + ewarn "Kernel version at least ${MINKV} required"
249 + fi
250 +
251 + check_extra_config
252 + fi
253 +}
254 +
255 +pkg_setup() {
256 + :
257 +}
258 +
259 +src_unpack() {
260 + default
261 + [[ ${PV} != 9999 ]] || git-r3_src_unpack
262 +}
263 +
264 +src_prepare() {
265 + # Do NOT add patches here
266 + local PATCHES=()
267 +
268 + [[ -d "${WORKDIR}"/patches ]] && PATCHES+=( "${WORKDIR}"/patches )
269 +
270 + # Add local patches here
271 + PATCHES+=(
272 + "${FILESDIR}"/245-rc1-network-debug.patch
273 + )
274 +
275 + if ! use vanilla; then
276 + PATCHES+=(
277 + "${FILESDIR}/gentoo-Dont-enable-audit-by-default.patch"
278 + "${FILESDIR}/gentoo-systemd-user-pam.patch"
279 + "${FILESDIR}/gentoo-generator-path-r1.patch"
280 + )
281 + fi
282 +
283 + default
284 +}
285 +
286 +src_configure() {
287 + # Prevent conflicts with i686 cross toolchain, bug 559726
288 + tc-export AR CC NM OBJCOPY RANLIB
289 +
290 + python_setup
291 +
292 + multilib-minimal_src_configure
293 +}
294 +
295 +meson_use() {
296 + usex "$1" true false
297 +}
298 +
299 +meson_multilib() {
300 + if multilib_is_native_abi; then
301 + echo true
302 + else
303 + echo false
304 + fi
305 +}
306 +
307 +meson_multilib_native_use() {
308 + if multilib_is_native_abi && use "$1"; then
309 + echo true
310 + else
311 + echo false
312 + fi
313 +}
314 +
315 +multilib_src_configure() {
316 + local myconf=(
317 + --localstatedir="${EPREFIX}/var"
318 + -Dsupport-url="https://gentoo.org/support/"
319 + -Dpamlibdir="$(getpam_mod_dir)"
320 + # avoid bash-completion dep
321 + -Dbashcompletiondir="$(get_bashcompdir)"
322 + # make sure we get /bin:/sbin in PATH
323 + -Dsplit-usr=$(usex split-usr true false)
324 + -Dsplit-bin=true
325 + -Drootprefix="$(usex split-usr "${EPREFIX:-/}" "${EPREFIX}/usr")"
326 + -Drootlibdir="${EPREFIX}/usr/$(get_libdir)"
327 + -Dsysvinit-path=
328 + -Dsysvrcnd-path=
329 + # Avoid infinite exec recursion, bug 642724
330 + -Dtelinit-path="${EPREFIX}/lib/sysvinit/telinit"
331 + # no deps
332 + -Dima=true
333 + -Ddefault-hierarchy=$(usex cgroup-hybrid hybrid unified)
334 + # Optional components/dependencies
335 + -Dacl=$(meson_multilib_native_use acl)
336 + -Dapparmor=$(meson_multilib_native_use apparmor)
337 + -Daudit=$(meson_multilib_native_use audit)
338 + -Dlibcryptsetup=$(meson_multilib_native_use cryptsetup)
339 + -Dlibcurl=$(meson_multilib_native_use curl)
340 + -Ddns-over-tls=$(meson_multilib_native_use dns-over-tls)
341 + -Delfutils=$(meson_multilib_native_use elfutils)
342 + -Dgcrypt=$(meson_use gcrypt)
343 + -Dgnu-efi=$(meson_multilib_native_use gnuefi)
344 + -Defi-libdir="${ESYSROOT}/usr/$(get_libdir)"
345 + -Dmicrohttpd=$(meson_multilib_native_use http)
346 + -Didn=$(meson_multilib_native_use idn)
347 + -Dimportd=$(meson_multilib_native_use importd)
348 + -Dbzip2=$(meson_multilib_native_use importd)
349 + -Dzlib=$(meson_multilib_native_use importd)
350 + -Dkmod=$(meson_multilib_native_use kmod)
351 + -Dlz4=$(meson_use lz4)
352 + -Dxz=$(meson_use lzma)
353 + -Dlibiptc=$(meson_multilib_native_use nat)
354 + -Dpam=$(meson_use pam)
355 + -Dpcre2=$(meson_multilib_native_use pcre)
356 + -Dpolkit=$(meson_multilib_native_use policykit)
357 + -Dqrencode=$(meson_multilib_native_use qrcode)
358 + -Dseccomp=$(meson_multilib_native_use seccomp)
359 + -Dselinux=$(meson_multilib_native_use selinux)
360 + -Ddbus=$(meson_multilib_native_use test)
361 + -Dxkbcommon=$(meson_multilib_native_use xkb)
362 + -Dntp-servers="0.gentoo.pool.ntp.org 1.gentoo.pool.ntp.org 2.gentoo.pool.ntp.org 3.gentoo.pool.ntp.org"
363 + # Breaks screen, tmux, etc.
364 + -Ddefault-kill-user-processes=false
365 + -Dcreate-log-dirs=false
366 +
367 + # multilib options
368 + -Dbacklight=$(meson_multilib)
369 + -Dbinfmt=$(meson_multilib)
370 + -Dcoredump=$(meson_multilib)
371 + -Denvironment-d=$(meson_multilib)
372 + -Dfirstboot=$(meson_multilib)
373 + -Dhibernate=$(meson_multilib)
374 + -Dhostnamed=$(meson_multilib)
375 + -Dhwdb=$(meson_multilib)
376 + -Dldconfig=$(meson_multilib)
377 + -Dlocaled=$(meson_multilib)
378 + -Dman=$(meson_multilib)
379 + -Dnetworkd=$(meson_multilib)
380 + -Dquotacheck=$(meson_multilib)
381 + -Drandomseed=$(meson_multilib)
382 + -Drfkill=$(meson_multilib)
383 + -Dsysusers=$(meson_multilib)
384 + -Dtimedated=$(meson_multilib)
385 + -Dtimesyncd=$(meson_multilib)
386 + -Dtmpfiles=$(meson_multilib)
387 + -Dvconsole=$(meson_multilib)
388 +
389 + # static-libs
390 + -Dstatic-libsystemd=$(usex static-libs true false)
391 + -Dstatic-libudev=$(usex static-libs true false)
392 + )
393 +
394 + meson_src_configure "${myconf[@]}"
395 +}
396 +
397 +multilib_src_compile() {
398 + eninja
399 +}
400 +
401 +multilib_src_test() {
402 + unset DBUS_SESSION_BUS_ADDRESS XDG_RUNTIME_DIR
403 + meson_src_test
404 +}
405 +
406 +multilib_src_install() {
407 + DESTDIR="${D}" eninja install
408 +}
409 +
410 +multilib_src_install_all() {
411 + local rootprefix=$(usex split-usr '' /usr)
412 +
413 + # meson doesn't know about docdir
414 + mv "${ED}"/usr/share/doc/{systemd,${PF}} || die
415 +
416 + einstalldocs
417 + dodoc "${FILESDIR}"/nsswitch.conf
418 +
419 + if ! use resolvconf; then
420 + rm -f "${ED}${rootprefix}"/sbin/resolvconf || die
421 + fi
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 + # Preserve empty dirs in /etc & /var, bug #437008
434 + keepdir /etc/{binfmt.d,modules-load.d,tmpfiles.d}
435 + keepdir /etc/kernel/install.d
436 + keepdir /etc/systemd/{network,system,user}
437 + keepdir /etc/udev/{hwdb.d,rules.d}
438 + keepdir "${rootprefix}"/lib/systemd/{system-sleep,system-shutdown}
439 + keepdir /usr/lib/{binfmt.d,modules-load.d}
440 + keepdir /usr/lib/systemd/user-generators
441 + keepdir /var/lib/systemd
442 + keepdir /var/log/journal
443 +
444 + # Symlink /etc/sysctl.conf for easy migration.
445 + dosym ../sysctl.conf /etc/sysctl.d/99-sysctl.conf
446 +
447 + rm -r "${ED}${rootprefix}"/lib/udev/hwdb.d || die
448 +
449 + if use split-usr; then
450 + # Avoid breaking boot/reboot
451 + dosym ../../../lib/systemd/systemd /usr/lib/systemd/systemd
452 + dosym ../../../lib/systemd/systemd-shutdown /usr/lib/systemd/systemd-shutdown
453 + fi
454 +
455 + gen_usr_ldscript -a systemd udev
456 +}
457 +
458 +migrate_locale() {
459 + local envd_locale_def="${EROOT}/etc/env.d/02locale"
460 + local envd_locale=( "${EROOT}"/etc/env.d/??locale )
461 + local locale_conf="${EROOT}/etc/locale.conf"
462 +
463 + if [[ ! -L ${locale_conf} && ! -e ${locale_conf} ]]; then
464 + # If locale.conf does not exist...
465 + if [[ -e ${envd_locale} ]]; then
466 + # ...either copy env.d/??locale if there's one
467 + ebegin "Moving ${envd_locale} to ${locale_conf}"
468 + mv "${envd_locale}" "${locale_conf}"
469 + eend ${?} || FAIL=1
470 + else
471 + # ...or create a dummy default
472 + ebegin "Creating ${locale_conf}"
473 + cat > "${locale_conf}" <<-EOF
474 + # This file has been created by the sys-apps/systemd ebuild.
475 + # See locale.conf(5) and localectl(1).
476 +
477 + # LANG=${LANG}
478 + EOF
479 + eend ${?} || FAIL=1
480 + fi
481 + fi
482 +
483 + if [[ ! -L ${envd_locale} ]]; then
484 + # now, if env.d/??locale is not a symlink (to locale.conf)...
485 + if [[ -e ${envd_locale} ]]; then
486 + # ...warn the user that he has duplicate locale settings
487 + ewarn
488 + ewarn "To ensure consistent behavior, you should replace ${envd_locale}"
489 + ewarn "with a symlink to ${locale_conf}. Please migrate your settings"
490 + ewarn "and create the symlink with the following command:"
491 + ewarn "ln -s -n -f ../locale.conf ${envd_locale}"
492 + ewarn
493 + else
494 + # ...or just create the symlink if there's nothing here
495 + ebegin "Creating ${envd_locale_def} -> ../locale.conf symlink"
496 + ln -n -s ../locale.conf "${envd_locale_def}"
497 + eend ${?} || FAIL=1
498 + fi
499 + fi
500 +}
501 +
502 +save_enabled_units() {
503 + ENABLED_UNITS=()
504 + type systemctl &>/dev/null || return
505 + for x; do
506 + if systemctl --quiet --root="${ROOT:-/}" is-enabled "${x}"; then
507 + ENABLED_UNITS+=( "${x}" )
508 + fi
509 + done
510 +}
511 +
512 +pkg_preinst() {
513 + save_enabled_units {machines,remote-{cryptsetup,fs}}.target getty@××××.service
514 +
515 + if ! use split-usr; then
516 + local dir
517 + for dir in bin sbin lib; do
518 + if [[ ! ${EROOT}/${dir} -ef ${EROOT}/usr/${dir} ]]; then
519 + eerror "\"${EROOT}/${dir}\" and \"${EROOT}/usr/${dir}\" are not merged."
520 + eerror "One of them should be a symbolic link to the other one."
521 + FAIL=1
522 + fi
523 + done
524 + if [[ ${FAIL} ]]; then
525 + eerror "Migration to system layout with merged directories must be performed before"
526 + eerror "rebuilding ${CATEGORY}/${PN} with USE=\"-split-usr\" to avoid run-time breakage."
527 + die "System layout with split directories still used"
528 + fi
529 + fi
530 +}
531 +
532 +pkg_postinst() {
533 + systemd_update_catalog
534 +
535 + # Keep this here in case the database format changes so it gets updated
536 + # when required. Despite that this file is owned by sys-apps/hwids.
537 + if has_version "sys-apps/hwids[udev]"; then
538 + udevadm hwdb --update --root="${EROOT}"
539 + fi
540 +
541 + udev_reload || FAIL=1
542 +
543 + # Bug 465468, make sure locales are respect, and ensure consistency
544 + # between OpenRC & systemd
545 + migrate_locale
546 +
547 + systemd_reenable systemd-networkd.service systemd-resolved.service
548 +
549 + if [[ ${ENABLED_UNITS[@]} ]]; then
550 + systemctl --root="${ROOT:-/}" enable "${ENABLED_UNITS[@]}"
551 + fi
552 +
553 + if [[ -z ${REPLACING_VERSIONS} ]]; then
554 + if type systemctl &>/dev/null; then
555 + systemctl --root="${ROOT:-/}" enable getty@.service remote-fs.target || FAIL=1
556 + fi
557 + elog "To enable a useful set of services, run the following:"
558 + elog " systemctl preset-all --preset-mode=enable-only"
559 + fi
560 +
561 + if [[ -L ${EROOT}/var/lib/systemd/timesync ]]; then
562 + rm "${EROOT}/var/lib/systemd/timesync"
563 + fi
564 +
565 + if [[ -z ${ROOT} && -d /run/systemd/system ]]; then
566 + ebegin "Reexecuting system manager"
567 + systemctl daemon-reexec
568 + eend $?
569 + fi
570 +
571 + if [[ ${FAIL} ]]; then
572 + eerror "One of the postinst commands failed. Please check the postinst output"
573 + eerror "for errors. You may need to clean up your system and/or try installing"
574 + eerror "systemd again."
575 + eerror
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 +}