summaryrefslogtreecommitdiff
path: root/sys-apps
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2019-06-22 11:40:06 +0100
committerV3n3RiX <venerix@redcorelinux.org>2019-06-22 11:40:06 +0100
commit7a86906b67693cc65671d3e1476835d3a7e13092 (patch)
tree9de1b9e2cf77833183d4e5ffab2e94d0403ef725 /sys-apps
parentd56d144655e3785864da43c9acb6c228ef9360ae (diff)
gentoo resync : 22.06.2019
Diffstat (limited to 'sys-apps')
-rw-r--r--sys-apps/gawk/gawk-5.0.1.ebuild97
-rw-r--r--sys-apps/minijail/Manifest4
-rw-r--r--sys-apps/minijail/files/minijail-9-makefile.patch44
-rw-r--r--sys-apps/minijail/metadata.xml10
-rw-r--r--sys-apps/minijail/minijail-9.ebuild71
-rw-r--r--sys-apps/s6-linux-init/s6-linux-init-1.0.2.0.ebuild61
-rw-r--r--sys-apps/s6-linux-utils/s6-linux-utils-2.5.0.1.ebuild40
-rw-r--r--sys-apps/s6-portable-utils/s6-portable-utils-2.2.1.3.ebuild40
-rw-r--r--sys-apps/s6-rc/s6-rc-0.5.0.0.ebuild53
-rw-r--r--sys-apps/s6/s6-2.8.0.1.ebuild45
-rw-r--r--sys-apps/shadow/shadow-4.7.ebuild212
-rw-r--r--sys-apps/systemd/files/242-file-max.patch31
-rw-r--r--sys-apps/systemd/systemd-241-r2.ebuild470
-rw-r--r--sys-apps/systemd/systemd-242-r3.ebuild493
-rw-r--r--sys-apps/util-linux/util-linux-2.34.ebuild291
15 files changed, 1962 insertions, 0 deletions
diff --git a/sys-apps/gawk/gawk-5.0.1.ebuild b/sys-apps/gawk/gawk-5.0.1.ebuild
new file mode 100644
index 000000000000..d395bd25d3fc
--- /dev/null
+++ b/sys-apps/gawk/gawk-5.0.1.ebuild
@@ -0,0 +1,97 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit toolchain-funcs multilib
+
+DESCRIPTION="GNU awk pattern-matching language"
+HOMEPAGE="https://www.gnu.org/software/gawk/gawk.html"
+SRC_URI="mirror://gnu/gawk/${P}.tar.xz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sh ~sparc ~x86 ~ppc-aix ~x64-cygwin ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+IUSE="forced-sandbox mpfr nls readline"
+
+RDEPEND="
+ dev-libs/gmp:0=
+ mpfr? ( dev-libs/mpfr:0= )
+ readline? ( sys-libs/readline:0= )
+"
+DEPEND="${RDEPEND}"
+BDEPEND="
+ nls? ( sys-devel/gettext )
+"
+
+src_prepare() {
+ default
+
+ # use symlinks rather than hardlinks, and disable version links
+ sed -i \
+ -e '/^LN =/s:=.*:= $(LN_S):' \
+ -e '/install-exec-hook:/s|$|\nfoo:|' \
+ Makefile.in doc/Makefile.in || die
+ sed -i '/^pty1:$/s|$|\n_pty1:|' test/Makefile.in || die #413327
+ # fix standards conflict on Solaris
+ if [[ ${CHOST} == *-solaris* ]] ; then
+ sed -i \
+ -e '/\<_XOPEN_SOURCE\>/s/1$/600/' \
+ -e '/\<_XOPEN_SOURCE_EXTENDED\>/s/1//' \
+ extension/inplace.c || die
+ fi
+
+ if use forced-sandbox ; then
+ # Upstream doesn't want to add a configure flag for this.
+ # https://lists.gnu.org/archive/html/bug-sed/2018-03/msg00001.html
+ sed -i \
+ -e '/^int do_flags = false;/s:false:DO_SANDBOX:' \
+ main.c || die
+ # Make sure the sed took.
+ grep -q '^int do_flags = DO_SANDBOX;' main.c || die "forcing sandbox failed"
+ fi
+}
+
+src_configure() {
+ export ac_cv_libsigsegv=no
+ local myeconfargs=(
+ --libexec='$(libdir)/misc'
+ $(use_with mpfr)
+ $(use_enable nls)
+ $(use_with readline)
+ )
+ econf "${myeconfargs[@]}"
+}
+
+src_install() {
+ rm -rf README_d # automatic dodocs barfs
+ default
+
+ # Install headers
+ insinto /usr/include/awk
+ doins *.h
+ rm "${ED}"/usr/include/awk/config.h || die
+}
+
+pkg_postinst() {
+ # symlink creation here as the links do not belong to gawk, but to any awk
+ if has_version app-admin/eselect && has_version app-eselect/eselect-awk ; then
+ eselect awk update ifunset
+ else
+ local l
+ for l in "${EROOT}"/usr/share/man/man1/gawk.1* "${EROOT}"/usr/bin/gawk ; do
+ if [[ -e ${l} ]] && ! [[ -e ${l/gawk/awk} ]] ; then
+ ln -s "${l##*/}" "${l/gawk/awk}" || die
+ fi
+ done
+ if ! [[ -e ${EROOT}/bin/awk ]] ; then
+ ln -s "../usr/bin/gawk" "${EROOT}/bin/awk" || die
+ fi
+ fi
+}
+
+pkg_postrm() {
+ if has_version app-admin/eselect && has_version app-eselect/eselect-awk ; then
+ eselect awk update ifunset
+ fi
+}
diff --git a/sys-apps/minijail/Manifest b/sys-apps/minijail/Manifest
new file mode 100644
index 000000000000..24f6e85e6c6e
--- /dev/null
+++ b/sys-apps/minijail/Manifest
@@ -0,0 +1,4 @@
+AUX minijail-9-makefile.patch 1589 BLAKE2B d2b253f769e79c179fce51b858ce9b7b70dec806e7f3f330928e5befc7a6fc12e4a09e5fca0e29404badbab2f389bb4c9385d0ecc555610d3b45df272c5d34e1 SHA512 38a3afe8c17f591e8172ad6725f04d5a898ee3ec3a97ee99c6118c1c12189061906a442b95243e7907031c194f0477c3bdbc6d96df4923b43487f60ededa403b
+DIST minijail-9.tar.gz 118700 BLAKE2B 7d2959d5dd71bd9d8d8a0b7c278dab66771740f73acec20f19502da33990ca858796b4734676ffedc404cef72eee8c419c669ba7092ac00cbafa2e410564aba2 SHA512 6d05fbe8615f410e8314045d11f7a3638f563f3311f7d52b5a0c47cad8692d11b0a7db4fbb45141b56453a9beb0de7683d58e5298f0a27029aa017539bb48717
+EBUILD minijail-9.ebuild 1664 BLAKE2B bf24144705af04455679a028b4dc2f57ef9d5c3720957ee93ac29b88c547adde9bf057ec87c53c0bb3ffdb02d6464e65985a7f125c8e29d4d666f8453b7160f2 SHA512 39bd30383281af95df050e1585b74974a86891bbfe9e4d7204f4d00dcb138a8aae65f156070dc934227ccbb7276935a0277acd3310238eec694b3263e47bb6ff
+MISC metadata.xml 301 BLAKE2B d5f9282d8aabde609103f044f2d3716395795229a7651e0c0f34df9c3995593633cf13d515fddda390096403bd1f52ca286a9c6f8fe287fb5af575b333b2146d SHA512 e88cdf0fc48e93ef15d4048015fde4939955cc48a437c9cc4f8f5053e3af4524206ee4ee3b11067fce6f0defc511484b1ba2b4afde82c9684d9df4e4750b9599
diff --git a/sys-apps/minijail/files/minijail-9-makefile.patch b/sys-apps/minijail/files/minijail-9-makefile.patch
new file mode 100644
index 000000000000..6ec44a8079ad
--- /dev/null
+++ b/sys-apps/minijail/files/minijail-9-makefile.patch
@@ -0,0 +1,44 @@
+diff --git a/Makefile b/Makefile
+index 54ee978..a50ee9a 100644
+--- a/Makefile
++++ b/Makefile
+@@ -46,8 +46,8 @@ ifeq ($(USE_SYSTEM_GTEST),no)
+ GTEST_CXXFLAGS := -std=gnu++14
+ GTEST_LIBS := gtest.a
+ else
+-GTEST_CXXFLAGS := $(shell gtest-config --cxxflags)
+-GTEST_LIBS := $(shell gtest-config --libs)
++GTEST_CXXFLAGS ?= $(shell gtest-config --cxxflags)
++GTEST_LIBS ?= $(shell gtest-config --libs)
+ endif
+
+ CORE_OBJECT_FILES := libminijail.o syscall_filter.o signal_handler.o \
+@@ -73,6 +73,7 @@ clean: CLEAN(minijail0)
+
+
+ CC_LIBRARY(libminijail.so): LDLIBS += -lcap
++CC_LIBRARY(libminijail.so): LDFLAGS += -Wl,-soname,libminijail.so
+ CC_LIBRARY(libminijail.so): $(CORE_OBJECT_FILES)
+ clean: CLEAN(libminijail.so)
+
+@@ -91,6 +92,7 @@ TEST(CXX_BINARY(libminijail_unittest)): CC_LIBRARY(libminijailpreload.so)
+
+
+ CC_LIBRARY(libminijailpreload.so): LDLIBS += -lcap -ldl
++CC_LIBRARY(libminijailpreload.so): LDFLAGS += -Wl,-soname,libminijail.so
+ CC_LIBRARY(libminijailpreload.so): libminijailpreload.o $(CORE_OBJECT_FILES)
+ clean: CLEAN(libminijailpreload.so)
+
+diff --git a/common.mk b/common.mk
+index 77879d8..1cd815b 100644
+--- a/common.mk
++++ b/common.mk
+@@ -323,7 +323,7 @@ COMMON_CFLAGS := -Wall -Wunused -Wno-unused-parameter -Werror -Wformat=2 \
+ -fno-strict-aliasing $(SSP_CFLAGS) -O1
+ CXXFLAGS += $(COMMON_CFLAGS) $(COMMON_CFLAGS-$(CXXDRIVER)) -std=gnu++14
+ CFLAGS += $(COMMON_CFLAGS) $(COMMON_CFLAGS-$(CDRIVER)) -std=gnu11
+-CPPFLAGS += -D_FORTIFY_SOURCE=2
++CPPFLAGS +=
+
+ # Enable large file support.
+ CPPFLAGS += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
diff --git a/sys-apps/minijail/metadata.xml b/sys-apps/minijail/metadata.xml
new file mode 100644
index 000000000000..aa105de6900b
--- /dev/null
+++ b/sys-apps/minijail/metadata.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="person">
+ <email>coles.david@gmail.com</email>
+ </maintainer>
+ <maintainer type="person">
+ <email>chutzpah@gentoo.org</email>
+ </maintainer>
+</pkgmetadata>
diff --git a/sys-apps/minijail/minijail-9.ebuild b/sys-apps/minijail/minijail-9.ebuild
new file mode 100644
index 000000000000..3daec8d2d3b5
--- /dev/null
+++ b/sys-apps/minijail/minijail-9.ebuild
@@ -0,0 +1,71 @@
+# Copyright 2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit linux-info toolchain-funcs
+
+DESCRIPTION="helper binary and library for sandboxing & restricting privs of service"
+HOMEPAGE="https://android.googlesource.com/platform/external/minijail"
+
+# Use GitHub mirror as Gitiles doesn't generate stable tarballs.
+SRC_URI="https://github.com/google/${PN}/archive/linux-v${PV}.tar.gz -> ${P}.tar.gz"
+
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="+seccomp test"
+
+RDEPEND="sys-libs/libcap-ng:="
+DEPEND="${RDEPEND}
+ test? (
+ virtual/pkgconfig
+ >=dev-cpp/gtest-1.8.0:=
+ )"
+
+S="${WORKDIR}/${PN}-linux-v${PV}"
+
+PATCHES=(
+ "${FILESDIR}/minijail-9-makefile.patch"
+)
+
+pkg_pretend() {
+ local CONFIG_CHECK="~NAMESPACES ~UTS_NS ~IPC_NS ~USER_NS ~PID_NS ~NET_NS
+ ~SECCOMP ~SECCOMP_FILTER ~CGROUPS"
+ check_extra_config
+}
+
+src_configure() {
+ export LIBDIR="/usr/$(get_libdir)"
+ export USE_seccomp="$(usex seccomp)"
+ export USE_SYSTEM_GTEST=yes
+ export GTEST_CXXFLAGS="$(pkg-config --cflags gtest_main)"
+ export GTEST_LIBS="$(pkg-config --libs gtest_main)"
+}
+
+src_compile() {
+ tc-env_build emake VERBOSE=1 all parse_seccomp_policy
+}
+
+src_test() {
+ GTEST_FILTER="-NamespaceTest.test_tmpfs_userns:NamespaceTest.test_namespaces" \
+ tc-env_build emake VERBOSE=1 tests
+}
+
+src_install() {
+ dosbin minijail0
+ dolib.so libminijail{,preload}.so
+ dobin parse_seccomp_policy
+
+ doman minijail0.[15]
+
+ local include_dir="/usr/include"
+
+ "${S}"/platform2_preinstall.sh "${PV}" "${include_dir}"
+ insinto "/usr/$(get_libdir)/pkgconfig"
+ doins libminijail.pc
+
+ insinto "${include_dir}"
+ doins libminijail.h
+ doins scoped_minijail.h
+}
diff --git a/sys-apps/s6-linux-init/s6-linux-init-1.0.2.0.ebuild b/sys-apps/s6-linux-init/s6-linux-init-1.0.2.0.ebuild
new file mode 100644
index 000000000000..6651fc87e2a9
--- /dev/null
+++ b/sys-apps/s6-linux-init/s6-linux-init-1.0.2.0.ebuild
@@ -0,0 +1,61 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+DESCRIPTION="Generates an init binary for s6-based init systems"
+HOMEPAGE="https://www.skarnet.org/software/s6-linux-init/"
+SRC_URI="https://www.skarnet.org/software/${PN}/${P}.tar.gz"
+
+LICENSE="ISC"
+SLOT="0/$(ver_cut 1-2)"
+KEYWORDS="~amd64 ~x86"
+IUSE="static static-libs +sysv-utils"
+
+REQUIRED_USE="static? ( static-libs )"
+
+RDEPEND=">=dev-lang/execline-2.5.1.0:=[static-libs?]
+ >=dev-libs/skalibs-2.8.1.0:=[static-libs?]
+ >=sys-apps/s6-2.8.0.1:=[static-libs?]
+"
+DEPEND="${RDEPEND}"
+
+HTML_DOCS=( doc/. )
+
+src_prepare() {
+ default
+
+ # Avoid QA warning for LDFLAGS addition; avoid overriding -fstack-protector
+ sed -i -e 's/.*-Wl,--hash-style=both$/:/' -e '/-fno-stack-protector$/d' \
+ configure || die
+}
+
+src_configure() {
+ econf \
+ --bindir=/bin \
+ --dynlibdir=/usr/$(get_libdir) \
+ --skeldir=/etc/s6-linux-init/skel \
+ --libdir=/usr/$(get_libdir)/${PN} \
+ --with-dynlib=/usr/$(get_libdir) \
+ --with-lib=/usr/$(get_libdir)/s6 \
+ --with-lib=/usr/$(get_libdir)/skalibs \
+ --with-sysdeps=/usr/$(get_libdir)/skalibs \
+ --enable-shared \
+ $(use_enable static allstatic) \
+ $(use_enable static static-libc) \
+ $(use_enable static-libs static)
+}
+
+src_install() {
+ default
+
+ if use sysv-utils ; then
+ "${D}/bin/s6-linux-init-maker" -f "${D}/etc/s6-linux-init/skel" "${T}/dir" || die
+ dosbin "${T}/dir/bin"/{halt,poweroff,reboot,shutdown,telinit}
+ fi
+}
+
+pkg_postinst() {
+ einfo "Read ${EROOT}/usr/share/doc/${PF}/html/quickstart.html"
+ einfo "for usage instructions."
+}
diff --git a/sys-apps/s6-linux-utils/s6-linux-utils-2.5.0.1.ebuild b/sys-apps/s6-linux-utils/s6-linux-utils-2.5.0.1.ebuild
new file mode 100644
index 000000000000..85381c98cad8
--- /dev/null
+++ b/sys-apps/s6-linux-utils/s6-linux-utils-2.5.0.1.ebuild
@@ -0,0 +1,40 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+DESCRIPTION="Set of tiny linux utilities"
+HOMEPAGE="https://www.skarnet.org/software/s6-linux-utils/"
+SRC_URI="https://www.skarnet.org/software/${PN}/${P}.tar.gz"
+
+LICENSE="ISC"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="static"
+
+RDEPEND="!static? ( >=dev-libs/skalibs-2.8.0.0:= )"
+DEPEND="${RDEPEND}
+ static? ( >=dev-libs/skalibs-2.8.0.0[static-libs] )
+"
+
+HTML_DOCS=( doc/. )
+
+src_prepare() {
+ default
+
+ # Avoid QA warning for LDFLAGS addition; avoid overriding -fstack-protector
+ sed -i -e 's/.*-Wl,--hash-style=both$/:/' -e '/-fno-stack-protector$/d' \
+ configure || die
+}
+
+src_configure() {
+ econf \
+ --bindir=/bin \
+ --dynlibdir=/usr/$(get_libdir) \
+ --libdir=/usr/$(get_libdir)/${PN} \
+ --with-dynlib=/usr/$(get_libdir) \
+ --with-lib=/usr/$(get_libdir)/skalibs \
+ --with-sysdeps=/usr/$(get_libdir)/skalibs \
+ $(use_enable static allstatic) \
+ $(use_enable static static-libc)
+}
diff --git a/sys-apps/s6-portable-utils/s6-portable-utils-2.2.1.3.ebuild b/sys-apps/s6-portable-utils/s6-portable-utils-2.2.1.3.ebuild
new file mode 100644
index 000000000000..f88473544beb
--- /dev/null
+++ b/sys-apps/s6-portable-utils/s6-portable-utils-2.2.1.3.ebuild
@@ -0,0 +1,40 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+DESCRIPTION="Set of tiny portable unix utilities"
+HOMEPAGE="https://www.skarnet.org/software/s6-portable-utils/"
+SRC_URI="https://www.skarnet.org/software/${PN}/${P}.tar.gz"
+
+LICENSE="ISC"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="static"
+
+RDEPEND="!static? ( >=dev-libs/skalibs-2.8.0.0:= )"
+DEPEND="${RDEPEND}
+ static? ( >=dev-libs/skalibs-2.8.0.0[static-libs] )
+"
+
+HTML_DOCS=( doc/. )
+
+src_prepare() {
+ default
+
+ # Avoid QA warning for LDFLAGS addition; avoid overriding -fstack-protector
+ sed -i -e 's/.*-Wl,--hash-style=both$/:/' -e '/-fno-stack-protector$/d' \
+ configure || die
+}
+
+src_configure() {
+ econf \
+ --bindir=/bin \
+ --dynlibdir=/usr/$(get_libdir) \
+ --libdir=/usr/$(get_libdir)/${PN} \
+ --with-dynlib=/usr/$(get_libdir) \
+ --with-lib=/usr/$(get_libdir)/skalibs \
+ --with-sysdeps=/usr/$(get_libdir)/skalibs \
+ $(use_enable static allstatic) \
+ $(use_enable static static-libc)
+}
diff --git a/sys-apps/s6-rc/s6-rc-0.5.0.0.ebuild b/sys-apps/s6-rc/s6-rc-0.5.0.0.ebuild
new file mode 100644
index 000000000000..6830fe022a56
--- /dev/null
+++ b/sys-apps/s6-rc/s6-rc-0.5.0.0.ebuild
@@ -0,0 +1,53 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+DESCRIPTION="Service manager for the s6 supervision suite"
+HOMEPAGE="https://www.skarnet.org/software/s6-rc/"
+SRC_URI="https://www.skarnet.org/software/${PN}/${P}.tar.gz"
+
+LICENSE="ISC"
+SLOT="0/$(ver_cut 1-2)"
+KEYWORDS="~amd64 ~x86"
+IUSE="static static-libs"
+
+REQUIRED_USE="static? ( static-libs )"
+
+RDEPEND=">=dev-lang/execline-2.5.1.0:=[static-libs?]
+ >=dev-libs/skalibs-2.8.0.0:=[static-libs?]
+ >=sys-apps/s6-2.8.0.0:=[static-libs?]
+"
+DEPEND="${RDEPEND}"
+
+HTML_DOCS=( doc/. )
+
+src_prepare() {
+ default
+
+ # Avoid QA warning for LDFLAGS addition; avoid overriding -fstack-protector
+ sed -i -e 's/.*-Wl,--hash-style=both$/:/' -e '/-fno-stack-protector$/d' \
+ configure || die
+}
+
+src_configure() {
+ econf \
+ --bindir=/bin \
+ --dynlibdir=/usr/$(get_libdir) \
+ --libdir=/usr/$(get_libdir)/${PN} \
+ --with-dynlib=/usr/$(get_libdir) \
+ --with-lib=/usr/$(get_libdir)/execline \
+ --with-lib=/usr/$(get_libdir)/s6 \
+ --with-lib=/usr/$(get_libdir)/skalibs \
+ --with-sysdeps=/usr/$(get_libdir)/skalibs \
+ --enable-shared \
+ $(use_enable static allstatic) \
+ $(use_enable static static-libc) \
+ $(use_enable static-libs static)
+}
+
+pkg_postinst() {
+ ewarn "Databases from ${PN}-0.3.0.0 or earlier must be manually upgraded!"
+ ewarn "See the upgrade notes at ${EROOT}/usr/share/doc/${PF}/html/upgrade.html"
+ ewarn "and the documentation for the s6-rc-format-upgrade utility."
+}
diff --git a/sys-apps/s6/s6-2.8.0.1.ebuild b/sys-apps/s6/s6-2.8.0.1.ebuild
new file mode 100644
index 000000000000..844ca391029d
--- /dev/null
+++ b/sys-apps/s6/s6-2.8.0.1.ebuild
@@ -0,0 +1,45 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+DESCRIPTION="skarnet.org's small and secure supervision software suite"
+HOMEPAGE="https://www.skarnet.org/software/s6/"
+SRC_URI="https://www.skarnet.org/software/${PN}/${P}.tar.gz"
+
+LICENSE="ISC"
+SLOT="0/$(ver_cut 1-2)"
+KEYWORDS="~amd64 ~arm ~x86"
+IUSE="static static-libs"
+
+REQUIRED_USE="static? ( static-libs )"
+
+RDEPEND=">=dev-lang/execline-2.5.1.0:=[static-libs?]
+ >=dev-libs/skalibs-2.8.1.0:=[static-libs?]
+"
+DEPEND="${RDEPEND}"
+
+HTML_DOCS=( doc/. )
+
+src_prepare() {
+ default
+
+ # Avoid QA warning for LDFLAGS addition; avoid overriding -fstack-protector
+ sed -i -e 's/.*-Wl,--hash-style=both$/:/' -e '/-fno-stack-protector$/d' \
+ configure || die
+}
+
+src_configure() {
+ econf \
+ --bindir=/bin \
+ --dynlibdir=/usr/$(get_libdir) \
+ --libdir=/usr/$(get_libdir)/${PN} \
+ --with-dynlib=/usr/$(get_libdir) \
+ --with-lib=/usr/$(get_libdir)/execline \
+ --with-lib=/usr/$(get_libdir)/skalibs \
+ --with-sysdeps=/usr/$(get_libdir)/skalibs \
+ --enable-shared \
+ $(use_enable static allstatic) \
+ $(use_enable static static-libc) \
+ $(use_enable static-libs static)
+}
diff --git a/sys-apps/shadow/shadow-4.7.ebuild b/sys-apps/shadow/shadow-4.7.ebuild
new file mode 100644
index 000000000000..809590ead55a
--- /dev/null
+++ b/sys-apps/shadow/shadow-4.7.ebuild
@@ -0,0 +1,212 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit libtool pam
+
+DESCRIPTION="Utilities to deal with user accounts"
+HOMEPAGE="https://github.com/shadow-maint/shadow http://pkg-shadow.alioth.debian.org/"
+SRC_URI="https://github.com/shadow-maint/shadow/releases/download/${PV}/${P}.tar.gz"
+
+LICENSE="BSD GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sh ~sparc ~x86"
+IUSE="acl audit +cracklib nls pam selinux skey xattr"
+# Taken from the man/Makefile.am file.
+LANGS=( cs da de es fi fr hu id it ja ko pl pt_BR ru sv tr zh_CN zh_TW )
+
+DEPEND="acl? ( sys-apps/acl:0= )
+ audit? ( >=sys-process/audit-2.6:0= )
+ cracklib? ( >=sys-libs/cracklib-2.7-r3:0= )
+ pam? ( virtual/pam:0= )
+ skey? ( sys-auth/skey:0= )
+ selinux? (
+ >=sys-libs/libselinux-1.28:0=
+ sys-libs/libsemanage:0=
+ )
+ nls? ( virtual/libintl )
+ xattr? ( sys-apps/attr:0= )"
+BDEPEND="
+ app-arch/xz-utils
+ nls? ( sys-devel/gettext )"
+RDEPEND="${DEPEND}
+ pam? ( >=sys-auth/pambase-20150213 )"
+
+PATCHES=(
+ "${FILESDIR}/${PN}-4.1.3-dots-in-usernames.patch"
+)
+
+src_prepare() {
+ default
+ #eautoreconf
+ elibtoolize
+}
+
+src_configure() {
+ local myeconfargs=(
+ --without-group-name-max-length
+ --without-tcb
+ --enable-shared=no
+ --enable-static=yes
+ $(use_with acl)
+ $(use_with audit)
+ $(use_with cracklib libcrack)
+ $(use_with pam libpam)
+ $(use_with skey)
+ $(use_with selinux)
+ $(use_enable nls)
+ $(use_with elibc_glibc nscd)
+ $(use_with xattr attr)
+ )
+ econf "${myeconfargs[@]}"
+
+ has_version 'sys-libs/uclibc[-rpc]' && sed -i '/RLOGIN/d' config.h #425052
+
+ if use nls ; then
+ local l langs="po" # These are the pot files.
+ for l in ${LANGS[*]} ; do
+ has ${l} ${LINGUAS-${l}} && langs+=" ${l}"
+ done
+ sed -i "/^SUBDIRS = /s:=.*:= ${langs}:" man/Makefile || die
+ fi
+}
+
+set_login_opt() {
+ local comment="" opt=$1 val=$2
+ if [[ -z ${val} ]]; then
+ comment="#"
+ sed -i \
+ -e "/^${opt}\>/s:^:#:" \
+ "${ED}"/etc/login.defs || die
+ else
+ sed -i -r \
+ -e "/^#?${opt}\>/s:.*:${opt} ${val}:" \
+ "${ED}"/etc/login.defs
+ fi
+ local res=$(grep "^${comment}${opt}\>" "${ED}"/etc/login.defs)
+ einfo "${res:-Unable to find ${opt} in /etc/login.defs}"
+}
+
+src_install() {
+ emake DESTDIR="${D}" suidperms=4711 install
+
+ # Remove libshadow and libmisc; see bug 37725 and the following
+ # comment from shadow's README.linux:
+ # Currently, libshadow.a is for internal use only, so if you see
+ # -lshadow in a Makefile of some other package, it is safe to
+ # remove it.
+ rm -f "${ED}"/{,usr/}$(get_libdir)/lib{misc,shadow}.{a,la}
+
+ insinto /etc
+ if ! use pam ; then
+ insopts -m0600
+ doins etc/login.access etc/limits
+ fi
+
+ # needed for 'useradd -D'
+ insinto /etc/default
+ insopts -m0600
+ doins "${FILESDIR}"/default/useradd
+
+ # move passwd to / to help recover broke systems #64441
+ dodir /bin
+ mv "${ED}"/usr/bin/passwd "${ED}"/bin/ || die
+ dosym ../../bin/passwd /usr/bin/passwd
+
+ cd "${S}" || die
+ insinto /etc
+ insopts -m0644
+ newins etc/login.defs login.defs
+
+ set_login_opt CREATE_HOME yes
+ if ! use pam ; then
+ set_login_opt MAIL_CHECK_ENAB no
+ set_login_opt SU_WHEEL_ONLY yes
+ set_login_opt CRACKLIB_DICTPATH /usr/$(get_libdir)/cracklib_dict
+ set_login_opt LOGIN_RETRIES 3
+ set_login_opt ENCRYPT_METHOD SHA512
+ set_login_opt CONSOLE
+ else
+ dopamd "${FILESDIR}"/pam.d-include/shadow
+
+ for x in chpasswd chgpasswd newusers; do
+ newpamd "${FILESDIR}"/pam.d-include/passwd ${x}
+ done
+
+ for x in chage chsh chfn \
+ user{add,del,mod} group{add,del,mod} ; do
+ newpamd "${FILESDIR}"/pam.d-include/shadow ${x}
+ done
+
+ # comment out login.defs options that pam hates
+ local opt sed_args=()
+ for opt in \
+ CHFN_AUTH \
+ CONSOLE \
+ CRACKLIB_DICTPATH \
+ ENV_HZ \
+ ENVIRON_FILE \
+ FAILLOG_ENAB \
+ FTMP_FILE \
+ LASTLOG_ENAB \
+ MAIL_CHECK_ENAB \
+ MOTD_FILE \
+ NOLOGINS_FILE \
+ OBSCURE_CHECKS_ENAB \
+ PASS_ALWAYS_WARN \
+ PASS_CHANGE_TRIES \
+ PASS_MIN_LEN \
+ PORTTIME_CHECKS_ENAB \
+ QUOTAS_ENAB \
+ SU_WHEEL_ONLY
+ do
+ set_login_opt ${opt}
+ sed_args+=( -e "/^#${opt}\>/b pamnote" )
+ done
+ sed -i "${sed_args[@]}" \
+ -e 'b exit' \
+ -e ': pamnote; i# NOTE: This setting should be configured via /etc/pam.d/ and not in this file.' \
+ -e ': exit' \
+ "${ED}"/etc/login.defs || die
+
+ # remove manpages that pam will install for us
+ # and/or don't apply when using pam
+ find "${ED}"/usr/share/man \
+ '(' -name 'limits.5*' -o -name 'suauth.5*' ')' \
+ -delete
+
+ # Remove pam.d files provided by pambase.
+ rm "${ED}"/etc/pam.d/{login,passwd,su} || die
+ fi
+
+ # Remove manpages that are handled by other packages
+ find "${ED}"/usr/share/man \
+ '(' -name id.1 -o -name passwd.5 -o -name getspnam.3 ')' \
+ -delete
+
+ cd "${S}" || die
+ dodoc ChangeLog NEWS TODO
+ newdoc README README.download
+ cd doc || die
+ dodoc HOWTO README* WISHLIST *.txt
+}
+
+pkg_preinst() {
+ rm -f "${EROOT}"/etc/pam.d/system-auth.new \
+ "${EROOT}/etc/login.defs.new"
+}
+
+pkg_postinst() {
+ # Enable shadow groups.
+ if [ ! -f "${EROOT}"/etc/gshadow ] ; then
+ if grpck -r -R "${EROOT}" 2>/dev/null ; then
+ grpconv -R "${EROOT}"
+ else
+ ewarn "Running 'grpck' returned errors. Please run it by hand, and then"
+ ewarn "run 'grpconv' afterwards!"
+ fi
+ fi
+
+ einfo "The 'adduser' symlink to 'useradd' has been dropped."
+}
diff --git a/sys-apps/systemd/files/242-file-max.patch b/sys-apps/systemd/files/242-file-max.patch
new file mode 100644
index 000000000000..0a1fe950e298
--- /dev/null
+++ b/sys-apps/systemd/files/242-file-max.patch
@@ -0,0 +1,31 @@
+From 6e2f78948403a4cce45b9e34311c9577c624f066 Mon Sep 17 00:00:00 2001
+From: Lennart Poettering <lennart@poettering.net>
+Date: Mon, 17 Jun 2019 10:51:25 +0200
+Subject: [PATCH] core: set fs.file-max sysctl to LONG_MAX rather than
+ ULONG_MAX
+
+Since kernel 5.2 the kernel thankfully returns proper errors when we
+write a value out of range to the sysctl. Which however breaks writing
+ULONG_MAX to request the maximum value. Hence let's write the new
+maximum value instead, LONG_MAX.
+---
+ src/core/main.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/src/core/main.c b/src/core/main.c
+index b33ea1b5b52..e7f51815f07 100644
+--- a/src/core/main.c
++++ b/src/core/main.c
+@@ -1245,9 +1245,9 @@ static void bump_file_max_and_nr_open(void) {
+ #endif
+
+ #if BUMP_PROC_SYS_FS_FILE_MAX
+- /* I so wanted to use STRINGIFY(ULONG_MAX) here, but alas we can't as glibc/gcc define that as
+- * "(0x7fffffffffffffffL * 2UL + 1UL)". Seriously. 😢 */
+- if (asprintf(&t, "%lu\n", ULONG_MAX) < 0) {
++ /* The maximum the kernel allows for this since 5.2 is LONG_MAX, use that. (Previously thing where
++ * different but the operation would fail silently.) */
++ if (asprintf(&t, "%li\n", LONG_MAX) < 0) {
+ log_oom();
+ return;
+ }
diff --git a/sys-apps/systemd/systemd-241-r2.ebuild b/sys-apps/systemd/systemd-241-r2.ebuild
new file mode 100644
index 000000000000..f1d8b6296e60
--- /dev/null
+++ b/sys-apps/systemd/systemd-241-r2.ebuild
@@ -0,0 +1,470 @@
+# Copyright 2011-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+if [[ ${PV} == 9999 ]]; then
+ EGIT_REPO_URI="https://github.com/systemd/systemd.git"
+ inherit git-r3
+else
+ MY_PV=${PV/_/-}
+ MY_P=${PN}-${MY_PV}
+ S=${WORKDIR}/${MY_P}
+ SRC_URI="https://github.com/systemd/systemd/archive/v${MY_PV}/${MY_P}.tar.gz"
+ KEYWORDS="alpha amd64 arm arm64 ~hppa ia64 ~mips ppc ppc64 sparc x86"
+fi
+
+PYTHON_COMPAT=( python{3_5,3_6,3_7} )
+
+inherit bash-completion-r1 linux-info meson multilib-minimal ninja-utils pam python-any-r1 systemd toolchain-funcs udev user
+
+DESCRIPTION="System and service manager for Linux"
+HOMEPAGE="https://www.freedesktop.org/wiki/Software/systemd"
+
+LICENSE="GPL-2 LGPL-2.1 MIT public-domain"
+SLOT="0/2"
+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"
+
+REQUIRED_USE="importd? ( curl gcrypt lzma )"
+RESTRICT="!test? ( test )"
+
+MINKV="3.11"
+
+COMMON_DEPEND=">=sys-apps/util-linux-2.30:0=[${MULTILIB_USEDEP}]
+ sys-libs/libcap:0=[${MULTILIB_USEDEP}]
+ !<sys-libs/glibc-2.16
+ acl? ( sys-apps/acl:0= )
+ apparmor? ( sys-libs/libapparmor:0= )
+ audit? ( >=sys-process/audit-2:0= )
+ cryptsetup? ( >=sys-fs/cryptsetup-1.6:0= )
+ curl? ( net-misc/curl:0= )
+ elfutils? ( >=dev-libs/elfutils-0.158:0= )
+ gcrypt? ( >=dev-libs/libgcrypt-1.4.5:0=[${MULTILIB_USEDEP}] )
+ http? (
+ >=net-libs/libmicrohttpd-0.9.33:0=
+ ssl? ( >=net-libs/gnutls-3.1.4:0= )
+ )
+ idn? (
+ libidn2? ( net-dns/libidn2:= )
+ !libidn2? ( net-dns/libidn:= )
+ )
+ importd? (
+ app-arch/bzip2:0=
+ sys-libs/zlib:0=
+ )
+ kmod? ( >=sys-apps/kmod-15:0= )
+ lz4? ( >=app-arch/lz4-0_p131:0=[${MULTILIB_USEDEP}] )
+ lzma? ( >=app-arch/xz-utils-5.0.5-r1:0=[${MULTILIB_USEDEP}] )
+ nat? ( net-firewall/iptables:0= )
+ pam? ( virtual/pam:=[${MULTILIB_USEDEP}] )
+ pcre? ( dev-libs/libpcre2 )
+ qrcode? ( media-gfx/qrencode:0= )
+ seccomp? ( >=sys-libs/libseccomp-2.3.3:0= )
+ selinux? ( sys-libs/libselinux:0= )
+ xkb? ( >=x11-libs/libxkbcommon-0.4.1:0= )"
+
+# baselayout-2.2 has /run
+RDEPEND="${COMMON_DEPEND}
+ >=sys-apps/baselayout-2.2
+ selinux? ( sec-policy/selinux-base-policy[systemd] )
+ sysv-utils? ( !sys-apps/sysvinit )
+ !sysv-utils? ( sys-apps/sysvinit )
+ resolvconf? ( !net-dns/openresolv )
+ !build? ( || (
+ sys-apps/util-linux[kill(-)]
+ sys-process/procps[kill(+)]
+ sys-apps/coreutils[kill(-)]
+ ) )
+ !sys-auth/nss-myhostname
+ !<sys-kernel/dracut-044
+ !sys-fs/eudev
+ !sys-fs/udev"
+
+# sys-apps/dbus: the daemon only (+ build-time lib dep for tests)
+PDEPEND=">=sys-apps/dbus-1.9.8[systemd]
+ >=sys-apps/hwids-20150417[udev]
+ >=sys-fs/udev-init-scripts-25
+ policykit? ( sys-auth/polkit )
+ !vanilla? ( sys-apps/gentoo-systemd-integration )"
+
+# Newer linux-headers needed by ia64, bug #480218
+DEPEND="
+ >=sys-kernel/linux-headers-${MINKV}
+ gnuefi? ( >=sys-boot/gnu-efi-3.0.2 )
+"
+
+BDEPEND="
+ app-arch/xz-utils:0
+ dev-util/gperf
+ >=dev-util/meson-0.46
+ >=dev-util/intltool-0.50
+ >=sys-apps/coreutils-8.16
+ sys-devel/m4
+ virtual/pkgconfig[${MULTILIB_USEDEP}]
+ test? ( sys-apps/dbus )
+ app-text/docbook-xml-dtd:4.2
+ app-text/docbook-xml-dtd:4.5
+ app-text/docbook-xsl-stylesheets
+ dev-libs/libxslt:0
+ $(python_gen_any_dep 'dev-python/lxml[${PYTHON_USEDEP}]')
+"
+
+pkg_pretend() {
+ if [[ ${MERGE_TYPE} != buildonly ]]; then
+ if use test && has pid-sandbox ${FEATURES}; then
+ ewarn "Tests are known to fail with PID sandboxing enabled."
+ ewarn "See https://bugs.gentoo.org/674458."
+ fi
+
+ local CONFIG_CHECK="~AUTOFS4_FS ~BLK_DEV_BSG ~CGROUPS
+ ~CHECKPOINT_RESTORE ~DEVTMPFS ~EPOLL ~FANOTIFY ~FHANDLE
+ ~INOTIFY_USER ~IPV6 ~NET ~NET_NS ~PROC_FS ~SIGNALFD ~SYSFS
+ ~TIMERFD ~TMPFS_XATTR ~UNIX
+ ~CRYPTO_HMAC ~CRYPTO_SHA256 ~CRYPTO_USER_API_HASH
+ ~!FW_LOADER_USER_HELPER_FALLBACK ~!GRKERNSEC_PROC ~!IDE ~!SYSFS_DEPRECATED
+ ~!SYSFS_DEPRECATED_V2"
+
+ use acl && CONFIG_CHECK+=" ~TMPFS_POSIX_ACL"
+ use seccomp && CONFIG_CHECK+=" ~SECCOMP ~SECCOMP_FILTER"
+ kernel_is -lt 3 7 && CONFIG_CHECK+=" ~HOTPLUG"
+ kernel_is -lt 4 7 && CONFIG_CHECK+=" ~DEVPTS_MULTIPLE_INSTANCES"
+ kernel_is -ge 4 10 && CONFIG_CHECK+=" ~CGROUP_BPF"
+
+ if linux_config_exists; then
+ local uevent_helper_path=$(linux_chkconfig_string UEVENT_HELPER_PATH)
+ if [[ -n ${uevent_helper_path} ]] && [[ ${uevent_helper_path} != '""' ]]; then
+ ewarn "It's recommended to set an empty value to the following kernel config option:"
+ ewarn "CONFIG_UEVENT_HELPER_PATH=${uevent_helper_path}"
+ fi
+ if linux_chkconfig_present X86; then
+ CONFIG_CHECK+=" ~DMIID"
+ fi
+ fi
+
+ if kernel_is -lt ${MINKV//./ }; then
+ ewarn "Kernel version at least ${MINKV} required"
+ fi
+
+ check_extra_config
+ fi
+}
+
+pkg_setup() {
+ :
+}
+
+src_unpack() {
+ default
+ [[ ${PV} != 9999 ]] || git-r3_src_unpack
+}
+
+src_prepare() {
+ # Do NOT add patches here
+ local PATCHES=()
+
+ [[ -d "${WORKDIR}"/patches ]] && PATCHES+=( "${WORKDIR}"/patches )
+
+ # Add local patches here
+ PATCHES+=(
+ "${FILESDIR}"/CVE-2019-6454/0001-Refuse-dbus-message-paths-longer-than-BUS_PATH_SIZE_.patch
+ "${FILESDIR}"/CVE-2019-6454/0002-Allocate-temporary-strings-to-hold-dbus-paths-on-the.patch
+ "${FILESDIR}"/241-version-dep.patch
+ "${FILESDIR}"/242-gcc-9.patch
+ "${FILESDIR}"/242-file-max.patch
+ )
+
+ if ! use vanilla; then
+ PATCHES+=(
+ "${FILESDIR}/gentoo-Dont-enable-audit-by-default.patch"
+ "${FILESDIR}/gentoo-systemd-user-pam.patch"
+ "${FILESDIR}/gentoo-uucp-group-r1.patch"
+ "${FILESDIR}/gentoo-generator-path-r1.patch"
+ )
+ fi
+
+ default
+}
+
+src_configure() {
+ # Prevent conflicts with i686 cross toolchain, bug 559726
+ tc-export AR CC NM OBJCOPY RANLIB
+
+ python_setup
+
+ multilib-minimal_src_configure
+}
+
+meson_use() {
+ usex "$1" true false
+}
+
+meson_multilib() {
+ if multilib_is_native_abi; then
+ echo true
+ else
+ echo false
+ fi
+}
+
+meson_multilib_native_use() {
+ if multilib_is_native_abi && use "$1"; then
+ echo true
+ else
+ echo false
+ fi
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --localstatedir="${EPREFIX}/var"
+ -Dpamlibdir="$(getpam_mod_dir)"
+ # avoid bash-completion dep
+ -Dbashcompletiondir="$(get_bashcompdir)"
+ # make sure we get /bin:/sbin in PATH
+ -Dsplit-usr=$(usex split-usr true false)
+ -Drootprefix="$(usex split-usr "${EPREFIX:-/}" "${EPREFIX}/usr")"
+ -Dsysvinit-path=
+ -Dsysvrcnd-path=
+ # Avoid infinite exec recursion, bug 642724
+ -Dtelinit-path="${EPREFIX}/lib/sysvinit/telinit"
+ # no deps
+ -Defi=$(meson_multilib)
+ -Dima=true
+ # Optional components/dependencies
+ -Dacl=$(meson_multilib_native_use acl)
+ -Dapparmor=$(meson_multilib_native_use apparmor)
+ -Daudit=$(meson_multilib_native_use audit)
+ -Dlibcryptsetup=$(meson_multilib_native_use cryptsetup)
+ -Dlibcurl=$(meson_multilib_native_use curl)
+ -Delfutils=$(meson_multilib_native_use elfutils)
+ -Dgcrypt=$(meson_use gcrypt)
+ -Dgnu-efi=$(meson_multilib_native_use gnuefi)
+ -Defi-libdir="${EPREFIX}/usr/$(get_libdir)"
+ -Dmicrohttpd=$(meson_multilib_native_use http)
+ $(usex http -Dgnutls=$(meson_multilib_native_use ssl) -Dgnutls=false)
+ -Dimportd=$(meson_multilib_native_use importd)
+ -Dbzip2=$(meson_multilib_native_use importd)
+ -Dzlib=$(meson_multilib_native_use importd)
+ -Dkmod=$(meson_multilib_native_use kmod)
+ -Dlz4=$(meson_use lz4)
+ -Dxz=$(meson_use lzma)
+ -Dlibiptc=$(meson_multilib_native_use nat)
+ -Dpam=$(meson_use pam)
+ -Dpcre2=$(meson_multilib_native_use pcre)
+ -Dpolkit=$(meson_multilib_native_use policykit)
+ -Dqrencode=$(meson_multilib_native_use qrcode)
+ -Dseccomp=$(meson_multilib_native_use seccomp)
+ -Dselinux=$(meson_multilib_native_use selinux)
+ #-Dtests=$(meson_multilib_native_use test)
+ -Ddbus=$(meson_multilib_native_use test)
+ -Dxkbcommon=$(meson_multilib_native_use xkb)
+ # hardcode a few paths to spare some deps
+ -Dkill-path=/bin/kill
+ -Dntp-servers="0.gentoo.pool.ntp.org 1.gentoo.pool.ntp.org 2.gentoo.pool.ntp.org 3.gentoo.pool.ntp.org"
+ # Breaks screen, tmux, etc.
+ -Ddefault-kill-user-processes=false
+
+ # multilib options
+ -Dbacklight=$(meson_multilib)
+ -Dbinfmt=$(meson_multilib)
+ -Dcoredump=$(meson_multilib)
+ -Denvironment-d=$(meson_multilib)
+ -Dfirstboot=$(meson_multilib)
+ -Dhibernate=$(meson_multilib)
+ -Dhostnamed=$(meson_multilib)
+ -Dhwdb=$(meson_multilib)
+ -Dldconfig=$(meson_multilib)
+ -Dlocaled=$(meson_multilib)
+ -Dman=$(meson_multilib)
+ -Dnetworkd=$(meson_multilib)
+ -Dquotacheck=$(meson_multilib)
+ -Drandomseed=$(meson_multilib)
+ -Drfkill=$(meson_multilib)
+ -Dsysusers=$(meson_multilib)
+ -Dtimedated=$(meson_multilib)
+ -Dtimesyncd=$(meson_multilib)
+ -Dtmpfiles=$(meson_multilib)
+ -Dvconsole=$(meson_multilib)
+ )
+
+ if multilib_is_native_abi && use idn; then
+ myconf+=(
+ -Dlibidn2=$(usex libidn2 true false)
+ -Dlibidn=$(usex libidn2 false true)
+ )
+ else
+ myconf+=(
+ -Dlibidn2=false
+ -Dlibidn=false
+ )
+ fi
+
+ meson_src_configure "${myconf[@]}"
+}
+
+multilib_src_compile() {
+ eninja
+}
+
+multilib_src_test() {
+ unset DBUS_SESSION_BUS_ADDRESS XDG_RUNTIME_DIR
+ eninja test
+}
+
+multilib_src_install() {
+ DESTDIR="${D}" eninja install
+}
+
+multilib_src_install_all() {
+ local rootprefix=$(usex split-usr '' /usr)
+
+ # meson doesn't know about docdir
+ mv "${ED}"/usr/share/doc/{systemd,${PF}} || die
+
+ einstalldocs
+ dodoc "${FILESDIR}"/nsswitch.conf
+
+ if ! use resolvconf; then
+ rm -f "${ED}${rootprefix}"/sbin/resolvconf || die
+ fi
+
+ if ! use sysv-utils; then
+ rm "${ED}${rootprefix}"/sbin/{halt,init,poweroff,reboot,runlevel,shutdown,telinit} || die
+ rm "${ED}"/usr/share/man/man1/init.1 || die
+ rm "${ED}"/usr/share/man/man8/{halt,poweroff,reboot,runlevel,shutdown,telinit}.8 || die
+ fi
+
+ if ! use resolvconf && ! use sysv-utils; then
+ rmdir "${ED}${rootprefix}"/sbin || die
+ fi
+
+ # Preserve empty dirs in /etc & /var, bug #437008
+ keepdir /etc/{binfmt.d,modules-load.d,tmpfiles.d}
+ keepdir /etc/systemd/{ntp-units.d,user} /var/lib/systemd
+ keepdir /etc/udev/{hwdb.d,rules.d}
+ keepdir /var/log/journal/remote
+
+ # Symlink /etc/sysctl.conf for easy migration.
+ dosym ../sysctl.conf /etc/sysctl.d/99-sysctl.conf
+
+ # If we install these symlinks, there is no way for the sysadmin to remove them
+ # permanently.
+ rm -f "${ED}"/etc/systemd/system/multi-user.target.wants/systemd-networkd.service || die
+ rm -f "${ED}"/etc/systemd/system/dbus-org.freedesktop.network1.service || die
+ rm -f "${ED}"/etc/systemd/system/multi-user.target.wants/systemd-resolved.service || die
+ rm -f "${ED}"/etc/systemd/system/dbus-org.freedesktop.resolve1.service || die
+ rm -fr "${ED}"/etc/systemd/system/network-online.target.wants || die
+ rm -fr "${ED}"/etc/systemd/system/sockets.target.wants || die
+ rm -fr "${ED}"/etc/systemd/system/sysinit.target.wants || die
+
+ local udevdir=/lib/udev
+ use split-usr || udevdir=/usr/lib/udev
+
+ rm -r "${ED}${udevdir}/hwdb.d" || die
+
+ if use split-usr; then
+ # Avoid breaking boot/reboot
+ dosym ../../../lib/systemd/systemd /usr/lib/systemd/systemd
+ dosym ../../../lib/systemd/systemd-shutdown /usr/lib/systemd/systemd-shutdown
+ fi
+}
+
+migrate_locale() {
+ local envd_locale_def="${EROOT}/etc/env.d/02locale"
+ local envd_locale=( "${EROOT}"/etc/env.d/??locale )
+ local locale_conf="${EROOT}/etc/locale.conf"
+
+ if [[ ! -L ${locale_conf} && ! -e ${locale_conf} ]]; then
+ # If locale.conf does not exist...
+ if [[ -e ${envd_locale} ]]; then
+ # ...either copy env.d/??locale if there's one
+ ebegin "Moving ${envd_locale} to ${locale_conf}"
+ mv "${envd_locale}" "${locale_conf}"
+ eend ${?} || FAIL=1
+ else
+ # ...or create a dummy default
+ ebegin "Creating ${locale_conf}"
+ cat > "${locale_conf}" <<-EOF
+ # This file has been created by the sys-apps/systemd ebuild.
+ # See locale.conf(5) and localectl(1).
+
+ # LANG=${LANG}
+ EOF
+ eend ${?} || FAIL=1
+ fi
+ fi
+
+ if [[ ! -L ${envd_locale} ]]; then
+ # now, if env.d/??locale is not a symlink (to locale.conf)...
+ if [[ -e ${envd_locale} ]]; then
+ # ...warn the user that he has duplicate locale settings
+ ewarn
+ ewarn "To ensure consistent behavior, you should replace ${envd_locale}"
+ ewarn "with a symlink to ${locale_conf}. Please migrate your settings"
+ ewarn "and create the symlink with the following command:"
+ ewarn "ln -s -n -f ../locale.conf ${envd_locale}"
+ ewarn
+ else
+ # ...or just create the symlink if there's nothing here
+ ebegin "Creating ${envd_locale_def} -> ../locale.conf symlink"
+ ln -n -s ../locale.conf "${envd_locale_def}"
+ eend ${?} || FAIL=1
+ fi
+ fi
+}
+
+pkg_postinst() {
+ newusergroup() {
+ enewgroup "$1"
+ enewuser "$1" -1 -1 -1 "$1"
+ }
+
+ enewgroup input
+ enewgroup kvm 78
+ enewgroup render
+ enewgroup systemd-journal
+ newusergroup systemd-bus-proxy
+ newusergroup systemd-coredump
+ newusergroup systemd-journal-gateway
+ newusergroup systemd-journal-remote
+ newusergroup systemd-journal-upload
+ newusergroup systemd-network
+ newusergroup systemd-resolve
+ newusergroup systemd-timesync
+
+ systemd_update_catalog
+
+ # Keep this here in case the database format changes so it gets updated
+ # when required. Despite that this file is owned by sys-apps/hwids.
+ if has_version "sys-apps/hwids[udev]"; then
+ udevadm hwdb --update --root="${EROOT}"
+ fi
+
+ udev_reload || FAIL=1
+
+ # Bug 465468, make sure locales are respect, and ensure consistency
+ # between OpenRC & systemd
+ migrate_locale
+
+ systemd_reenable systemd-networkd.service systemd-resolved.service
+
+ if [[ -z ${ROOT} && -d /run/systemd/system ]]; then
+ ebegin "Reexecuting system manager"
+ systemctl daemon-reexec
+ eend $?
+ fi
+
+ if [[ ${FAIL} ]]; then
+ eerror "One of the postinst commands failed. Please check the postinst output"
+ eerror "for errors. You may need to clean up your system and/or try installing"
+ eerror "systemd again."
+ eerror
+ fi
+}
+
+pkg_prerm() {
+ # If removing systemd completely, remove the catalog database.
+ if [[ ! ${REPLACED_BY_VERSION} ]]; then
+ rm -f -v "${EROOT}"/var/lib/systemd/catalog/database
+ fi
+}
diff --git a/sys-apps/systemd/systemd-242-r3.ebuild b/sys-apps/systemd/systemd-242-r3.ebuild
new file mode 100644
index 000000000000..4af6fc44b6e6
--- /dev/null
+++ b/sys-apps/systemd/systemd-242-r3.ebuild
@@ -0,0 +1,493 @@
+# Copyright 2011-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+if [[ ${PV} == 9999 ]]; then
+ EGIT_REPO_URI="https://github.com/systemd/systemd.git"
+ inherit git-r3
+else
+ MY_PV=${PV/_/-}
+ MY_P=${PN}-${MY_PV}
+ S=${WORKDIR}/${MY_P}
+ SRC_URI="https://github.com/systemd/systemd/archive/v${MY_PV}/${MY_P}.tar.gz"
+ KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86"
+fi
+
+PYTHON_COMPAT=( python{3_5,3_6,3_7} )
+
+inherit bash-completion-r1 linux-info meson multilib-minimal ninja-utils pam python-any-r1 systemd toolchain-funcs udev user
+
+DESCRIPTION="System and service manager for Linux"
+HOMEPAGE="https://www.freedesktop.org/wiki/Software/systemd"
+
+LICENSE="GPL-2 LGPL-2.1 MIT public-domain"
+SLOT="0/2"
+IUSE="acl apparmor audit build cryptsetup curl dns-over-tls elfutils +gcrypt gnuefi gnutls http idn importd +kmod libidn2 +lz4 lzma nat pam pcre policykit qrcode +resolvconf +seccomp selinux +split-usr +sysv-utils test vanilla xkb"
+
+REQUIRED_USE="importd? ( curl gcrypt lzma )"
+RESTRICT="!test? ( test )"
+
+MINKV="3.11"
+
+COMMON_DEPEND=">=sys-apps/util-linux-2.30:0=[${MULTILIB_USEDEP}]
+ sys-libs/libcap:0=[${MULTILIB_USEDEP}]
+ !<sys-libs/glibc-2.16
+ acl? ( sys-apps/acl:0= )
+ apparmor? ( sys-libs/libapparmor:0= )
+ audit? ( >=sys-process/audit-2:0= )
+ cryptsetup? ( >=sys-fs/cryptsetup-1.6:0= )
+ curl? ( net-misc/curl:0= )
+ dns-over-tls? (
+ gnutls? ( >=net-libs/gnutls-3.5.3:0= )
+ !gnutls? ( >=dev-libs/openssl-1.1.0:0= )
+ )
+ elfutils? ( >=dev-libs/elfutils-0.158:0= )
+ gcrypt? ( >=dev-libs/libgcrypt-1.4.5:0=[${MULTILIB_USEDEP}] )
+ http? (
+ >=net-libs/libmicrohttpd-0.9.33:0=
+ gnutls? ( >=net-libs/gnutls-3.1.4:0= )
+ )
+ idn? (
+ libidn2? ( net-dns/libidn2:= )
+ !libidn2? ( net-dns/libidn:= )
+ )
+ importd? (
+ app-arch/bzip2:0=
+ sys-libs/zlib:0=
+ )
+ kmod? ( >=sys-apps/kmod-15:0= )
+ lz4? ( >=app-arch/lz4-0_p131:0=[${MULTILIB_USEDEP}] )
+ lzma? ( >=app-arch/xz-utils-5.0.5-r1:0=[${MULTILIB_USEDEP}] )
+ nat? ( net-firewall/iptables:0= )
+ pam? ( virtual/pam:=[${MULTILIB_USEDEP}] )
+ pcre? ( dev-libs/libpcre2 )
+ qrcode? ( media-gfx/qrencode:0= )
+ seccomp? ( >=sys-libs/libseccomp-2.3.3:0= )
+ selinux? ( sys-libs/libselinux:0= )
+ xkb? ( >=x11-libs/libxkbcommon-0.4.1:0= )"
+
+# baselayout-2.2 has /run
+RDEPEND="${COMMON_DEPEND}
+ >=sys-apps/baselayout-2.2
+ selinux? ( sec-policy/selinux-base-policy[systemd] )
+ sysv-utils? ( !sys-apps/sysvinit )
+ !sysv-utils? ( sys-apps/sysvinit )
+ resolvconf? ( !net-dns/openresolv )
+ !build? ( || (
+ sys-apps/util-linux[kill(-)]
+ sys-process/procps[kill(+)]
+ sys-apps/coreutils[kill(-)]
+ ) )
+ !sys-auth/nss-myhostname
+ !<sys-kernel/dracut-044
+ !sys-fs/eudev
+ !sys-fs/udev"
+
+# sys-apps/dbus: the daemon only (+ build-time lib dep for tests)
+PDEPEND=">=sys-apps/dbus-1.9.8[systemd]
+ >=sys-apps/hwids-20150417[udev]
+ >=sys-fs/udev-init-scripts-25
+ policykit? ( sys-auth/polkit )
+ !vanilla? ( sys-apps/gentoo-systemd-integration )"
+
+# Newer linux-headers needed by ia64, bug #480218
+DEPEND="
+ >=sys-kernel/linux-headers-${MINKV}
+ gnuefi? ( >=sys-boot/gnu-efi-3.0.2 )
+"
+
+BDEPEND="
+ app-arch/xz-utils:0
+ dev-util/gperf
+ >=dev-util/meson-0.46
+ >=dev-util/intltool-0.50
+ >=sys-apps/coreutils-8.16
+ sys-devel/m4
+ virtual/pkgconfig[${MULTILIB_USEDEP}]
+ test? ( sys-apps/dbus )
+ app-text/docbook-xml-dtd:4.2
+ app-text/docbook-xml-dtd:4.5
+ app-text/docbook-xsl-stylesheets
+ dev-libs/libxslt:0
+ $(python_gen_any_dep 'dev-python/lxml[${PYTHON_USEDEP}]')
+"
+
+pkg_pretend() {
+ if [[ ${MERGE_TYPE} != buildonly ]]; then
+ if use test && has pid-sandbox ${FEATURES}; then
+ ewarn "Tests are known to fail with PID sandboxing enabled."
+ ewarn "See https://bugs.gentoo.org/674458."
+ fi
+
+ local CONFIG_CHECK="~AUTOFS4_FS ~BLK_DEV_BSG ~CGROUPS
+ ~CHECKPOINT_RESTORE ~DEVTMPFS ~EPOLL ~FANOTIFY ~FHANDLE
+ ~INOTIFY_USER ~IPV6 ~NET ~NET_NS ~PROC_FS ~SIGNALFD ~SYSFS
+ ~TIMERFD ~TMPFS_XATTR ~UNIX
+ ~CRYPTO_HMAC ~CRYPTO_SHA256 ~CRYPTO_USER_API_HASH
+ ~!FW_LOADER_USER_HELPER_FALLBACK ~!GRKERNSEC_PROC ~!IDE ~!SYSFS_DEPRECATED
+ ~!SYSFS_DEPRECATED_V2"
+
+ use acl && CONFIG_CHECK+=" ~TMPFS_POSIX_ACL"
+ use seccomp && CONFIG_CHECK+=" ~SECCOMP ~SECCOMP_FILTER"
+ kernel_is -lt 3 7 && CONFIG_CHECK+=" ~HOTPLUG"
+ kernel_is -lt 4 7 && CONFIG_CHECK+=" ~DEVPTS_MULTIPLE_INSTANCES"
+ kernel_is -ge 4 10 && CONFIG_CHECK+=" ~CGROUP_BPF"
+
+ if linux_config_exists; then
+ local uevent_helper_path=$(linux_chkconfig_string UEVENT_HELPER_PATH)
+ if [[ -n ${uevent_helper_path} ]] && [[ ${uevent_helper_path} != '""' ]]; then
+ ewarn "It's recommended to set an empty value to the following kernel config option:"
+ ewarn "CONFIG_UEVENT_HELPER_PATH=${uevent_helper_path}"
+ fi
+ if linux_chkconfig_present X86; then
+ CONFIG_CHECK+=" ~DMIID"
+ fi
+ fi
+
+ if kernel_is -lt ${MINKV//./ }; then
+ ewarn "Kernel version at least ${MINKV} required"
+ fi
+
+ check_extra_config
+ fi
+}
+
+pkg_setup() {
+ :
+}
+
+src_unpack() {
+ default
+ [[ ${PV} != 9999 ]] || git-r3_src_unpack
+}
+
+src_prepare() {
+ # Do NOT add patches here
+ local PATCHES=()
+
+ [[ -d "${WORKDIR}"/patches ]] && PATCHES+=( "${WORKDIR}"/patches )
+
+ # Add local patches here
+ PATCHES+=(
+ "${FILESDIR}"/242-gcc-9.patch
+ "${FILESDIR}"/242-socket-util-flush-accept.patch
+ "${FILESDIR}"/242-wireguard-listenport.patch
+ "${FILESDIR}"/242-file-max.patch
+ )
+
+ if ! use vanilla; then
+ PATCHES+=(
+ "${FILESDIR}/gentoo-Dont-enable-audit-by-default.patch"
+ "${FILESDIR}/gentoo-systemd-user-pam.patch"
+ "${FILESDIR}/gentoo-uucp-group-r1.patch"
+ "${FILESDIR}/gentoo-generator-path-r1.patch"
+ )
+ fi
+
+ default
+}
+
+src_configure() {
+ # Prevent conflicts with i686 cross toolchain, bug 559726
+ tc-export AR CC NM OBJCOPY RANLIB
+
+ python_setup
+
+ multilib-minimal_src_configure
+}
+
+meson_use() {
+ usex "$1" true false
+}
+
+meson_multilib() {
+ if multilib_is_native_abi; then
+ echo true
+ else
+ echo false
+ fi
+}
+
+meson_multilib_native_use() {
+ if multilib_is_native_abi && use "$1"; then
+ echo true
+ else
+ echo false
+ fi
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --localstatedir="${EPREFIX}/var"
+ -Dpamlibdir="$(getpam_mod_dir)"
+ # avoid bash-completion dep
+ -Dbashcompletiondir="$(get_bashcompdir)"
+ # make sure we get /bin:/sbin in PATH
+ -Dsplit-usr=$(usex split-usr true false)
+ -Drootprefix="$(usex split-usr "${EPREFIX:-/}" "${EPREFIX}/usr")"
+ -Dsysvinit-path=
+ -Dsysvrcnd-path=
+ # Avoid infinite exec recursion, bug 642724
+ -Dtelinit-path="${EPREFIX}/lib/sysvinit/telinit"
+ # no deps
+ -Defi=$(meson_multilib)
+ -Dima=true
+ # Optional components/dependencies
+ -Dacl=$(meson_multilib_native_use acl)
+ -Dapparmor=$(meson_multilib_native_use apparmor)
+ -Daudit=$(meson_multilib_native_use audit)
+ -Dlibcryptsetup=$(meson_multilib_native_use cryptsetup)
+ -Dlibcurl=$(meson_multilib_native_use curl)
+ -Delfutils=$(meson_multilib_native_use elfutils)
+ -Dgcrypt=$(meson_use gcrypt)
+ -Dgnu-efi=$(meson_multilib_native_use gnuefi)
+ -Dgnutls=$(meson_multilib_native_use gnutls)
+ -Defi-libdir="${EPREFIX}/usr/$(get_libdir)"
+ -Dmicrohttpd=$(meson_multilib_native_use http)
+ -Dimportd=$(meson_multilib_native_use importd)
+ -Dbzip2=$(meson_multilib_native_use importd)
+ -Dzlib=$(meson_multilib_native_use importd)
+ -Dkmod=$(meson_multilib_native_use kmod)
+ -Dlz4=$(meson_use lz4)
+ -Dxz=$(meson_use lzma)
+ -Dlibiptc=$(meson_multilib_native_use nat)
+ -Dpam=$(meson_use pam)
+ -Dpcre2=$(meson_multilib_native_use pcre)
+ -Dpolkit=$(meson_multilib_native_use policykit)
+ -Dqrencode=$(meson_multilib_native_use qrcode)
+ -Dseccomp=$(meson_multilib_native_use seccomp)
+ -Dselinux=$(meson_multilib_native_use selinux)
+ -Ddbus=$(meson_multilib_native_use test)
+ -Dxkbcommon=$(meson_multilib_native_use xkb)
+ # hardcode a few paths to spare some deps
+ -Dkill-path=/bin/kill
+ -Dntp-servers="0.gentoo.pool.ntp.org 1.gentoo.pool.ntp.org 2.gentoo.pool.ntp.org 3.gentoo.pool.ntp.org"
+ # Breaks screen, tmux, etc.
+ -Ddefault-kill-user-processes=false
+
+ # multilib options
+ -Dbacklight=$(meson_multilib)
+ -Dbinfmt=$(meson_multilib)
+ -Dcoredump=$(meson_multilib)
+ -Denvironment-d=$(meson_multilib)
+ -Dfirstboot=$(meson_multilib)
+ -Dhibernate=$(meson_multilib)
+ -Dhostnamed=$(meson_multilib)
+ -Dhwdb=$(meson_multilib)
+ -Dldconfig=$(meson_multilib)
+ -Dlocaled=$(meson_multilib)
+ -Dman=$(meson_multilib)
+ -Dnetworkd=$(meson_multilib)
+ -Dquotacheck=$(meson_multilib)
+ -Drandomseed=$(meson_multilib)
+ -Drfkill=$(meson_multilib)
+ -Dsysusers=$(meson_multilib)
+ -Dtimedated=$(meson_multilib)
+ -Dtimesyncd=$(meson_multilib)
+ -Dtmpfiles=$(meson_multilib)
+ -Dvconsole=$(meson_multilib)
+ )
+
+ if multilib_is_native_abi && use idn; then
+ myconf+=(
+ -Dlibidn2=$(usex libidn2 true false)
+ -Dlibidn=$(usex libidn2 false true)
+ )
+ else
+ myconf+=(
+ -Dlibidn2=false
+ -Dlibidn=false
+ )
+ fi
+
+ if multilib_is_native_abi && use dns-over-tls; then
+ myconf+=(
+ -Ddns-over-tls=true
+ -Dopenssl=$(usex !gnutls true false)
+ )
+ else
+ myconf+=( -Ddns-over-tls=false -Dopenssl=false )
+ fi
+
+ meson_src_configure "${myconf[@]}"
+}
+
+multilib_src_compile() {
+ eninja
+}
+
+multilib_src_test() {
+ unset DBUS_SESSION_BUS_ADDRESS XDG_RUNTIME_DIR
+ eninja test
+}
+
+multilib_src_install() {
+ DESTDIR="${D}" eninja install
+}
+
+multilib_src_install_all() {
+ local rootprefix=$(usex split-usr '' /usr)
+
+ # meson doesn't know about docdir
+ mv "${ED}"/usr/share/doc/{systemd,${PF}} || die
+
+ einstalldocs
+ dodoc "${FILESDIR}"/nsswitch.conf
+
+ if ! use resolvconf; then
+ rm -f "${ED}${rootprefix}"/sbin/resolvconf || die
+ fi
+
+ if ! use sysv-utils; then
+ rm "${ED}${rootprefix}"/sbin/{halt,init,poweroff,reboot,runlevel,shutdown,telinit} || die
+ rm "${ED}"/usr/share/man/man1/init.1 || die
+ rm "${ED}"/usr/share/man/man8/{halt,poweroff,reboot,runlevel,shutdown,telinit}.8 || die
+ fi
+
+ if ! use resolvconf && ! use sysv-utils; then
+ rmdir "${ED}${rootprefix}"/sbin || die
+ fi
+
+ # Preserve empty dirs in /etc & /var, bug #437008
+ keepdir /etc/{binfmt.d,modules-load.d,tmpfiles.d}
+ keepdir /etc/systemd/{ntp-units.d,user} /var/lib/systemd
+ keepdir /etc/udev/{hwdb.d,rules.d}
+ keepdir /var/log/journal/remote
+
+ # Symlink /etc/sysctl.conf for easy migration.
+ dosym ../sysctl.conf /etc/sysctl.d/99-sysctl.conf
+
+ local udevdir=/lib/udev
+ use split-usr || udevdir=/usr/lib/udev
+
+ rm -r "${ED}${udevdir}/hwdb.d" || die
+
+ if use split-usr; then
+ # Avoid breaking boot/reboot
+ dosym ../../../lib/systemd/systemd /usr/lib/systemd/systemd
+ dosym ../../../lib/systemd/systemd-shutdown /usr/lib/systemd/systemd-shutdown
+ fi
+}
+
+migrate_locale() {
+ local envd_locale_def="${EROOT}/etc/env.d/02locale"
+ local envd_locale=( "${EROOT}"/etc/env.d/??locale )
+ local locale_conf="${EROOT}/etc/locale.conf"
+
+ if [[ ! -L ${locale_conf} && ! -e ${locale_conf} ]]; then
+ # If locale.conf does not exist...
+ if [[ -e ${envd_locale} ]]; then
+ # ...either copy env.d/??locale if there's one
+ ebegin "Moving ${envd_locale} to ${locale_conf}"
+ mv "${envd_locale}" "${locale_conf}"
+ eend ${?} || FAIL=1
+ else
+ # ...or create a dummy default
+ ebegin "Creating ${locale_conf}"
+ cat > "${locale_conf}" <<-EOF
+ # This file has been created by the sys-apps/systemd ebuild.
+ # See locale.conf(5) and localectl(1).
+
+ # LANG=${LANG}
+ EOF
+ eend ${?} || FAIL=1
+ fi
+ fi
+
+ if [[ ! -L ${envd_locale} ]]; then
+ # now, if env.d/??locale is not a symlink (to locale.conf)...
+ if [[ -e ${envd_locale} ]]; then
+ # ...warn the user that he has duplicate locale settings
+ ewarn
+ ewarn "To ensure consistent behavior, you should replace ${envd_locale}"
+ ewarn "with a symlink to ${locale_conf}. Please migrate your settings"
+ ewarn "and create the symlink with the following command:"
+ ewarn "ln -s -n -f ../locale.conf ${envd_locale}"
+ ewarn
+ else
+ # ...or just create the symlink if there's nothing here
+ ebegin "Creating ${envd_locale_def} -> ../locale.conf symlink"
+ ln -n -s ../locale.conf "${envd_locale_def}"
+ eend ${?} || FAIL=1
+ fi
+ fi
+}
+
+save_enabled_units() {
+ ENABLED_UNITS=()
+ type systemctl &>/dev/null || return
+ for x; do
+ if systemctl --quiet --root="${ROOT:-/}" is-enabled "${x}"; then
+ ENABLED_UNITS+=( "${x}" )
+ fi
+ done
+}
+
+pkg_preinst() {
+ save_enabled_units {machines,remote-{cryptsetup,fs}}.target getty@tty1.service
+}
+
+pkg_postinst() {
+ newusergroup() {
+ enewgroup "$1"
+ enewuser "$1" -1 -1 -1 "$1"
+ }
+
+ enewgroup input
+ enewgroup kvm 78
+ enewgroup render
+ enewgroup systemd-journal
+ newusergroup systemd-bus-proxy
+ newusergroup systemd-coredump
+ newusergroup systemd-journal-gateway
+ newusergroup systemd-journal-remote
+ newusergroup systemd-journal-upload
+ newusergroup systemd-network
+ newusergroup systemd-resolve
+ newusergroup systemd-timesync
+
+ systemd_update_catalog
+
+ # Keep this here in case the database format changes so it gets updated
+ # when required. Despite that this file is owned by sys-apps/hwids.
+ if has_version "sys-apps/hwids[udev]"; then
+ udevadm hwdb --update --root="${EROOT}"
+ fi
+
+ udev_reload || FAIL=1
+
+ # Bug 465468, make sure locales are respect, and ensure consistency
+ # between OpenRC & systemd
+ migrate_locale
+
+ systemd_reenable systemd-networkd.service systemd-resolved.service
+
+ if [[ ${ENABLED_UNITS[@]} ]]; then
+ systemctl --root="${ROOT:-/}" enable "${ENABLED_UNITS[@]}"
+ fi
+
+ if [[ -L ${EROOT}/var/lib/systemd/timesync ]]; then
+ rm "${EROOT}/var/lib/systemd/timesync"
+ fi
+
+ if [[ -z ${ROOT} && -d /run/systemd/system ]]; then
+ ebegin "Reexecuting system manager"
+ systemctl daemon-reexec
+ eend $?
+ fi
+
+ if [[ ${FAIL} ]]; then
+ eerror "One of the postinst commands failed. Please check the postinst output"
+ eerror "for errors. You may need to clean up your system and/or try installing"
+ eerror "systemd again."
+ eerror
+ fi
+}
+
+pkg_prerm() {
+ # If removing systemd completely, remove the catalog database.
+ if [[ ! ${REPLACED_BY_VERSION} ]]; then
+ rm -f -v "${EROOT}"/var/lib/systemd/catalog/database
+ fi
+}
diff --git a/sys-apps/util-linux/util-linux-2.34.ebuild b/sys-apps/util-linux/util-linux-2.34.ebuild
new file mode 100644
index 000000000000..efc59ae73575
--- /dev/null
+++ b/sys-apps/util-linux/util-linux-2.34.ebuild
@@ -0,0 +1,291 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( python2_7 python3_{5,6,7} )
+
+inherit toolchain-funcs libtool flag-o-matic bash-completion-r1 \
+ pam python-r1 multilib-minimal multiprocessing systemd
+
+MY_PV="${PV/_/-}"
+MY_P="${PN}-${MY_PV}"
+
+if [[ ${PV} == 9999 ]] ; then
+ inherit git-r3 autotools
+ EGIT_REPO_URI="https://git.kernel.org/pub/scm/utils/util-linux/util-linux.git"
+else
+ [[ "${PV}" = *_rc* ]] || \
+ KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~amd64-linux ~x86-linux"
+ SRC_URI="mirror://kernel/linux/utils/util-linux/v${PV:0:4}/${MY_P}.tar.xz"
+fi
+
+DESCRIPTION="Various useful Linux utilities"
+HOMEPAGE="https://www.kernel.org/pub/linux/utils/util-linux/ https://github.com/karelzak/util-linux"
+
+LICENSE="GPL-2 LGPL-2.1 BSD-4 MIT public-domain"
+SLOT="0"
+IUSE="build caps +cramfs fdformat hardlink kill ncurses nls pam python +readline selinux slang static-libs +suid systemd test tty-helpers udev unicode userland_GNU"
+
+# Most lib deps here are related to programs rather than our libs,
+# so we rarely need to specify ${MULTILIB_USEDEP}.
+DEPEND="
+ virtual/os-headers
+ caps? ( sys-libs/libcap-ng )
+ cramfs? ( sys-libs/zlib:= )
+ ncurses? ( >=sys-libs/ncurses-5.2-r2:0=[unicode?] )
+ nls? ( virtual/libintl[${MULTILIB_USEDEP}] )
+ pam? ( sys-libs/pam )
+ python? ( ${PYTHON_DEPS} )
+ readline? ( sys-libs/readline:0= )
+ selinux? ( >=sys-libs/libselinux-2.2.2-r4[${MULTILIB_USEDEP}] )
+ slang? ( sys-libs/slang )
+ !build? ( systemd? ( sys-apps/systemd ) )
+ udev? ( virtual/libudev:= )"
+BDEPEND="
+ virtual/pkgconfig
+ nls? ( sys-devel/gettext )
+ test? ( sys-devel/bc )
+"
+RDEPEND="${DEPEND}
+ hardlink? ( !app-arch/hardlink )
+ kill? (
+ !sys-apps/coreutils[kill]
+ !sys-process/procps[kill]
+ )
+ !net-wireless/rfkill
+ !sys-process/schedutils
+ !sys-apps/setarch
+ !<sys-apps/sysvinit-2.88-r7
+ !<sys-libs/e2fsprogs-libs-1.41.8
+ !<sys-fs/e2fsprogs-1.41.8
+ !<app-shells/bash-completion-2.7-r1"
+
+REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
+
+S="${WORKDIR}/${MY_P}"
+
+src_prepare() {
+ default
+
+ # Prevent uuidd test failure due to socket path limit. #593304
+ sed -i \
+ -e "s|UUIDD_SOCKET=\"\$(mktemp -u \"\${TS_OUTDIR}/uuiddXXXXXXXXXXXXX\")\"|UUIDD_SOCKET=\"\$(mktemp -u \"${T}/uuiddXXXXXXXXXXXXX.sock\")\"|g" \
+ tests/ts/uuid/uuidd || die "Failed to fix uuidd test"
+
+ if ! use userland_GNU; then
+ # test runner is using GNU-specific xargs call
+ sed -i -e 's:xargs:gxargs:' tests/run.sh || die
+ # test requires util-linux uuidgen (which we don't build)
+ rm tests/ts/uuid/oids || die
+ fi
+
+ if [[ ${PV} == 9999 ]] ; then
+ po/update-potfiles
+ eautoreconf
+ fi
+
+ # Undo bad ncurses handling by upstream. #601530
+ sed -i -E \
+ -e '/NCURSES_/s:(ncursesw?)[56]-config:$PKG_CONFIG \1:' \
+ -e 's:(ncursesw?)[56]-config --version:$PKG_CONFIG --exists --print-errors \1:' \
+ configure || die
+
+ elibtoolize
+}
+
+lfs_fallocate_test() {
+ # Make sure we can use fallocate with LFS #300307
+ cat <<-EOF > "${T}"/fallocate.${ABI}.c
+ #define _GNU_SOURCE
+ #include <fcntl.h>
+ main() { return fallocate(0, 0, 0, 0); }
+ EOF
+ append-lfs-flags
+ $(tc-getCC) ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} "${T}"/fallocate.${ABI}.c -o /dev/null >/dev/null 2>&1 \
+ || export ac_cv_func_fallocate=no
+ rm -f "${T}"/fallocate.${ABI}.c
+}
+
+python_configure() {
+ local myeconfargs=(
+ --disable-all-programs
+ --disable-bash-completion
+ --without-systemdsystemunitdir
+ --with-python
+ )
+ if use userland_GNU; then
+ myeconfargs+=(
+ --enable-libblkid
+ --enable-libmount
+ --enable-pylibmount
+ )
+ fi
+ mkdir "${BUILD_DIR}" || die
+ pushd "${BUILD_DIR}" >/dev/null || die
+ ECONF_SOURCE="${S}" econf "${myeconfargs[@]}"
+ popd >/dev/null || die
+}
+
+multilib_src_configure() {
+ lfs_fallocate_test
+ # The scanf test in a run-time test which fails while cross-compiling.
+ # Blindly assume a POSIX setup since we require libmount, and libmount
+ # itself fails when the scanf test fails. #531856
+ tc-is-cross-compiler && export scanf_cv_alloc_modifier=ms
+ export ac_cv_header_security_pam_misc_h=$(multilib_native_usex pam) #485486
+ export ac_cv_header_security_pam_appl_h=$(multilib_native_usex pam) #545042
+
+ local myeconfargs=(
+ --enable-fs-paths-extra="${EPREFIX}/usr/sbin:${EPREFIX}/bin:${EPREFIX}/usr/bin"
+ --with-bashcompletiondir="$(get_bashcompdir)"
+ --without-python
+ $(multilib_native_use_enable suid makeinstall-chown)
+ $(multilib_native_use_enable suid makeinstall-setuid)
+ $(multilib_native_use_with readline)
+ $(multilib_native_use_with slang)
+ $(multilib_native_use_with systemd)
+ $(multilib_native_use_with udev)
+ $(multilib_native_usex ncurses "$(use_with unicode ncursesw)" '--without-ncursesw')
+ $(multilib_native_usex ncurses "$(use_with !unicode ncurses)" '--without-ncurses')
+ $(tc-has-tls || echo --disable-tls)
+ $(use_enable nls)
+ $(use_enable unicode widechar)
+ $(use_enable static-libs static)
+ $(use_with ncurses tinfo)
+ $(use_with selinux)
+ )
+ # build programs only on GNU, on *BSD we want libraries only
+ if multilib_is_native_abi && use userland_GNU; then
+ myeconfargs+=(
+ --disable-chfn-chsh
+ --disable-login
+ --disable-nologin
+ --disable-pylibmount
+ --disable-su
+ --enable-agetty
+ --enable-bash-completion
+ --enable-line
+ --enable-partx
+ --enable-raw
+ --enable-rename
+ --enable-rfkill
+ --enable-schedutils
+ --with-systemdsystemunitdir="$(systemd_get_systemunitdir)"
+ $(use_enable caps setpriv)
+ $(use_enable cramfs)
+ $(use_enable fdformat)
+ $(use_enable hardlink)
+ $(use_enable tty-helpers mesg)
+ $(use_enable tty-helpers wall)
+ $(use_enable tty-helpers write)
+ $(use_enable kill)
+ )
+ else
+ myeconfargs+=(
+ --disable-all-programs
+ --disable-bash-completion
+ --without-systemdsystemunitdir
+ # build libraries
+ --enable-libuuid
+ --enable-libblkid
+ --enable-libsmartcols
+ --enable-libfdisk
+ )
+ if use userland_GNU; then
+ # those libraries don't work on *BSD
+ myeconfargs+=(
+ --enable-libmount
+ )
+ fi
+ fi
+ ECONF_SOURCE="${S}" econf "${myeconfargs[@]}"
+
+ if multilib_is_native_abi && use python; then
+ python_foreach_impl python_configure
+ fi
+}
+
+python_compile() {
+ pushd "${BUILD_DIR}" >/dev/null || die
+ emake all
+ popd >/dev/null || die
+}
+
+multilib_src_compile() {
+ emake all
+
+ if multilib_is_native_abi && use python; then
+ python_foreach_impl python_compile
+ fi
+}
+
+python_test() {
+ pushd "${BUILD_DIR}" >/dev/null || die
+ emake check TS_OPTS="--parallel=$(makeopts_jobs) --nonroot"
+ popd >/dev/null || die
+}
+
+multilib_src_test() {
+ emake check TS_OPTS="--parallel=$(makeopts_jobs) --nonroot"
+ if multilib_is_native_abi && use python; then
+ python_foreach_impl python_test
+ fi
+}
+
+python_install() {
+ pushd "${BUILD_DIR}" >/dev/null || die
+ emake DESTDIR="${D}" install
+ python_optimize
+ popd >/dev/null || die
+}
+
+multilib_src_install() {
+ emake DESTDIR="${D}" install
+
+ if multilib_is_native_abi && use userland_GNU; then
+ # need the libs in /
+ gen_usr_ldscript -a blkid fdisk mount smartcols uuid
+ fi
+
+ if multilib_is_native_abi && use python; then
+ python_foreach_impl python_install
+ fi
+}
+
+multilib_src_install_all() {
+ dodoc AUTHORS NEWS README* Documentation/{TODO,*.txt,releases/*}
+
+ # e2fsprogs-libs didnt install .la files, and .pc work fine
+ find "${ED}" -name "*.la" -delete || die
+
+ if ! use userland_GNU; then
+ # manpage collisions
+ # TODO: figure out a good way to keep them
+ rm "${ED}"/usr/share/man/man3/uuid* || die
+ fi
+
+ if use pam; then
+ newpamd "${FILESDIR}/runuser.pamd" runuser
+ newpamd "${FILESDIR}/runuser-l.pamd" runuser-l
+ fi
+
+ # Note:
+ # Bash completion for "runuser" command is provided by same file which
+ # would also provide bash completion for "su" command. However, we don't
+ # use "su" command from this package.
+ # This triggers a known QA warning which we ignore for now to magically
+ # keep bash completion for "su" command which shadow package does not
+ # provide.
+}
+
+pkg_postinst() {
+ if ! use tty-helpers; then
+ elog "The mesg/wall/write tools have been disabled due to USE=-tty-helpers."
+ fi
+
+ if [[ -z ${REPLACING_VERSIONS} ]]; then
+ elog "The agetty util now clears the terminal by default. You"
+ elog "might want to add --noclear to your /etc/inittab lines."
+ fi
+}