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