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