diff options
-rw-r--r-- | sys-apps/systemd-utils/Manifest | 2 | ||||
-rw-r--r-- | sys-apps/systemd-utils/files/40-gentoo.rules | 3 | ||||
-rw-r--r-- | sys-apps/systemd-utils/files/systemd-tmpfiles-setup | 18 | ||||
-rw-r--r-- | sys-apps/systemd-utils/files/systemd-tmpfiles-setup-dev | 20 | ||||
-rw-r--r-- | sys-apps/systemd-utils/metadata.xml | 13 | ||||
-rw-r--r-- | sys-apps/systemd-utils/systemd-utils-250.4.ebuild | 460 |
6 files changed, 516 insertions, 0 deletions
diff --git a/sys-apps/systemd-utils/Manifest b/sys-apps/systemd-utils/Manifest new file mode 100644 index 000000000000..36c4e1be52e1 --- /dev/null +++ b/sys-apps/systemd-utils/Manifest @@ -0,0 +1,2 @@ +DIST systemd-musl-patches-250.4.tar.gz 28065 BLAKE2B b8366c4bb29705e3f41f07d0105c4d252d543aaac178e968663660eeb573da034813aa50a96c74ac78ae5efeea379e00df33c5a039ec828cf93450ed23786252 SHA512 66e41fab1873021913c32e3f43300ea7babd18a36e6543838ab7fab4c44f5590c6a7414dd50c7ee81e5513b0e5aa01cb6df4231e8e06c609d63011a32b524213 +DIST systemd-stable-250.4.tar.gz 11132786 BLAKE2B 8fdfe1bad76e572dc1be0955f3d1c4080f2beb81a2f9670f80827899f5406ab8ed8675400c2f5e8ccef44cf1bceff42ceae12a42e1b67d46c0deb523e6495f25 SHA512 307ed0920da660b6c45d909fea66864fb98db8b2f6905d629fb2012fc4bf64dd25fd61168c22bf4098200be541be9b0e815fbde98806a99c85cb33d49d8b63d0 diff --git a/sys-apps/systemd-utils/files/40-gentoo.rules b/sys-apps/systemd-utils/files/40-gentoo.rules new file mode 100644 index 000000000000..6b96bd07051e --- /dev/null +++ b/sys-apps/systemd-utils/files/40-gentoo.rules @@ -0,0 +1,3 @@ +# Gentoo specific groups +ACTION=="add", SUBSYSTEM=="block", KERNEL=="fd[0-9]", GROUP="floppy" +ACTION=="add", SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", GROUP="usb" diff --git a/sys-apps/systemd-utils/files/systemd-tmpfiles-setup b/sys-apps/systemd-utils/files/systemd-tmpfiles-setup new file mode 100644 index 000000000000..a36c1020e0db --- /dev/null +++ b/sys-apps/systemd-utils/files/systemd-tmpfiles-setup @@ -0,0 +1,18 @@ +#!/sbin/openrc-run +# Copyright 2022 Gentoo Authors +# Released under the 2-clause BSD license. + +description="Create Volatile Files and Directories" + +depend() +{ + provide tmpfiles-setup tmpfiles.setup + need localmount +} + +start() +{ + ebegin "${description}" + systemd-tmpfiles --create --remove --boot --exclude-prefix=/dev + eend $? +} diff --git a/sys-apps/systemd-utils/files/systemd-tmpfiles-setup-dev b/sys-apps/systemd-utils/files/systemd-tmpfiles-setup-dev new file mode 100644 index 000000000000..496de522d08d --- /dev/null +++ b/sys-apps/systemd-utils/files/systemd-tmpfiles-setup-dev @@ -0,0 +1,20 @@ +#!/sbin/openrc-run +# Copyright 2022 Gentoo Authors +# Released under the 2-clause BSD license. + +description="Create Static Devices Nodes in /dev" + +depend() +{ + provide tmpfiles-dev tmpfiles.dev + use dev-mount + before dev + keyword -prefix -vserver +} + +start() +{ + ebegin "${description}" + systemd-tmpfiles --prefix=/dev --create --boot + eend $? +} diff --git a/sys-apps/systemd-utils/metadata.xml b/sys-apps/systemd-utils/metadata.xml new file mode 100644 index 000000000000..efdb151f4069 --- /dev/null +++ b/sys-apps/systemd-utils/metadata.xml @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <maintainer type="project"> + <email>systemd@gentoo.org</email> + </maintainer> + <use> + <flag name="boot">Enable systemd-boot (UEFI boot manager)</flag> + <flag name="sysusers">Enable systemd-sysusers</flag> + <flag name="tmpfiles">Enable systemd-tmpfiles</flag> + <flag name="udev">Enable systemd-udev (userspace device manager)</flag> + </use> +</pkgmetadata> diff --git a/sys-apps/systemd-utils/systemd-utils-250.4.ebuild b/sys-apps/systemd-utils/systemd-utils-250.4.ebuild new file mode 100644 index 000000000000..a31cb2e5308a --- /dev/null +++ b/sys-apps/systemd-utils/systemd-utils-250.4.ebuild @@ -0,0 +1,460 @@ +# Copyright 2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 +PYTHON_COMPAT=( python3_{8..10} ) + +inherit bash-completion-r1 flag-o-matic meson-multilib python-any-r1 toolchain-funcs usr-ldscript + +DESCRIPTION="Utilities taken from systemd" +HOMEPAGE="https://systemd.io/" + +if [[ ${PV} == *.* ]]; then + MY_P="systemd-stable-${PV}" + S="${WORKDIR}/${MY_P}" + SRC_URI="https://github.com/systemd/systemd-stable/archive/refs/tags/v${PV}.tar.gz -> ${MY_P}.tar.gz" +else + MY_P="systemd-${PV}" + S="${WORKDIR}/${MY_P}" + SRC_URI="https://github.com/systemd/systemd/archive/refs/tags/v${PV}.tar.gz -> ${MY_P}.tar.gz" +fi + +MUSL_PATCHSET="systemd-musl-patches-250.4" +SRC_URI+=" elibc_musl? ( https://dev.gentoo.org/~floppym/dist/${MUSL_PATCHSET}.tar.gz )" + +LICENSE="GPL-2 LGPL-2.1 MIT public-domain" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86" +IUSE="+boot selinux +sysusers +tmpfiles test +udev" +REQUIRED_USE="|| ( boot tmpfiles sysusers udev )" +RESTRICT="!test? ( test )" + +COMMON_DEPEND=" + sys-apps/acl:0= + >=sys-apps/kmod-15:0= + selinux? ( sys-libs/libselinux:0= ) + udev? ( + >=sys-apps/util-linux-2.30:0=[${MULTILIB_USEDEP}] + sys-libs/libcap:0=[${MULTILIB_USEDEP}] + virtual/libcrypt:=[${MULTILIB_USEDEP}] + ) + !udev? ( + >=sys-apps/util-linux-2.30:0= + sys-libs/libcap:0= + virtual/libcrypt:= + ) +" +DEPEND="${COMMON_DEPEND} + boot? ( + >=sys-boot/gnu-efi-3.0.2 + ) + >=sys-kernel/linux-headers-3.11 +" +RDEPEND="${COMMON_DEPEND} + boot? ( !<sys-boot/systemd-boot-250 ) + tmpfiles? ( !<sys-apps/systemd-tmpfiles-250 ) + udev? ( + acct-group/audio + acct-group/cdrom + acct-group/dialout + acct-group/disk + acct-group/input + acct-group/kmem + acct-group/kvm + acct-group/lp + acct-group/render + acct-group/sgx + acct-group/tape + acct-group/tty + acct-group/video + !sys-apps/gentoo-systemd-integration + !sys-apps/hwids[udev] + !<sys-fs/udev-250 + ) + !sys-apps/systemd +" +PDEPEND=" + udev? ( >=sys-fs/udev-init-scripts-34 ) +" +BDEPEND=" + $(python_gen_any_dep 'dev-python/jinja[${PYTHON_USEDEP}]') + app-text/docbook-xml-dtd:4.2 + app-text/docbook-xml-dtd:4.5 + app-text/docbook-xsl-stylesheets + dev-libs/libxslt + dev-util/gperf + >=sys-apps/coreutils-8.16 + sys-devel/gettext + virtual/pkgconfig +" + +python_check_deps() { + has_version -b "dev-python/jinja[${PYTHON_USEDEP}]" +} + +QA_EXECSTACK="usr/lib/systemd/boot/efi/*" +QA_FLAGS_IGNORED="usr/lib/systemd/boot/efi/.*" + +src_prepare() { + local PATCHES=( + ) + if use elibc_musl; then + PATCHES+=( "${WORKDIR}/${MUSL_PATCHSET}" ) + fi + default + + # Remove install_rpath; we link statically + local rpath_pattern="install_rpath : rootlibexecdir," + grep -q -e "${rpath_pattern}" meson.build || die + sed -i -e "/${rpath_pattern}/d" meson.build || die +} + +multilib_src_configure() { + local emesonargs=( + -Drootprefix="${EPREFIX:-/}" + -Dsysvinit-path= + $(meson_native_true acl) + $(meson_native_use_bool boot efi) + $(meson_native_use_bool boot gnu-efi) + $(meson_native_use_bool selinux) + $(meson_native_use_bool sysusers) + $(meson_use test tests) + $(meson_native_use_bool tmpfiles) + $(meson_use udev hwdb) + + -Defi-libdir="${ESYSROOT}/usr/$(get_libdir)" + + # Link staticly with libsystemd-shared + -Dlink-boot-shared=false + -Dlink-udev-shared=false + + # systemd-tmpfiles has a separate "systemd-tmpfiles.standalone" target + -Dstandalone-binaries=true + + # Disable all optional features + -Dadm-group=false + -Danalyze=false + -Dapparmor=false + -Daudit=false + -Dbacklight=false + -Dbinfmt=false + -Dbzip2=false + -Dcoredump=false + -Ddbus=false + -Delfutils=false + -Denvironment-d=false + -Dfdisk=false + -Dgcrypt=false + -Dglib=false + -Dgshadow=false + -Dgnutls=false + -Dhibernate=false + -Dhostnamed=false + -Didn=false + -Dima=false + -Dinitrd=false + -Dfirstboot=false + -Dkernel-install=false + -Dkmod=false + -Dldconfig=false + -Dlibcryptsetup=false + -Dlibcurl=false + -Dlibfido2=false + -Dlibidn=false + -Dlibidn2=false + -Dlibiptc=false + -Dlocaled=false + -Dlogind=false + -Dlz4=false + -Dmachined=false + -Dmicrohttpd=false + -Dnetworkd=false + -Dnscd=false + -Dnss-myhostname=false + -Dnss-resolve=false + -Dnss-systemd=false + -Doomd=false + -Dopenssl=false + -Dp11kit=false + -Dpam=false + -Dpcre2=false + -Dpolkit=false + -Dportabled=false + -Dpstore=false + -Dpwquality=false + -Drandomseed=false + -Dresolve=false + -Drfkill=false + -Dseccomp=false + -Dsmack=false + -Dsysext=false + -Dtimedated=false + -Dtimesyncd=false + -Dtpm=false + -Dqrencode=false + -Dquotacheck=false + -Duserdb=false + -Dutmp=false + -Dvconsole=false + -Dwheel-group=false + -Dxdg-autostart=false + -Dxkbcommon=false + -Dxz=false + -Dzlib=false + -Dzstd=false + ) + + if use elibc_musl; then + # Avoid redefinition of struct ethhdr. + append-cppflags -D__UAPI_DEF_ETHHDR=0 + fi + + if multilib_is_native_abi || use udev; then + meson_src_configure + fi +} + +efi_arch() { + case "$(tc-arch)" in + amd64) echo x64 ;; + arm) echo arm ;; + arm64) echo aa64 ;; + x86) echo x86 ;; + esac +} + +multilib_src_compile() { + local targets=() + if multilib_is_native_abi; then + if use boot; then + targets+=( + bootctl + man/bootctl.1 + man/kernel-install.8 + src/boot/efi/linux$(efi_arch).{efi,elf}.stub + src/boot/efi/systemd-boot$(efi_arch).efi + ) + fi + if use sysusers; then + targets+=( + systemd-sysusers.standalone + man/sysusers.d.5 + man/systemd-sysusers.8 + ) + if use test; then + targets+=( + systemd-runtest.env + ) + fi + fi + if use tmpfiles; then + targets+=( + systemd-tmpfiles.standalone + man/tmpfiles.d.5 + man/systemd-tmpfiles.8 + ) + if use test; then + targets+=( test-tmpfiles ) + fi + fi + if use udev; then + targets+=( + udevadm + systemd-hwdb + src/udev/ata_id + src/udev/cdrom_id + src/udev/fido_id + src/udev/mtd_probe + src/udev/scsi_id + src/udev/udev.pc + src/udev/v4l_id + man/udev.conf.5 + man/systemd.link.5 + man/hwdb.7 + man/udev.7 + man/systemd-hwdb.8 + man/systemd-udevd.service.8 + man/udevadm.8 + hwdb.d/60-autosuspend-chromiumos.hwdb + rules.d/50-udev-default.rules + rules.d/64-btrfs.rules + ) + if use test; then + targets+=( + # Used by udev-test.pl + systemd-detect-virt + test/sys + test-udev + + test-fido-id-desc + test-udev-builtin + test-udev-event + test-udev-netlink + test-udev-node + test-udev-util + ) + fi + fi + fi + if use udev; then + targets+=( + udev:shared_library + src/libudev/libudev.pc + ) + if use test; then + targets+=( + test-libudev + test-libudev-sym + test-udev-device-thread + ) + fi + fi + if multilib_is_native_abi || use udev; then + meson_src_compile "${targets[@]}" + fi +} + +multilib_src_test() { + local tests=() + if multilib_is_native_abi; then + if use sysusers; then + tests+=( + test-sysusers.standalone + ) + fi + if use tmpfiles; then + tests+=( + test-systmed-tmpfiles + test-tmpfiles + ) + fi + if use udev; then + tests+=( + rule-syntax-check + test-fido-id-desc + test-udev-builtin + test-udev-event + test-udev-netlink + test-udev-node + test-udev-util + ) + if [[ -w /dev ]]; then + tests+=( udev-test ) + else + ewarn "Skipping udev-test (needs write access to /dev)" + fi + fi + fi + if use udev; then + tests+=( + test-libudev + test-libudev-sym + test-udev-device-thread + ) + fi + if [[ ${#tests[@]} -ne 0 ]]; then + meson_src_test "${tests[@]}" + fi +} + +multilib_src_install() { + if multilib_is_native_abi; then + if use boot; then + into /usr + dobin bootctl + doman man/{bootctl.1,kernel-install.8} + insinto usr/lib/systemd/boot/efi + doins src/boot/efi/{linux$(efi_arch).{efi,elf}.stub,systemd-boot$(efi_arch).efi} + fi + if use sysusers; then + into / + newbin systemd-sysusers{.standalone,} + doman man/{systemd-sysusers.8,sysusers.d.5} + fi + if use tmpfiles; then + into / + newbin systemd-tmpfiles{.standalone,} + doman man/{systemd-tmpfiles.8,tmpfiles.d.5} + fi + if use udev; then + into / + dobin udevadm systemd-hwdb + dosym ../../bin/udevadm /lib/systemd/systemd-udevd + exeinto /lib/udev + doexe src/udev/{ata_id,cdrom_id,fido_id,mtd_probe,scsi_id,v4l_id} + insinto /lib/udev/rules.d + doins rules.d/*.rules + insinto /lib/udev/hwdb.d + doins hwdb.d/*.hwdb + insinto /usr/share/pkgconfig + doins src/udev/udev.pc + doman man/{udev.conf.5,systemd.link.5,hwdb.7,systemd-hwdb.8,udev.7,udevadm.8} + newman man/systemd-udevd.service.8 systemd-udevd.8 + + fi + fi + if use udev; then + into /usr + dolib.so "$(readlink libudev.so.1)" libudev.so{.1,} + gen_usr_ldscript -a udev + insinto "/usr/$(get_libdir)/pkgconfig" + doins src/libudev/libudev.pc + fi +} + +multilib_src_install_all() { + einstalldocs + if use boot; then + into /usr + dobin src/kernel-install/kernel-install + exeinto usr/lib/kernel/install.d + doexe src/kernel-install/*.install + dobashcomp shell-completion/bash/bootctl + insinto /usr/share/zsh/site-functions + doins shell-completion/zsh/{_bootctl,_kernel-install} + fi + if use tmpfiles; then + doinitd "${FILESDIR}"/systemd-tmpfiles-setup + doinitd "${FILESDIR}"/systemd-tmpfiles-setup-dev + insinto /usr/share/zsh/site-functions + doins shell-completion/zsh/_systemd-tmpfiles + fi + if use udev; then + doheader src/libudev/libudev.h + insinto /etc/udev + doins src/udev/udev.conf + keepdir /etc/udev/{hwdb.d,rules.d} + insinto /lib/systemd/network + doins network/99-default.link + insinto /lib/udev/rules.d + doins rules.d/*.rules + doins "${FILESDIR}"/40-gentoo.rules + insinto /lib/udev/hwdb.d + doins hwdb.d/*.hwdb + dobashcomp shell-completion/bash/udevadm + insinto /usr/share/zsh/site-functions + doins shell-completion/zsh/_udevadm + fi +} + +add_service() { + local initd=$1 + local runlevel=$2 + + ebegin "Adding '${initd}' service to the '${runlevel}' runlevel" + mkdir -p "${EROOT}/etc/runlevels/${runlevel}" && + ln -snf "${EPREFIX}/etc/init.d/${initd}" "${EROOT}/etc/runlevels/${runlevel}/${initd}" + eend $? +} + +pkg_postinst() { + if [[ -z ${REPLACING_VERSIONS} ]]; then + add_service systemd-tmpfiles-setup-dev sysinit + add_service systemd-tmpfiles-setup boot + fi + if use udev; then + ebegin "Updating hwdb" + systemd-hwdb --root="${ROOT}" update + eend $? + fi +} |