From b3ff71473392221608366f7c721d098605a25e21 Mon Sep 17 00:00:00 2001 From: classabbyamp Date: Wed, 8 Mar 2023 19:24:00 -0500 Subject: [PATCH] New package: systemd-boot-254.2 --- srcpkgs/systemd-boot-efistub | 1 + srcpkgs/systemd-boot-ukify | 1 + srcpkgs/systemd-boot/files/systemd-boot.confd | 2 + .../files/systemd-boot.post-install | 45 +++++++++ .../files/systemd-boot.post-remove | 0 srcpkgs/systemd-boot/template | 99 +++++++++++++++++++ 6 files changed, 148 insertions(+) create mode 120000 srcpkgs/systemd-boot-efistub create mode 120000 srcpkgs/systemd-boot-ukify create mode 100644 srcpkgs/systemd-boot/files/systemd-boot.confd create mode 100644 srcpkgs/systemd-boot/files/systemd-boot.post-install create mode 100644 srcpkgs/systemd-boot/files/systemd-boot.post-remove create mode 100644 srcpkgs/systemd-boot/template diff --git a/srcpkgs/systemd-boot-efistub b/srcpkgs/systemd-boot-efistub new file mode 120000 index 0000000000000..171756f5fb675 --- /dev/null +++ b/srcpkgs/systemd-boot-efistub @@ -0,0 +1 @@ +systemd-boot \ No newline at end of file diff --git a/srcpkgs/systemd-boot-ukify b/srcpkgs/systemd-boot-ukify new file mode 120000 index 0000000000000..171756f5fb675 --- /dev/null +++ b/srcpkgs/systemd-boot-ukify @@ -0,0 +1 @@ +systemd-boot \ No newline at end of file diff --git a/srcpkgs/systemd-boot/files/systemd-boot.confd b/srcpkgs/systemd-boot/files/systemd-boot.confd new file mode 100644 index 0000000000000..eaad017a16baf --- /dev/null +++ b/srcpkgs/systemd-boot/files/systemd-boot.confd @@ -0,0 +1,2 @@ +# uncomment this line to disable the systemd-boot hook +# SYSTEMD_BOOT_DISABLE=1 diff --git a/srcpkgs/systemd-boot/files/systemd-boot.post-install b/srcpkgs/systemd-boot/files/systemd-boot.post-install new file mode 100644 index 0000000000000..707e2750eeecb --- /dev/null +++ b/srcpkgs/systemd-boot/files/systemd-boot.post-install @@ -0,0 +1,45 @@ +#!/bin/sh +# +# Kernel hook for systemd-boot. +# +# Arguments passed to this script: $1 pkgname, $2 version. +# +PKGNAME="$1" +VERSION="$2" + +. "$ROOTDIR/etc/default/systemd-boot" + +if [ "$SYSTEMD_BOOT_DISABLE" ]; then + exit 0 +fi + +boot="$ROOTDIR/boot" +entries="$boot/loader/entries" +name="void-$VERSION" +entry="$entries/$name.conf" +options="$boot/loader/void-options.conf" +loader="$boot/loader/loader.conf" + +[ -d "$boot" ] || exit 0 + +mkdir -p "$entries" + +cat <<-EOF > "$entry" + title Void Linux + version $VERSION + linux /vmlinuz-$VERSION + initrd /initramfs-$VERSION.img +EOF + +if [ -r "$options" ]; then + # Add user provided options from /boot/loader/void-options.conf: + printf 'options %s\n' "$(cat "$options" | sed '/^#/d;/^$/d')" >> "$entry" +fi + +if grep -q ^default "$loader" 2>/dev/null; then + # Replace existing default entry with this entry: + sed -i "s/default.*/default $name/" "$loader" +else + # Add this entry as the default: + printf 'default %s\n' $name >>"$loader" +fi diff --git a/srcpkgs/systemd-boot/files/systemd-boot.post-remove b/srcpkgs/systemd-boot/files/systemd-boot.post-remove new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/srcpkgs/systemd-boot/template b/srcpkgs/systemd-boot/template new file mode 100644 index 0000000000000..8386c1d39e0fe --- /dev/null +++ b/srcpkgs/systemd-boot/template @@ -0,0 +1,99 @@ +# Template file for 'systemd-boot' +pkgname=systemd-boot +version=254.2 +revision=1 +build_style=meson +configure_args="-Defi=true -Dbootloader=true + -Dsbat-distro=void -Dsbat-distro-summary=Void + -Dsbat-distro-url=https://github.com/void-linux/void-packages/issues + -Dblkid=true -Dkernel-install=true -Dlink-boot-shared=false + -Dstandalone-binaries=true -Dman=true + + -Dacl=false -Dkmod=false -Dselinux=false -Dsysusers=false -Dtmpfiles=false + -Dadm-group=false -Danalyze=false -Dapparmor=false -Daudit=false + -Dbacklight=false -Dbinfmt=false -Dbpf-framework=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 -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 + -Dtests=false" +# most of these aren't needed for what we're building but it's easier than patching +hostmakedepends="pkg-config gperf python3-Jinja2 python3-pyelftools libxslt docbook-xsl" +makedepends="libcap-devel libmount-devel" +depends="${pkgname}-efistub>=${version}_${revision}" +short_desc="UEFI boot manager from systemd" +maintainer="classabbyamp " +license="LGPL-2.1-or-later" +homepage="https://www.freedesktop.org/wiki/Software/systemd/systemd-boot/" +distfiles="https://github.com/systemd/systemd-stable/archive/refs/tags/v${version}.tar.gz" +checksum=6ebfb6ed1fbd601b56a23114b4905061ce03ab9ab8a5cccad1f8851606969c5d +make_check=no # missing printf.h + +case "${XBPS_TARGET_MACHINE}" in + x86_64*) _efi_arch="x64" ;; + i686*) _efi_arch="ia32" ;; + aarch64*) _efi_arch="aa64" ;; + arm*) _efi_arch="arm" ;; + riscv64*) _efi_arch="riscv64" ;; + *) broken="unknown efi architecture" ;; +esac + +_bins=(bootctl kernel-install ukify) +_mans=(man/bootctl.1 man/ukify.1 man/loader.conf.5 man/systemd-boot.7 man/systemd-stub.7 man/kernel-install.8) +_efis=("src/boot/efi/linux${_efi_arch}.efi.stub" "src/boot/efi/systemd-boot${_efi_arch}.efi") +_hooks=(src/kernel-install/60-ukify.install src/kernel-install/90-loaderentry.install) +make_build_target="${_bins[*]} ${_mans[*]} ${_efis[*]} ${_hooks[*]}" + +do_install() { + for b in "${_bins[@]}"; do + vbin "build/$b" + done + for m in build/man/*.[0-9]; do + vman "$m" + done + for c in bootctl kernel-install; do + vcompletion "shell-completion/bash/$c" bash "${c%*/}" + vcompletion "shell-completion/zsh/_$c" zsh "${c%*/_}" + done + for e in "${_efis[@]}"; do + vinstall "build/$e" 644 usr/lib/systemd/boot/efi + done + for f in src/kernel-install/50-depmod.install src/kernel-install/90-uki-copy.install; do + vinstall "$f" 755 usr/lib/kernel/install.d + done + + for f in "${_hooks[@]}"; do + vinstall "build/$f" 755 usr/lib/kernel/install.d + done + + vinstall "${FILESDIR}/systemd-boot.post-install" 744 etc/kernel.d/post-install 50-systemd-boot + vinstall "${FILESDIR}/systemd-boot.post-remove" 744 etc/kernel.d/post-remove 50-systemd-boot + vinstall "${FILESDIR}/systemd-boot.confd" 644 etc/default systemd-boot +} + +systemd-boot-efistub_package() { + short_desc+=" - UEFI stub loader" + pkg_install() { + vmove "usr/lib/systemd/boot/efi/*.efi.stub" + vmove "usr/share/man/man7/*stub.7" + } +} + +systemd-boot-ukify_package() { + short_desc+=" - Unified Kernel Image creation support" + depends="python3-pefile" + pkg_install() { + vmove usr/bin/ukify + vmove usr/share/man/man1/ukify.1 + vmove usr/lib/kernel/install.d/60-ukify.install + } +}