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: Mon, 17 Aug 2020 01:50:38
Message-Id: 1597628790.e434e157c5629d4e200126d5f3f3565306698cc0.floppym@gentoo
1 commit: e434e157c5629d4e200126d5f3f3565306698cc0
2 Author: Mike Gilbert <floppym <AT> gentoo <DOT> org>
3 AuthorDate: Mon Aug 17 01:45:53 2020 +0000
4 Commit: Mike Gilbert <floppym <AT> gentoo <DOT> org>
5 CommitDate: Mon Aug 17 01:46:30 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e434e157
7
8 sys-apps/systemd: bump to 245.7
9
10 Bug: https://bugs.gentoo.org/737450
11 Signed-off-by: Mike Gilbert <floppym <AT> gentoo.org>
12
13 sys-apps/systemd/Manifest | 1 +
14 sys-apps/systemd/systemd-245.7.ebuild | 526 ++++++++++++++++++++++++++++++++++
15 2 files changed, 527 insertions(+)
16
17 diff --git a/sys-apps/systemd/Manifest b/sys-apps/systemd/Manifest
18 index 35330769561..176014c52ae 100644
19 --- a/sys-apps/systemd/Manifest
20 +++ b/sys-apps/systemd/Manifest
21 @@ -1,3 +1,4 @@
22 DIST systemd-246.tar.gz 9534036 BLAKE2B 71b72abcd4d066d35d45d9835d41bec8faa9a7eddc80b48fe7073223f07d32f78a8442c52dc0800940f9750d9c5502123a633738981d797cf610d85df2035bf0 SHA512 7103f7da53f7ced3b5543c238f23bd11c82af8e37166c1720a90576b6b431b4329320c78726166c65a9f5e101dd465c0a86dd13c586c4e55e608a6273d8f324f
23 DIST systemd-stable-244.3.tar.gz 8484735 BLAKE2B 25125ecdae59c852e8ceb45b7ed0b76631b301ab4026c4e389c4bc12090fe41f5918411a75bd20f38b6b3993445df93c850ba98f8d9b30fd24fc4e25f8355a3d SHA512 f8e83fa3e57ac8fdbed61b66bb45fd0eafa6fb36eda26f10690d93f34b03daab6ce4e7eff45b79dcaf59f11f41c1b022d1d9314f576c50ad28f6bb5901f1b18d
24 DIST systemd-stable-245.5.tar.gz 9020836 BLAKE2B 7753eecceffa86c9208c3e71df2037b58b445f9090b73c6ff499b4170b94488a1fd1cabcd17cbb98506a692875a3eef07a40a54d23e09c331a01319f8d03d13d SHA512 47de4a59980643002f325c499eeb4dd76fa9f1d1267686e7564f103690487bf85974590d7cb3e3641409e5bfba567fe2a66efa80320e7e8adc48af4461e2e172
25 +DIST systemd-stable-245.7.tar.gz 9171465 BLAKE2B 77117360155ef6358244a382ebd521fe180d8dd982cc2edda18790105933cd5e8880030572eb50d5405b9afdab519b06e0721f48c57394d3d1043a123169ccb1 SHA512 306b3a9cd1d8985a05be259f8a08efb5e9f7102a657eccdef58e082822b61a6e82246dc4f3b6e0bd33eedbd550af54e0029af9d0d2b70416e27626ec43921449
26
27 diff --git a/sys-apps/systemd/systemd-245.7.ebuild b/sys-apps/systemd/systemd-245.7.ebuild
28 new file mode 100644
29 index 00000000000..586484176c7
30 --- /dev/null
31 +++ b/sys-apps/systemd/systemd-245.7.ebuild
32 @@ -0,0 +1,526 @@
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
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-generator-path-r1.patch"
241 + "${FILESDIR}/gentoo-systemctl-disable-sysv-sync.patch"
242 + )
243 + fi
244 +
245 + default
246 +}
247 +
248 +src_configure() {
249 + # Prevent conflicts with i686 cross toolchain, bug 559726
250 + tc-export AR CC NM OBJCOPY RANLIB
251 +
252 + python_setup
253 +
254 + multilib-minimal_src_configure
255 +}
256 +
257 +meson_use() {
258 + usex "$1" true false
259 +}
260 +
261 +meson_multilib() {
262 + if multilib_is_native_abi; then
263 + echo true
264 + else
265 + echo false
266 + fi
267 +}
268 +
269 +meson_multilib_native_use() {
270 + if multilib_is_native_abi && use "$1"; then
271 + echo true
272 + else
273 + echo false
274 + fi
275 +}
276 +
277 +multilib_src_configure() {
278 + local myconf=(
279 + --localstatedir="${EPREFIX}/var"
280 + -Dsupport-url="https://gentoo.org/support/"
281 + -Dpamlibdir="$(getpam_mod_dir)"
282 + # avoid bash-completion dep
283 + -Dbashcompletiondir="$(get_bashcompdir)"
284 + # make sure we get /bin:/sbin in PATH
285 + -Dsplit-usr=$(usex split-usr true false)
286 + -Dsplit-bin=true
287 + -Drootprefix="$(usex split-usr "${EPREFIX:-/}" "${EPREFIX}/usr")"
288 + -Drootlibdir="${EPREFIX}/usr/$(get_libdir)"
289 + # Avoid infinite exec recursion, bug 642724
290 + -Dtelinit-path="${EPREFIX}/lib/sysvinit/telinit"
291 + # no deps
292 + -Dima=true
293 + -Ddefault-hierarchy=$(usex cgroup-hybrid hybrid unified)
294 + # Optional components/dependencies
295 + -Dacl=$(meson_multilib_native_use acl)
296 + -Dapparmor=$(meson_multilib_native_use apparmor)
297 + -Daudit=$(meson_multilib_native_use audit)
298 + -Dlibcryptsetup=$(meson_multilib_native_use cryptsetup)
299 + -Dlibcurl=$(meson_multilib_native_use curl)
300 + -Ddns-over-tls=$(meson_multilib_native_use dns-over-tls)
301 + -Delfutils=$(meson_multilib_native_use elfutils)
302 + -Dgcrypt=$(meson_use gcrypt)
303 + -Dgnu-efi=$(meson_multilib_native_use gnuefi)
304 + -Defi-libdir="${ESYSROOT}/usr/$(get_libdir)"
305 + -Dhomed=$(meson_multilib_native_use homed)
306 + -Dhwdb=$(meson_multilib_native_use hwdb)
307 + -Dmicrohttpd=$(meson_multilib_native_use http)
308 + -Didn=$(meson_multilib_native_use idn)
309 + -Dimportd=$(meson_multilib_native_use importd)
310 + -Dbzip2=$(meson_multilib_native_use importd)
311 + -Dzlib=$(meson_multilib_native_use importd)
312 + -Dkmod=$(meson_multilib_native_use kmod)
313 + -Dlz4=$(meson_use lz4)
314 + -Dxz=$(meson_use lzma)
315 + -Dlibiptc=$(meson_multilib_native_use nat)
316 + -Dpam=$(meson_use pam)
317 + -Dp11kit=$(meson_multilib_native_use pkcs11)
318 + -Dpcre2=$(meson_multilib_native_use pcre)
319 + -Dpolkit=$(meson_multilib_native_use policykit)
320 + -Dpwquality=$(meson_multilib_native_use pwquality)
321 + -Dqrencode=$(meson_multilib_native_use qrcode)
322 + -Drepart=$(meson_multilib_native_use repart)
323 + -Dseccomp=$(meson_multilib_native_use seccomp)
324 + -Dselinux=$(meson_multilib_native_use selinux)
325 + -Ddbus=$(meson_multilib_native_use test)
326 + -Dxkbcommon=$(meson_multilib_native_use xkb)
327 + -Dntp-servers="0.gentoo.pool.ntp.org 1.gentoo.pool.ntp.org 2.gentoo.pool.ntp.org 3.gentoo.pool.ntp.org"
328 + # Breaks screen, tmux, etc.
329 + -Ddefault-kill-user-processes=false
330 + -Dcreate-log-dirs=false
331 +
332 + # multilib options
333 + -Dbacklight=$(meson_multilib)
334 + -Dbinfmt=$(meson_multilib)
335 + -Dcoredump=$(meson_multilib)
336 + -Denvironment-d=$(meson_multilib)
337 + -Dfirstboot=$(meson_multilib)
338 + -Dhibernate=$(meson_multilib)
339 + -Dhostnamed=$(meson_multilib)
340 + -Dldconfig=$(meson_multilib)
341 + -Dlocaled=$(meson_multilib)
342 + -Dman=$(meson_multilib)
343 + -Dnetworkd=$(meson_multilib)
344 + -Dquotacheck=$(meson_multilib)
345 + -Drandomseed=$(meson_multilib)
346 + -Drfkill=$(meson_multilib)
347 + -Dsysusers=$(meson_multilib)
348 + -Dtimedated=$(meson_multilib)
349 + -Dtimesyncd=$(meson_multilib)
350 + -Dtmpfiles=$(meson_multilib)
351 + -Dvconsole=$(meson_multilib)
352 +
353 + # static-libs
354 + -Dstatic-libsystemd=$(usex static-libs true false)
355 + -Dstatic-libudev=$(usex static-libs true false)
356 + )
357 +
358 + meson_src_configure "${myconf[@]}"
359 +}
360 +
361 +multilib_src_compile() {
362 + eninja
363 +}
364 +
365 +multilib_src_test() {
366 + unset DBUS_SESSION_BUS_ADDRESS XDG_RUNTIME_DIR
367 + meson_src_test
368 +}
369 +
370 +multilib_src_install() {
371 + DESTDIR="${D}" eninja install
372 +}
373 +
374 +multilib_src_install_all() {
375 + local rootprefix=$(usex split-usr '' /usr)
376 +
377 + # meson doesn't know about docdir
378 + mv "${ED}"/usr/share/doc/{systemd,${PF}} || die
379 +
380 + einstalldocs
381 + dodoc "${FILESDIR}"/nsswitch.conf
382 +
383 + if ! use resolvconf; then
384 + rm -f "${ED}${rootprefix}"/sbin/resolvconf || die
385 + fi
386 +
387 + rm "${ED}"/etc/init.d/README || die
388 + rm "${ED}${rootprefix}"/lib/systemd/system-generators/systemd-sysv-generator || die
389 +
390 + if ! use sysv-utils; then
391 + rm "${ED}${rootprefix}"/sbin/{halt,init,poweroff,reboot,runlevel,shutdown,telinit} || die
392 + rm "${ED}"/usr/share/man/man1/init.1 || die
393 + rm "${ED}"/usr/share/man/man8/{halt,poweroff,reboot,runlevel,shutdown,telinit}.8 || die
394 + fi
395 +
396 + if ! use resolvconf && ! use sysv-utils; then
397 + rmdir "${ED}${rootprefix}"/sbin || die
398 + fi
399 +
400 + # Preserve empty dirs in /etc & /var, bug #437008
401 + keepdir /etc/{binfmt.d,modules-load.d,tmpfiles.d}
402 + keepdir /etc/kernel/install.d
403 + keepdir /etc/systemd/{network,system,user}
404 + keepdir /etc/udev/rules.d
405 +
406 + if use hwdb; then
407 + keepdir /etc/udev/hwdb.d
408 + fi
409 +
410 + keepdir "${rootprefix}"/lib/systemd/{system-sleep,system-shutdown}
411 + keepdir /usr/lib/{binfmt.d,modules-load.d}
412 + keepdir /usr/lib/systemd/user-generators
413 + keepdir /var/lib/systemd
414 + keepdir /var/log/journal
415 +
416 + # Symlink /etc/sysctl.conf for easy migration.
417 + dosym ../sysctl.conf /etc/sysctl.d/99-sysctl.conf
418 +
419 + if use hwdb; then
420 + rm -r "${ED}${rootprefix}"/lib/udev/hwdb.d || die
421 + fi
422 +
423 + if use split-usr; then
424 + # Avoid breaking boot/reboot
425 + dosym ../../../lib/systemd/systemd /usr/lib/systemd/systemd
426 + dosym ../../../lib/systemd/systemd-shutdown /usr/lib/systemd/systemd-shutdown
427 + fi
428 +
429 + gen_usr_ldscript -a systemd udev
430 +}
431 +
432 +migrate_locale() {
433 + local envd_locale_def="${EROOT}/etc/env.d/02locale"
434 + local envd_locale=( "${EROOT}"/etc/env.d/??locale )
435 + local locale_conf="${EROOT}/etc/locale.conf"
436 +
437 + if [[ ! -L ${locale_conf} && ! -e ${locale_conf} ]]; then
438 + # If locale.conf does not exist...
439 + if [[ -e ${envd_locale} ]]; then
440 + # ...either copy env.d/??locale if there's one
441 + ebegin "Moving ${envd_locale} to ${locale_conf}"
442 + mv "${envd_locale}" "${locale_conf}"
443 + eend ${?} || FAIL=1
444 + else
445 + # ...or create a dummy default
446 + ebegin "Creating ${locale_conf}"
447 + cat > "${locale_conf}" <<-EOF
448 + # This file has been created by the sys-apps/systemd ebuild.
449 + # See locale.conf(5) and localectl(1).
450 +
451 + # LANG=${LANG}
452 + EOF
453 + eend ${?} || FAIL=1
454 + fi
455 + fi
456 +
457 + if [[ ! -L ${envd_locale} ]]; then
458 + # now, if env.d/??locale is not a symlink (to locale.conf)...
459 + if [[ -e ${envd_locale} ]]; then
460 + # ...warn the user that he has duplicate locale settings
461 + ewarn
462 + ewarn "To ensure consistent behavior, you should replace ${envd_locale}"
463 + ewarn "with a symlink to ${locale_conf}. Please migrate your settings"
464 + ewarn "and create the symlink with the following command:"
465 + ewarn "ln -s -n -f ../locale.conf ${envd_locale}"
466 + ewarn
467 + else
468 + # ...or just create the symlink if there's nothing here
469 + ebegin "Creating ${envd_locale_def} -> ../locale.conf symlink"
470 + ln -n -s ../locale.conf "${envd_locale_def}"
471 + eend ${?} || FAIL=1
472 + fi
473 + fi
474 +}
475 +
476 +save_enabled_units() {
477 + ENABLED_UNITS=()
478 + type systemctl &>/dev/null || return
479 + for x; do
480 + if systemctl --quiet --root="${ROOT:-/}" is-enabled "${x}"; then
481 + ENABLED_UNITS+=( "${x}" )
482 + fi
483 + done
484 +}
485 +
486 +pkg_preinst() {
487 + save_enabled_units {machines,remote-{cryptsetup,fs}}.target getty@××××.service
488 +
489 + if ! use split-usr; then
490 + local dir
491 + for dir in bin sbin lib; do
492 + if [[ ! ${EROOT}/${dir} -ef ${EROOT}/usr/${dir} ]]; then
493 + eerror "\"${EROOT}/${dir}\" and \"${EROOT}/usr/${dir}\" are not merged."
494 + eerror "One of them should be a symbolic link to the other one."
495 + FAIL=1
496 + fi
497 + done
498 + if [[ ${FAIL} ]]; then
499 + eerror "Migration to system layout with merged directories must be performed before"
500 + eerror "rebuilding ${CATEGORY}/${PN} with USE=\"-split-usr\" to avoid run-time breakage."
501 + die "System layout with split directories still used"
502 + fi
503 + fi
504 +}
505 +
506 +pkg_postinst() {
507 + systemd_update_catalog
508 +
509 + # Keep this here in case the database format changes so it gets updated
510 + # when required. Despite that this file is owned by sys-apps/hwids.
511 + if has_version "sys-apps/hwids[udev]"; then
512 + udevadm hwdb --update --root="${EROOT}"
513 + fi
514 +
515 + udev_reload || FAIL=1
516 +
517 + # Bug 465468, make sure locales are respect, and ensure consistency
518 + # between OpenRC & systemd
519 + migrate_locale
520 +
521 + systemd_reenable systemd-networkd.service systemd-resolved.service
522 +
523 + if [[ ${ENABLED_UNITS[@]} ]]; then
524 + systemctl --root="${ROOT:-/}" enable "${ENABLED_UNITS[@]}"
525 + fi
526 +
527 + if [[ -z ${REPLACING_VERSIONS} ]]; then
528 + if type systemctl &>/dev/null; then
529 + systemctl --root="${ROOT:-/}" enable getty@.service remote-fs.target || FAIL=1
530 + fi
531 + elog "To enable a useful set of services, run the following:"
532 + elog " systemctl preset-all --preset-mode=enable-only"
533 + fi
534 +
535 + if [[ -L ${EROOT}/var/lib/systemd/timesync ]]; then
536 + rm "${EROOT}/var/lib/systemd/timesync"
537 + fi
538 +
539 + if [[ -z ${ROOT} && -d /run/systemd/system ]]; then
540 + ebegin "Reexecuting system manager"
541 + systemctl daemon-reexec
542 + eend $?
543 + fi
544 +
545 + if [[ ${FAIL} ]]; then
546 + eerror "One of the postinst commands failed. Please check the postinst output"
547 + eerror "for errors. You may need to clean up your system and/or try installing"
548 + eerror "systemd again."
549 + eerror
550 + fi
551 +}
552 +
553 +pkg_prerm() {
554 + # If removing systemd completely, remove the catalog database.
555 + if [[ ! ${REPLACED_BY_VERSION} ]]; then
556 + rm -f -v "${EROOT}"/var/lib/systemd/catalog/database
557 + fi
558 +}