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: Wed, 09 Jan 2019 19:33:52
Message-Id: 1547062301.1d4fd9fce1677572f7118cdddb05466d03c4df13.floppym@gentoo
1 commit: 1d4fd9fce1677572f7118cdddb05466d03c4df13
2 Author: Mike Gilbert <floppym <AT> gentoo <DOT> org>
3 AuthorDate: Wed Jan 9 15:28:00 2019 +0000
4 Commit: Mike Gilbert <floppym <AT> gentoo <DOT> org>
5 CommitDate: Wed Jan 9 19:31:41 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1d4fd9fc
7
8 sys-apps/systemd: security fixes
9
10 Bug: https://bugs.gentoo.org/674144
11 Package-Manager: Portage-2.3.54_p2, Repoman-2.3.12_p42
12 Signed-off-by: Mike Gilbert <floppym <AT> gentoo.org>
13
14 sys-apps/systemd/Manifest | 2 +
15 sys-apps/systemd/systemd-239-r3.ebuild | 448 ++++++++++++++++++++++++++++++++
16 sys-apps/systemd/systemd-240-r3.ebuild | 457 +++++++++++++++++++++++++++++++++
17 3 files changed, 907 insertions(+)
18
19 diff --git a/sys-apps/systemd/Manifest b/sys-apps/systemd/Manifest
20 index 15da8536cb0..daf7009c328 100644
21 --- a/sys-apps/systemd/Manifest
22 +++ b/sys-apps/systemd/Manifest
23 @@ -1,4 +1,6 @@
24 DIST systemd-239-patches-1.tar.gz 20639 BLAKE2B 9b03367becdef20d16056cdbbeaaefd9f10bf6c56528ad1a738684ab08d99a464411c23aea32d47307b0399f092107069d09ad42fb07217f8eca520cc4010b84 SHA512 757c7fc8f60ccf99d2803128a8c4d8b924093b150384569c5ffb3bc39f06728e99b18e2f77ff0f1c16bbd45bc75cbb0f385dac0135443d70c7dcd9cc1e84a490
25 +DIST systemd-239-patches-2.tar.gz 33416 BLAKE2B 9602d101cbac65d3b2490f28308e843c28fcaea848dd09005abef0da0bc79ba0766a1cbe7c3cac63f796accddf0295b4eb946e601a201f7e81a48bd1720051ca SHA512 5f5a764d317c43c6b1854171a753eafaca006e12e4f91c81e6ba1d50e80bbbaca23c900fba417264bf9f0d827a73aca71a6da8f2a2043aaaefefed62f5a92b23
26 DIST systemd-239.tar.gz 7157293 BLAKE2B 975f6215c8bb6662d6e161f637e1fece22930c0190b3c31a8fc4cb1a10600546a252704ac95590d9d14e495fcd06082a590e6d755e36603a41b3a396d579d8b0 SHA512 fd44590dfd148504c5ed1e67521efce50d84b627b7fc77015fa95dfa76d7a42297c56cc89eff40181809732024b16d48f2a87038cf435e0c63bc2b95ecd86b0f
27 DIST systemd-240-patches-1.tar.gz 15364 BLAKE2B e5cf4c2b8666a5c03e658f46674422d2566a748d3dc088f3cda0f5c5e7b51aec00a531ef7e9d047fd59504299d2e8a44faa353da1183260ae72156bb486d51f7 SHA512 1541810dbcfcc75c4323015c056c963ef69d633761293dea7f27aa6106e3ccc59a84263c703fc5542cf2fb3410c846e97ffb11ecc7d56a98ca658b43b73b6313
28 +DIST systemd-240-patches-2.tar.gz 28099 BLAKE2B 2e497ed729e2482ef3cc0d010504314f2982a9af19341d6f4efa06b24b3c01f9f69996d43e5b484c641777d00a8a0ba4508bcf6a0296a63d4fc57440f2d3708c SHA512 1be0432d918a4866056ffc65de6e8b412784e5018490c0349a98bba801536d2689c5b2ce41ddd5adbb945aac71bfd0168f94c1daf0788661cd83b159a8c975b8
29 DIST systemd-240.tar.gz 7582001 BLAKE2B cf53595a83424984dd9f533f7cd0c9905366c5a52ab946fc45ff7fd1bcc85978ff654720113641534e40c0f9a1ad1c9628255778616770762950426789f659c3 SHA512 da7467781b16f65d868931ae88fd07554db61542aec7f11dbec9f7279b529f900301edfea2d3813ddb64eeb3fdcfb7be86e540c65212dd7cfdcdebbc80de2ff5
30
31 diff --git a/sys-apps/systemd/systemd-239-r3.ebuild b/sys-apps/systemd/systemd-239-r3.ebuild
32 new file mode 100644
33 index 00000000000..6321c75553e
34 --- /dev/null
35 +++ b/sys-apps/systemd/systemd-239-r3.ebuild
36 @@ -0,0 +1,448 @@
37 +# Copyright 1999-2019 Gentoo Authors
38 +# Distributed under the terms of the GNU General Public License v2
39 +
40 +EAPI=6
41 +
42 +if [[ ${PV} == 9999 ]]; then
43 + EGIT_REPO_URI="https://github.com/systemd/systemd.git"
44 + inherit git-r3
45 +else
46 + SRC_URI="https://github.com/systemd/systemd/archive/v${PV}/${P}.tar.gz
47 + https://dev.gentoo.org/~floppym/dist/${P}-patches-2.tar.gz"
48 + KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86"
49 +fi
50 +
51 +PYTHON_COMPAT=( python{3_4,3_5,3_6,3_7} )
52 +
53 +inherit bash-completion-r1 linux-info meson multilib-minimal ninja-utils pam python-any-r1 systemd toolchain-funcs udev user
54 +
55 +DESCRIPTION="System and service manager for Linux"
56 +HOMEPAGE="https://www.freedesktop.org/wiki/Software/systemd"
57 +
58 +LICENSE="GPL-2 LGPL-2.1 MIT public-domain"
59 +SLOT="0/2"
60 +IUSE="acl apparmor audit build cryptsetup curl elfutils +gcrypt gnuefi http idn importd +kmod libidn2 +lz4 lzma nat pam pcre policykit qrcode +resolvconf +seccomp selinux +split-usr ssl +sysv-utils test vanilla xkb"
61 +
62 +REQUIRED_USE="importd? ( curl gcrypt lzma )"
63 +RESTRICT="!test? ( test )"
64 +
65 +MINKV="3.11"
66 +
67 +COMMON_DEPEND=">=sys-apps/util-linux-2.30:0=[${MULTILIB_USEDEP}]
68 + sys-libs/libcap:0=[${MULTILIB_USEDEP}]
69 + !<sys-libs/glibc-2.16
70 + acl? ( sys-apps/acl:0= )
71 + apparmor? ( sys-libs/libapparmor:0= )
72 + audit? ( >=sys-process/audit-2:0= )
73 + cryptsetup? ( >=sys-fs/cryptsetup-1.6:0= )
74 + curl? ( net-misc/curl:0= )
75 + elfutils? ( >=dev-libs/elfutils-0.158:0= )
76 + gcrypt? ( >=dev-libs/libgcrypt-1.4.5:0=[${MULTILIB_USEDEP}] )
77 + http? (
78 + >=net-libs/libmicrohttpd-0.9.33:0=
79 + ssl? ( >=net-libs/gnutls-3.1.4:0= )
80 + )
81 + idn? (
82 + libidn2? ( net-dns/libidn2:= )
83 + !libidn2? ( net-dns/libidn:= )
84 + )
85 + importd? (
86 + app-arch/bzip2:0=
87 + sys-libs/zlib:0=
88 + )
89 + kmod? ( >=sys-apps/kmod-15:0= )
90 + lz4? ( >=app-arch/lz4-0_p131:0=[${MULTILIB_USEDEP}] )
91 + lzma? ( >=app-arch/xz-utils-5.0.5-r1:0=[${MULTILIB_USEDEP}] )
92 + nat? ( net-firewall/iptables:0= )
93 + pam? ( virtual/pam:=[${MULTILIB_USEDEP}] )
94 + pcre? ( dev-libs/libpcre2 )
95 + qrcode? ( media-gfx/qrencode:0= )
96 + seccomp? ( >=sys-libs/libseccomp-2.3.3:0= )
97 + selinux? ( sys-libs/libselinux:0= )
98 + xkb? ( >=x11-libs/libxkbcommon-0.4.1:0= )"
99 +
100 +# baselayout-2.2 has /run
101 +RDEPEND="${COMMON_DEPEND}
102 + >=sys-apps/baselayout-2.2
103 + selinux? ( sec-policy/selinux-base-policy[systemd] )
104 + sysv-utils? ( !sys-apps/sysvinit )
105 + !sysv-utils? ( sys-apps/sysvinit )
106 + resolvconf? ( !net-dns/openresolv )
107 + !build? ( || (
108 + sys-apps/util-linux[kill(-)]
109 + sys-process/procps[kill(+)]
110 + sys-apps/coreutils[kill(-)]
111 + ) )
112 + !sys-auth/nss-myhostname
113 + !<sys-kernel/dracut-044
114 + !sys-fs/eudev
115 + !sys-fs/udev"
116 +
117 +# sys-apps/dbus: the daemon only (+ build-time lib dep for tests)
118 +PDEPEND=">=sys-apps/dbus-1.9.8[systemd]
119 + >=sys-apps/hwids-20150417[udev]
120 + >=sys-fs/udev-init-scripts-25
121 + policykit? ( sys-auth/polkit )
122 + !vanilla? ( sys-apps/gentoo-systemd-integration )"
123 +
124 +# Newer linux-headers needed by ia64, bug #480218
125 +DEPEND="${COMMON_DEPEND}
126 + app-arch/xz-utils:0
127 + dev-util/gperf
128 + >=dev-util/intltool-0.50
129 + >=sys-apps/coreutils-8.16
130 + >=sys-kernel/linux-headers-${MINKV}
131 + virtual/pkgconfig[${MULTILIB_USEDEP}]
132 + gnuefi? ( >=sys-boot/gnu-efi-3.0.2 )
133 + test? ( sys-apps/dbus )
134 + app-text/docbook-xml-dtd:4.2
135 + app-text/docbook-xml-dtd:4.5
136 + app-text/docbook-xsl-stylesheets
137 + dev-libs/libxslt:0
138 + $(python_gen_any_dep 'dev-python/lxml[${PYTHON_USEDEP}]')
139 +"
140 +
141 +pkg_pretend() {
142 + if [[ ${MERGE_TYPE} != buildonly ]]; then
143 + local CONFIG_CHECK="~AUTOFS4_FS ~BLK_DEV_BSG ~CGROUPS
144 + ~CHECKPOINT_RESTORE ~DEVTMPFS ~EPOLL ~FANOTIFY ~FHANDLE
145 + ~INOTIFY_USER ~IPV6 ~NET ~NET_NS ~PROC_FS ~SIGNALFD ~SYSFS
146 + ~TIMERFD ~TMPFS_XATTR ~UNIX
147 + ~CRYPTO_HMAC ~CRYPTO_SHA256 ~CRYPTO_USER_API_HASH
148 + ~!FW_LOADER_USER_HELPER_FALLBACK ~!GRKERNSEC_PROC ~!IDE ~!SYSFS_DEPRECATED
149 + ~!SYSFS_DEPRECATED_V2"
150 +
151 + use acl && CONFIG_CHECK+=" ~TMPFS_POSIX_ACL"
152 + use seccomp && CONFIG_CHECK+=" ~SECCOMP ~SECCOMP_FILTER"
153 + kernel_is -lt 3 7 && CONFIG_CHECK+=" ~HOTPLUG"
154 + kernel_is -lt 4 7 && CONFIG_CHECK+=" ~DEVPTS_MULTIPLE_INSTANCES"
155 + kernel_is -ge 4 10 && CONFIG_CHECK+=" ~CGROUP_BPF"
156 +
157 + if linux_config_exists; then
158 + local uevent_helper_path=$(linux_chkconfig_string UEVENT_HELPER_PATH)
159 + if [[ -n ${uevent_helper_path} ]] && [[ ${uevent_helper_path} != '""' ]]; then
160 + ewarn "It's recommended to set an empty value to the following kernel config option:"
161 + ewarn "CONFIG_UEVENT_HELPER_PATH=${uevent_helper_path}"
162 + fi
163 + if linux_chkconfig_present X86; then
164 + CONFIG_CHECK+=" ~DMIID"
165 + fi
166 + fi
167 +
168 + if kernel_is -lt ${MINKV//./ }; then
169 + ewarn "Kernel version at least ${MINKV} required"
170 + fi
171 +
172 + check_extra_config
173 + fi
174 +}
175 +
176 +pkg_setup() {
177 + :
178 +}
179 +
180 +src_unpack() {
181 + default
182 + [[ ${PV} != 9999 ]] || git-r3_src_unpack
183 +}
184 +
185 +src_prepare() {
186 + # Do NOT add patches here
187 + local PATCHES=()
188 +
189 + [[ -d "${WORKDIR}"/patches ]] && PATCHES+=( "${WORKDIR}"/patches )
190 +
191 + # Add local patches here
192 + PATCHES+=(
193 + "${FILESDIR}"/239-debug-extra.patch
194 + )
195 +
196 + if ! use vanilla; then
197 + PATCHES+=(
198 + "${FILESDIR}/gentoo-Dont-enable-audit-by-default.patch"
199 + "${FILESDIR}/gentoo-systemd-user-pam.patch"
200 + "${FILESDIR}/gentoo-uucp-group-r1.patch"
201 + "${FILESDIR}/gentoo-generator-path.patch"
202 + )
203 + fi
204 +
205 + default
206 +}
207 +
208 +src_configure() {
209 + # Prevent conflicts with i686 cross toolchain, bug 559726
210 + tc-export AR CC NM OBJCOPY RANLIB
211 +
212 + python_setup
213 +
214 + multilib-minimal_src_configure
215 +}
216 +
217 +meson_use() {
218 + usex "$1" true false
219 +}
220 +
221 +meson_multilib() {
222 + if multilib_is_native_abi; then
223 + echo true
224 + else
225 + echo false
226 + fi
227 +}
228 +
229 +meson_multilib_native_use() {
230 + if multilib_is_native_abi && use "$1"; then
231 + echo true
232 + else
233 + echo false
234 + fi
235 +}
236 +
237 +multilib_src_configure() {
238 + local myconf=(
239 + --localstatedir="${EPREFIX}/var"
240 + -Dpamlibdir="$(getpam_mod_dir)"
241 + # avoid bash-completion dep
242 + -Dbashcompletiondir="$(get_bashcompdir)"
243 + # make sure we get /bin:/sbin in PATH
244 + -Dsplit-usr=$(usex split-usr true false)
245 + -Drootprefix="$(usex split-usr "${EPREFIX:-/}" "${EPREFIX}/usr")"
246 + -Dsysvinit-path=
247 + -Dsysvrcnd-path=
248 + # Avoid infinite exec recursion, bug 642724
249 + -Dtelinit-path="${EPREFIX}/lib/sysvinit/telinit"
250 + # no deps
251 + -Defi=$(meson_multilib)
252 + -Dima=true
253 + # Optional components/dependencies
254 + -Dacl=$(meson_multilib_native_use acl)
255 + -Dapparmor=$(meson_multilib_native_use apparmor)
256 + -Daudit=$(meson_multilib_native_use audit)
257 + -Dlibcryptsetup=$(meson_multilib_native_use cryptsetup)
258 + -Dlibcurl=$(meson_multilib_native_use curl)
259 + -Delfutils=$(meson_multilib_native_use elfutils)
260 + -Dgcrypt=$(meson_use gcrypt)
261 + -Dgnu-efi=$(meson_multilib_native_use gnuefi)
262 + -Defi-libdir="${EPREFIX}/usr/$(get_libdir)"
263 + -Dmicrohttpd=$(meson_multilib_native_use http)
264 + $(usex http -Dgnutls=$(meson_multilib_native_use ssl) -Dgnutls=false)
265 + -Dimportd=$(meson_multilib_native_use importd)
266 + -Dbzip2=$(meson_multilib_native_use importd)
267 + -Dzlib=$(meson_multilib_native_use importd)
268 + -Dkmod=$(meson_multilib_native_use kmod)
269 + -Dlz4=$(meson_use lz4)
270 + -Dxz=$(meson_use lzma)
271 + -Dlibiptc=$(meson_multilib_native_use nat)
272 + -Dpam=$(meson_use pam)
273 + -Dpcre2=$(meson_multilib_native_use pcre)
274 + -Dpolkit=$(meson_multilib_native_use policykit)
275 + -Dqrencode=$(meson_multilib_native_use qrcode)
276 + -Dseccomp=$(meson_multilib_native_use seccomp)
277 + -Dselinux=$(meson_multilib_native_use selinux)
278 + #-Dtests=$(meson_multilib_native_use test)
279 + -Ddbus=$(meson_multilib_native_use test)
280 + -Dxkbcommon=$(meson_multilib_native_use xkb)
281 + # hardcode a few paths to spare some deps
282 + -Dkill-path=/bin/kill
283 + -Dntp-servers="0.gentoo.pool.ntp.org 1.gentoo.pool.ntp.org 2.gentoo.pool.ntp.org 3.gentoo.pool.ntp.org"
284 + # Breaks screen, tmux, etc.
285 + -Ddefault-kill-user-processes=false
286 +
287 + # multilib options
288 + -Dbacklight=$(meson_multilib)
289 + -Dbinfmt=$(meson_multilib)
290 + -Dcoredump=$(meson_multilib)
291 + -Denvironment-d=$(meson_multilib)
292 + -Dfirstboot=$(meson_multilib)
293 + -Dhibernate=$(meson_multilib)
294 + -Dhostnamed=$(meson_multilib)
295 + -Dhwdb=$(meson_multilib)
296 + -Dldconfig=$(meson_multilib)
297 + -Dlocaled=$(meson_multilib)
298 + -Dman=$(meson_multilib)
299 + -Dnetworkd=$(meson_multilib)
300 + -Dquotacheck=$(meson_multilib)
301 + -Drandomseed=$(meson_multilib)
302 + -Drfkill=$(meson_multilib)
303 + -Dsysusers=$(meson_multilib)
304 + -Dtimedated=$(meson_multilib)
305 + -Dtimesyncd=$(meson_multilib)
306 + -Dtmpfiles=$(meson_multilib)
307 + -Dvconsole=$(meson_multilib)
308 + )
309 +
310 + if multilib_is_native_abi && use idn; then
311 + myconf+=(
312 + -Dlibidn2=$(usex libidn2 true false)
313 + -Dlibidn=$(usex libidn2 false true)
314 + )
315 + else
316 + myconf+=(
317 + -Dlibidn2=false
318 + -Dlibidn=false
319 + )
320 + fi
321 +
322 + meson_src_configure "${myconf[@]}"
323 +}
324 +
325 +multilib_src_compile() {
326 + eninja
327 +}
328 +
329 +multilib_src_test() {
330 + unset DBUS_SESSION_BUS_ADDRESS XDG_RUNTIME_DIR
331 + eninja test
332 +}
333 +
334 +multilib_src_install() {
335 + DESTDIR="${D}" eninja install
336 +}
337 +
338 +multilib_src_install_all() {
339 + local rootprefix=$(usex split-usr '' /usr)
340 +
341 + # meson doesn't know about docdir
342 + mv "${ED%/}"/usr/share/doc/{systemd,${PF}} || die
343 +
344 + einstalldocs
345 + dodoc "${FILESDIR}"/nsswitch.conf
346 +
347 + if ! use resolvconf; then
348 + rm -f "${ED%/}${rootprefix}"/sbin/resolvconf || die
349 + fi
350 +
351 + if ! use sysv-utils; then
352 + rm "${ED%/}${rootprefix}"/sbin/{halt,init,poweroff,reboot,runlevel,shutdown,telinit} || die
353 + rm "${ED%/}"/usr/share/man/man1/init.1 || die
354 + rm "${ED%/}"/usr/share/man/man8/{halt,poweroff,reboot,runlevel,shutdown,telinit}.8 || die
355 + fi
356 +
357 + if ! use resolvconf && ! use sysv-utils; then
358 + rmdir "${ED%/}${rootprefix}"/sbin || die
359 + fi
360 +
361 + # Preserve empty dirs in /etc & /var, bug #437008
362 + keepdir /etc/{binfmt.d,modules-load.d,tmpfiles.d}
363 + keepdir /etc/systemd/{ntp-units.d,user} /var/lib/systemd
364 + keepdir /etc/udev/{hwdb.d,rules.d}
365 + keepdir /var/log/journal/remote
366 +
367 + # Symlink /etc/sysctl.conf for easy migration.
368 + dosym ../sysctl.conf /etc/sysctl.d/99-sysctl.conf
369 +
370 + # If we install these symlinks, there is no way for the sysadmin to remove them
371 + # permanently.
372 + rm -f "${ED%/}"/etc/systemd/system/multi-user.target.wants/systemd-networkd.service || die
373 + rm -f "${ED%/}"/etc/systemd/system/dbus-org.freedesktop.network1.service || die
374 + rm -f "${ED%/}"/etc/systemd/system/multi-user.target.wants/systemd-resolved.service || die
375 + rm -f "${ED%/}"/etc/systemd/system/dbus-org.freedesktop.resolve1.service || die
376 + rm -fr "${ED%/}"/etc/systemd/system/network-online.target.wants || die
377 + rm -fr "${ED%/}"/etc/systemd/system/sockets.target.wants || die
378 + rm -fr "${ED%/}"/etc/systemd/system/sysinit.target.wants || die
379 +
380 + local udevdir=/lib/udev
381 + use split-usr || udevdir=/usr/lib/udev
382 +
383 + rm -r "${ED%/}${udevdir}/hwdb.d" || die
384 +
385 + if use split-usr; then
386 + # Avoid breaking boot/reboot
387 + dosym ../../../lib/systemd/systemd /usr/lib/systemd/systemd
388 + dosym ../../../lib/systemd/systemd-shutdown /usr/lib/systemd/systemd-shutdown
389 + fi
390 +}
391 +
392 +migrate_locale() {
393 + local envd_locale_def="${EROOT%/}/etc/env.d/02locale"
394 + local envd_locale=( "${EROOT%/}"/etc/env.d/??locale )
395 + local locale_conf="${EROOT%/}/etc/locale.conf"
396 +
397 + if [[ ! -L ${locale_conf} && ! -e ${locale_conf} ]]; then
398 + # If locale.conf does not exist...
399 + if [[ -e ${envd_locale} ]]; then
400 + # ...either copy env.d/??locale if there's one
401 + ebegin "Moving ${envd_locale} to ${locale_conf}"
402 + mv "${envd_locale}" "${locale_conf}"
403 + eend ${?} || FAIL=1
404 + else
405 + # ...or create a dummy default
406 + ebegin "Creating ${locale_conf}"
407 + cat > "${locale_conf}" <<-EOF
408 + # This file has been created by the sys-apps/systemd ebuild.
409 + # See locale.conf(5) and localectl(1).
410 +
411 + # LANG=${LANG}
412 + EOF
413 + eend ${?} || FAIL=1
414 + fi
415 + fi
416 +
417 + if [[ ! -L ${envd_locale} ]]; then
418 + # now, if env.d/??locale is not a symlink (to locale.conf)...
419 + if [[ -e ${envd_locale} ]]; then
420 + # ...warn the user that he has duplicate locale settings
421 + ewarn
422 + ewarn "To ensure consistent behavior, you should replace ${envd_locale}"
423 + ewarn "with a symlink to ${locale_conf}. Please migrate your settings"
424 + ewarn "and create the symlink with the following command:"
425 + ewarn "ln -s -n -f ../locale.conf ${envd_locale}"
426 + ewarn
427 + else
428 + # ...or just create the symlink if there's nothing here
429 + ebegin "Creating ${envd_locale_def} -> ../locale.conf symlink"
430 + ln -n -s ../locale.conf "${envd_locale_def}"
431 + eend ${?} || FAIL=1
432 + fi
433 + fi
434 +}
435 +
436 +pkg_postinst() {
437 + newusergroup() {
438 + enewgroup "$1"
439 + enewuser "$1" -1 -1 -1 "$1"
440 + }
441 +
442 + enewgroup input
443 + enewgroup kvm 78
444 + enewgroup render
445 + enewgroup systemd-journal
446 + newusergroup systemd-bus-proxy
447 + newusergroup systemd-coredump
448 + newusergroup systemd-journal-gateway
449 + newusergroup systemd-journal-remote
450 + newusergroup systemd-journal-upload
451 + newusergroup systemd-network
452 + newusergroup systemd-resolve
453 + newusergroup systemd-timesync
454 +
455 + systemd_update_catalog
456 +
457 + # Keep this here in case the database format changes so it gets updated
458 + # when required. Despite that this file is owned by sys-apps/hwids.
459 + if has_version "sys-apps/hwids[udev]"; then
460 + udevadm hwdb --update --root="${EROOT%/}"
461 + fi
462 +
463 + udev_reload || FAIL=1
464 +
465 + # Bug 465468, make sure locales are respect, and ensure consistency
466 + # between OpenRC & systemd
467 + migrate_locale
468 +
469 + systemd_reenable systemd-networkd.service systemd-resolved.service
470 +
471 + if [[ ${FAIL} ]]; then
472 + eerror "One of the postinst commands failed. Please check the postinst output"
473 + eerror "for errors. You may need to clean up your system and/or try installing"
474 + eerror "systemd again."
475 + eerror
476 + fi
477 +}
478 +
479 +pkg_prerm() {
480 + # If removing systemd completely, remove the catalog database.
481 + if [[ ! ${REPLACED_BY_VERSION} ]]; then
482 + rm -f -v "${EROOT}"/var/lib/systemd/catalog/database
483 + fi
484 +}
485
486 diff --git a/sys-apps/systemd/systemd-240-r3.ebuild b/sys-apps/systemd/systemd-240-r3.ebuild
487 new file mode 100644
488 index 00000000000..2dda532141b
489 --- /dev/null
490 +++ b/sys-apps/systemd/systemd-240-r3.ebuild
491 @@ -0,0 +1,457 @@
492 +# Copyright 1999-2019 Gentoo Authors
493 +# Distributed under the terms of the GNU General Public License v2
494 +
495 +EAPI=7
496 +
497 +if [[ ${PV} == 9999 ]]; then
498 + EGIT_REPO_URI="https://github.com/systemd/systemd.git"
499 + inherit git-r3
500 +else
501 + SRC_URI="https://github.com/systemd/systemd/archive/v${PV}/${P}.tar.gz
502 + https://dev.gentoo.org/~floppym/dist/${P}-patches-2.tar.gz"
503 + KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86"
504 +fi
505 +
506 +PYTHON_COMPAT=( python{3_5,3_6,3_7} )
507 +
508 +inherit bash-completion-r1 linux-info meson multilib-minimal ninja-utils pam python-any-r1 systemd toolchain-funcs udev user
509 +
510 +DESCRIPTION="System and service manager for Linux"
511 +HOMEPAGE="https://www.freedesktop.org/wiki/Software/systemd"
512 +
513 +LICENSE="GPL-2 LGPL-2.1 MIT public-domain"
514 +SLOT="0/2"
515 +IUSE="acl apparmor audit build cryptsetup curl elfutils +gcrypt gnuefi http idn importd +kmod libidn2 +lz4 lzma nat pam pcre policykit qrcode +resolvconf +seccomp selinux +split-usr ssl +sysv-utils test vanilla xkb"
516 +
517 +REQUIRED_USE="importd? ( curl gcrypt lzma )"
518 +RESTRICT="!test? ( test )"
519 +
520 +MINKV="3.11"
521 +
522 +COMMON_DEPEND=">=sys-apps/util-linux-2.30:0=[${MULTILIB_USEDEP}]
523 + sys-libs/libcap:0=[${MULTILIB_USEDEP}]
524 + !<sys-libs/glibc-2.16
525 + acl? ( sys-apps/acl:0= )
526 + apparmor? ( sys-libs/libapparmor:0= )
527 + audit? ( >=sys-process/audit-2:0= )
528 + cryptsetup? ( >=sys-fs/cryptsetup-1.6:0= )
529 + curl? ( net-misc/curl:0= )
530 + elfutils? ( >=dev-libs/elfutils-0.158:0= )
531 + gcrypt? ( >=dev-libs/libgcrypt-1.4.5:0=[${MULTILIB_USEDEP}] )
532 + http? (
533 + >=net-libs/libmicrohttpd-0.9.33:0=
534 + ssl? ( >=net-libs/gnutls-3.1.4:0= )
535 + )
536 + idn? (
537 + libidn2? ( net-dns/libidn2:= )
538 + !libidn2? ( net-dns/libidn:= )
539 + )
540 + importd? (
541 + app-arch/bzip2:0=
542 + sys-libs/zlib:0=
543 + )
544 + kmod? ( >=sys-apps/kmod-15:0= )
545 + lz4? ( >=app-arch/lz4-0_p131:0=[${MULTILIB_USEDEP}] )
546 + lzma? ( >=app-arch/xz-utils-5.0.5-r1:0=[${MULTILIB_USEDEP}] )
547 + nat? ( net-firewall/iptables:0= )
548 + pam? ( virtual/pam:=[${MULTILIB_USEDEP}] )
549 + pcre? ( dev-libs/libpcre2 )
550 + qrcode? ( media-gfx/qrencode:0= )
551 + seccomp? ( >=sys-libs/libseccomp-2.3.3:0= )
552 + selinux? ( sys-libs/libselinux:0= )
553 + xkb? ( >=x11-libs/libxkbcommon-0.4.1:0= )"
554 +
555 +# baselayout-2.2 has /run
556 +RDEPEND="${COMMON_DEPEND}
557 + >=sys-apps/baselayout-2.2
558 + selinux? ( sec-policy/selinux-base-policy[systemd] )
559 + sysv-utils? ( !sys-apps/sysvinit )
560 + !sysv-utils? ( sys-apps/sysvinit )
561 + resolvconf? ( !net-dns/openresolv )
562 + !build? ( || (
563 + sys-apps/util-linux[kill(-)]
564 + sys-process/procps[kill(+)]
565 + sys-apps/coreutils[kill(-)]
566 + ) )
567 + !sys-auth/nss-myhostname
568 + !<sys-kernel/dracut-044
569 + !sys-fs/eudev
570 + !sys-fs/udev"
571 +
572 +# sys-apps/dbus: the daemon only (+ build-time lib dep for tests)
573 +PDEPEND=">=sys-apps/dbus-1.9.8[systemd]
574 + >=sys-apps/hwids-20150417[udev]
575 + >=sys-fs/udev-init-scripts-25
576 + policykit? ( sys-auth/polkit )
577 + !vanilla? ( sys-apps/gentoo-systemd-integration )"
578 +
579 +# Newer linux-headers needed by ia64, bug #480218
580 +DEPEND="
581 + >=sys-kernel/linux-headers-${MINKV}
582 + gnuefi? ( >=sys-boot/gnu-efi-3.0.2 )
583 +"
584 +
585 +BDEPEND="
586 + app-arch/xz-utils:0
587 + dev-util/gperf
588 + >=dev-util/meson-0.46
589 + >=dev-util/intltool-0.50
590 + >=sys-apps/coreutils-8.16
591 + virtual/pkgconfig[${MULTILIB_USEDEP}]
592 + test? ( sys-apps/dbus )
593 + app-text/docbook-xml-dtd:4.2
594 + app-text/docbook-xml-dtd:4.5
595 + app-text/docbook-xsl-stylesheets
596 + dev-libs/libxslt:0
597 + $(python_gen_any_dep 'dev-python/lxml[${PYTHON_USEDEP}]')
598 +"
599 +
600 +pkg_pretend() {
601 + if [[ ${MERGE_TYPE} != buildonly ]]; then
602 + local CONFIG_CHECK="~AUTOFS4_FS ~BLK_DEV_BSG ~CGROUPS
603 + ~CHECKPOINT_RESTORE ~DEVTMPFS ~EPOLL ~FANOTIFY ~FHANDLE
604 + ~INOTIFY_USER ~IPV6 ~NET ~NET_NS ~PROC_FS ~SIGNALFD ~SYSFS
605 + ~TIMERFD ~TMPFS_XATTR ~UNIX
606 + ~CRYPTO_HMAC ~CRYPTO_SHA256 ~CRYPTO_USER_API_HASH
607 + ~!FW_LOADER_USER_HELPER_FALLBACK ~!GRKERNSEC_PROC ~!IDE ~!SYSFS_DEPRECATED
608 + ~!SYSFS_DEPRECATED_V2"
609 +
610 + use acl && CONFIG_CHECK+=" ~TMPFS_POSIX_ACL"
611 + use seccomp && CONFIG_CHECK+=" ~SECCOMP ~SECCOMP_FILTER"
612 + kernel_is -lt 3 7 && CONFIG_CHECK+=" ~HOTPLUG"
613 + kernel_is -lt 4 7 && CONFIG_CHECK+=" ~DEVPTS_MULTIPLE_INSTANCES"
614 + kernel_is -ge 4 10 && CONFIG_CHECK+=" ~CGROUP_BPF"
615 +
616 + if linux_config_exists; then
617 + local uevent_helper_path=$(linux_chkconfig_string UEVENT_HELPER_PATH)
618 + if [[ -n ${uevent_helper_path} ]] && [[ ${uevent_helper_path} != '""' ]]; then
619 + ewarn "It's recommended to set an empty value to the following kernel config option:"
620 + ewarn "CONFIG_UEVENT_HELPER_PATH=${uevent_helper_path}"
621 + fi
622 + if linux_chkconfig_present X86; then
623 + CONFIG_CHECK+=" ~DMIID"
624 + fi
625 + fi
626 +
627 + if kernel_is -lt ${MINKV//./ }; then
628 + ewarn "Kernel version at least ${MINKV} required"
629 + fi
630 +
631 + check_extra_config
632 + fi
633 +}
634 +
635 +pkg_setup() {
636 + :
637 +}
638 +
639 +src_unpack() {
640 + default
641 + [[ ${PV} != 9999 ]] || git-r3_src_unpack
642 +}
643 +
644 +src_prepare() {
645 + # Do NOT add patches here
646 + local PATCHES=()
647 +
648 + [[ -d "${WORKDIR}"/patches ]] && PATCHES+=( "${WORKDIR}"/patches )
649 +
650 + # Add local patches here
651 + PATCHES+=(
652 + )
653 +
654 + if ! use vanilla; then
655 + PATCHES+=(
656 + "${FILESDIR}/gentoo-Dont-enable-audit-by-default.patch"
657 + "${FILESDIR}/gentoo-systemd-user-pam.patch"
658 + "${FILESDIR}/gentoo-uucp-group-r1.patch"
659 + "${FILESDIR}/gentoo-generator-path-r1.patch"
660 + )
661 + fi
662 +
663 + default
664 +}
665 +
666 +src_configure() {
667 + # Prevent conflicts with i686 cross toolchain, bug 559726
668 + tc-export AR CC NM OBJCOPY RANLIB
669 +
670 + python_setup
671 +
672 + multilib-minimal_src_configure
673 +}
674 +
675 +meson_use() {
676 + usex "$1" true false
677 +}
678 +
679 +meson_multilib() {
680 + if multilib_is_native_abi; then
681 + echo true
682 + else
683 + echo false
684 + fi
685 +}
686 +
687 +meson_multilib_native_use() {
688 + if multilib_is_native_abi && use "$1"; then
689 + echo true
690 + else
691 + echo false
692 + fi
693 +}
694 +
695 +multilib_src_configure() {
696 + local myconf=(
697 + --localstatedir="${EPREFIX}/var"
698 + -Dpamlibdir="$(getpam_mod_dir)"
699 + # avoid bash-completion dep
700 + -Dbashcompletiondir="$(get_bashcompdir)"
701 + # make sure we get /bin:/sbin in PATH
702 + -Dsplit-usr=$(usex split-usr true false)
703 + -Drootprefix="$(usex split-usr "${EPREFIX:-/}" "${EPREFIX}/usr")"
704 + -Dsysvinit-path=
705 + -Dsysvrcnd-path=
706 + # Avoid infinite exec recursion, bug 642724
707 + -Dtelinit-path="${EPREFIX}/lib/sysvinit/telinit"
708 + # no deps
709 + -Defi=$(meson_multilib)
710 + -Dima=true
711 + # Optional components/dependencies
712 + -Dacl=$(meson_multilib_native_use acl)
713 + -Dapparmor=$(meson_multilib_native_use apparmor)
714 + -Daudit=$(meson_multilib_native_use audit)
715 + -Dlibcryptsetup=$(meson_multilib_native_use cryptsetup)
716 + -Dlibcurl=$(meson_multilib_native_use curl)
717 + -Delfutils=$(meson_multilib_native_use elfutils)
718 + -Dgcrypt=$(meson_use gcrypt)
719 + -Dgnu-efi=$(meson_multilib_native_use gnuefi)
720 + -Defi-libdir="${EPREFIX}/usr/$(get_libdir)"
721 + -Dmicrohttpd=$(meson_multilib_native_use http)
722 + $(usex http -Dgnutls=$(meson_multilib_native_use ssl) -Dgnutls=false)
723 + -Dimportd=$(meson_multilib_native_use importd)
724 + -Dbzip2=$(meson_multilib_native_use importd)
725 + -Dzlib=$(meson_multilib_native_use importd)
726 + -Dkmod=$(meson_multilib_native_use kmod)
727 + -Dlz4=$(meson_use lz4)
728 + -Dxz=$(meson_use lzma)
729 + -Dlibiptc=$(meson_multilib_native_use nat)
730 + -Dpam=$(meson_use pam)
731 + -Dpcre2=$(meson_multilib_native_use pcre)
732 + -Dpolkit=$(meson_multilib_native_use policykit)
733 + -Dqrencode=$(meson_multilib_native_use qrcode)
734 + -Dseccomp=$(meson_multilib_native_use seccomp)
735 + -Dselinux=$(meson_multilib_native_use selinux)
736 + #-Dtests=$(meson_multilib_native_use test)
737 + -Ddbus=$(meson_multilib_native_use test)
738 + -Dxkbcommon=$(meson_multilib_native_use xkb)
739 + # hardcode a few paths to spare some deps
740 + -Dkill-path=/bin/kill
741 + -Dntp-servers="0.gentoo.pool.ntp.org 1.gentoo.pool.ntp.org 2.gentoo.pool.ntp.org 3.gentoo.pool.ntp.org"
742 + # Breaks screen, tmux, etc.
743 + -Ddefault-kill-user-processes=false
744 +
745 + # multilib options
746 + -Dbacklight=$(meson_multilib)
747 + -Dbinfmt=$(meson_multilib)
748 + -Dcoredump=$(meson_multilib)
749 + -Denvironment-d=$(meson_multilib)
750 + -Dfirstboot=$(meson_multilib)
751 + -Dhibernate=$(meson_multilib)
752 + -Dhostnamed=$(meson_multilib)
753 + -Dhwdb=$(meson_multilib)
754 + -Dldconfig=$(meson_multilib)
755 + -Dlocaled=$(meson_multilib)
756 + -Dman=$(meson_multilib)
757 + -Dnetworkd=$(meson_multilib)
758 + -Dquotacheck=$(meson_multilib)
759 + -Drandomseed=$(meson_multilib)
760 + -Drfkill=$(meson_multilib)
761 + -Dsysusers=$(meson_multilib)
762 + -Dtimedated=$(meson_multilib)
763 + -Dtimesyncd=$(meson_multilib)
764 + -Dtmpfiles=$(meson_multilib)
765 + -Dvconsole=$(meson_multilib)
766 + )
767 +
768 + if multilib_is_native_abi && use idn; then
769 + myconf+=(
770 + -Dlibidn2=$(usex libidn2 true false)
771 + -Dlibidn=$(usex libidn2 false true)
772 + )
773 + else
774 + myconf+=(
775 + -Dlibidn2=false
776 + -Dlibidn=false
777 + )
778 + fi
779 +
780 + meson_src_configure "${myconf[@]}"
781 +}
782 +
783 +multilib_src_compile() {
784 + eninja
785 +}
786 +
787 +multilib_src_test() {
788 + unset DBUS_SESSION_BUS_ADDRESS XDG_RUNTIME_DIR
789 + eninja test
790 +}
791 +
792 +multilib_src_install() {
793 + DESTDIR="${D}" eninja install
794 +}
795 +
796 +multilib_src_install_all() {
797 + local rootprefix=$(usex split-usr '' /usr)
798 +
799 + # meson doesn't know about docdir
800 + mv "${ED}"/usr/share/doc/{systemd,${PF}} || die
801 +
802 + einstalldocs
803 + dodoc "${FILESDIR}"/nsswitch.conf
804 +
805 + if ! use resolvconf; then
806 + rm -f "${ED}${rootprefix}"/sbin/resolvconf || die
807 + fi
808 +
809 + if ! use sysv-utils; then
810 + rm "${ED}${rootprefix}"/sbin/{halt,init,poweroff,reboot,runlevel,shutdown,telinit} || die
811 + rm "${ED}"/usr/share/man/man1/init.1 || die
812 + rm "${ED}"/usr/share/man/man8/{halt,poweroff,reboot,runlevel,shutdown,telinit}.8 || die
813 + fi
814 +
815 + if ! use resolvconf && ! use sysv-utils; then
816 + rmdir "${ED}${rootprefix}"/sbin || die
817 + fi
818 +
819 + # Preserve empty dirs in /etc & /var, bug #437008
820 + keepdir /etc/{binfmt.d,modules-load.d,tmpfiles.d}
821 + keepdir /etc/systemd/{ntp-units.d,user} /var/lib/systemd
822 + keepdir /etc/udev/{hwdb.d,rules.d}
823 + keepdir /var/log/journal/remote
824 +
825 + # Symlink /etc/sysctl.conf for easy migration.
826 + dosym ../sysctl.conf /etc/sysctl.d/99-sysctl.conf
827 +
828 + # If we install these symlinks, there is no way for the sysadmin to remove them
829 + # permanently.
830 + rm -f "${ED}"/etc/systemd/system/multi-user.target.wants/systemd-networkd.service || die
831 + rm -f "${ED}"/etc/systemd/system/dbus-org.freedesktop.network1.service || die
832 + rm -f "${ED}"/etc/systemd/system/multi-user.target.wants/systemd-resolved.service || die
833 + rm -f "${ED}"/etc/systemd/system/dbus-org.freedesktop.resolve1.service || die
834 + rm -fr "${ED}"/etc/systemd/system/network-online.target.wants || die
835 + rm -fr "${ED}"/etc/systemd/system/sockets.target.wants || die
836 + rm -fr "${ED}"/etc/systemd/system/sysinit.target.wants || die
837 +
838 + local udevdir=/lib/udev
839 + use split-usr || udevdir=/usr/lib/udev
840 +
841 + rm -r "${ED}${udevdir}/hwdb.d" || die
842 +
843 + if use split-usr; then
844 + # Avoid breaking boot/reboot
845 + dosym ../../../lib/systemd/systemd /usr/lib/systemd/systemd
846 + dosym ../../../lib/systemd/systemd-shutdown /usr/lib/systemd/systemd-shutdown
847 + fi
848 +}
849 +
850 +migrate_locale() {
851 + local envd_locale_def="${EROOT}/etc/env.d/02locale"
852 + local envd_locale=( "${EROOT}"/etc/env.d/??locale )
853 + local locale_conf="${EROOT}/etc/locale.conf"
854 +
855 + if [[ ! -L ${locale_conf} && ! -e ${locale_conf} ]]; then
856 + # If locale.conf does not exist...
857 + if [[ -e ${envd_locale} ]]; then
858 + # ...either copy env.d/??locale if there's one
859 + ebegin "Moving ${envd_locale} to ${locale_conf}"
860 + mv "${envd_locale}" "${locale_conf}"
861 + eend ${?} || FAIL=1
862 + else
863 + # ...or create a dummy default
864 + ebegin "Creating ${locale_conf}"
865 + cat > "${locale_conf}" <<-EOF
866 + # This file has been created by the sys-apps/systemd ebuild.
867 + # See locale.conf(5) and localectl(1).
868 +
869 + # LANG=${LANG}
870 + EOF
871 + eend ${?} || FAIL=1
872 + fi
873 + fi
874 +
875 + if [[ ! -L ${envd_locale} ]]; then
876 + # now, if env.d/??locale is not a symlink (to locale.conf)...
877 + if [[ -e ${envd_locale} ]]; then
878 + # ...warn the user that he has duplicate locale settings
879 + ewarn
880 + ewarn "To ensure consistent behavior, you should replace ${envd_locale}"
881 + ewarn "with a symlink to ${locale_conf}. Please migrate your settings"
882 + ewarn "and create the symlink with the following command:"
883 + ewarn "ln -s -n -f ../locale.conf ${envd_locale}"
884 + ewarn
885 + else
886 + # ...or just create the symlink if there's nothing here
887 + ebegin "Creating ${envd_locale_def} -> ../locale.conf symlink"
888 + ln -n -s ../locale.conf "${envd_locale_def}"
889 + eend ${?} || FAIL=1
890 + fi
891 + fi
892 +}
893 +
894 +pkg_postinst() {
895 + newusergroup() {
896 + enewgroup "$1"
897 + enewuser "$1" -1 -1 -1 "$1"
898 + }
899 +
900 + enewgroup input
901 + enewgroup kvm 78
902 + enewgroup render
903 + enewgroup systemd-journal
904 + newusergroup systemd-bus-proxy
905 + newusergroup systemd-coredump
906 + newusergroup systemd-journal-gateway
907 + newusergroup systemd-journal-remote
908 + newusergroup systemd-journal-upload
909 + newusergroup systemd-network
910 + newusergroup systemd-resolve
911 + newusergroup systemd-timesync
912 +
913 + systemd_update_catalog
914 +
915 + # Keep this here in case the database format changes so it gets updated
916 + # when required. Despite that this file is owned by sys-apps/hwids.
917 + if has_version "sys-apps/hwids[udev]"; then
918 + udevadm hwdb --update --root="${EROOT}"
919 + fi
920 +
921 + udev_reload || FAIL=1
922 +
923 + # Bug 465468, make sure locales are respect, and ensure consistency
924 + # between OpenRC & systemd
925 + migrate_locale
926 +
927 + systemd_reenable systemd-networkd.service systemd-resolved.service
928 +
929 + if [[ -z ${ROOT} && -d /run/systemd/system ]]; then
930 + ebegin "Reexecuting system manager"
931 + systemctl daemon-reexec
932 + eend $?
933 + fi
934 +
935 + if [[ ${FAIL} ]]; then
936 + eerror "One of the postinst commands failed. Please check the postinst output"
937 + eerror "for errors. You may need to clean up your system and/or try installing"
938 + eerror "systemd again."
939 + eerror
940 + fi
941 +}
942 +
943 +pkg_prerm() {
944 + # If removing systemd completely, remove the catalog database.
945 + if [[ ! ${REPLACED_BY_VERSION} ]]; then
946 + rm -f -v "${EROOT}"/var/lib/systemd/catalog/database
947 + fi
948 +}