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