From 5b90bb3d48480d9e76f4ea7ffce15b1c4387da74 Mon Sep 17 00:00:00 2001 From: travankor Date: Sat, 13 Mar 2021 07:51:37 -0700 Subject: [PATCH] New package: booster-0.9 --- srcpkgs/booster/files/kernel-hook-postinst | 13 ++++++ srcpkgs/booster/files/kernel-hook-postrm | 10 +++++ srcpkgs/booster/template | 47 ++++++++++++++++++++++ 3 files changed, 70 insertions(+) create mode 100644 srcpkgs/booster/files/kernel-hook-postinst create mode 100644 srcpkgs/booster/files/kernel-hook-postrm create mode 100644 srcpkgs/booster/template diff --git a/srcpkgs/booster/files/kernel-hook-postinst b/srcpkgs/booster/files/kernel-hook-postinst new file mode 100644 index 000000000000..7e6ef0a5b829 --- /dev/null +++ b/srcpkgs/booster/files/kernel-hook-postinst @@ -0,0 +1,13 @@ +#!/bin/sh +# +# Kernel post-install hook for booster. +# +# Arguments passed to this script: $1 pkgname, $2 version. +# +PKGNAME="$1" +VERSION="$2" + +[ -x usr/bin/booster ] || exit 0 + +umask 0077 +usr/bin/booster build --force --kernel-version ${VERSION} boot/initramfs-${VERSION}.img diff --git a/srcpkgs/booster/files/kernel-hook-postrm b/srcpkgs/booster/files/kernel-hook-postrm new file mode 100644 index 000000000000..253c8d2d45f4 --- /dev/null +++ b/srcpkgs/booster/files/kernel-hook-postrm @@ -0,0 +1,10 @@ +#!/bin/sh +# +# Kernel post-remove hook for booster. +# +# Arguments passed to this script: $1 pkgname, $2 version. +# +PKGNAME="$1" +VERSION="$2" + +rm -f boot/initramfs-${VERSION}.img diff --git a/srcpkgs/booster/template b/srcpkgs/booster/template new file mode 100644 index 000000000000..853de87b566a --- /dev/null +++ b/srcpkgs/booster/template @@ -0,0 +1,47 @@ +# Template file for 'booster' +pkgname=booster +version=0.9 +revision=1 +build_style=go +go_import_path=github.com/anatol/booster +go_package="${go_import_path}/generator ${go_import_path}/init" +hostmakedepends="git ruby-ronn" +depends="busybox-static" +short_desc="Fast and secure initramfs generator" +maintainer="travankor " +license="MIT" +homepage="https://github.com/anatol/booster" +distfiles="https://github.com/anatol/booster/archive/${version}.tar.gz" +checksum=786b89ac5f5b6fb063ff58b490525c9fda9c6f2ae53ab06416b25993bdb72ca4 +conf_files="/etc/booster.yaml" +alternatives=" + initramfs:/etc/kernel.d/post-install/20-initramfs:/usr/libexec/booster/kernel-hook-postinst + initramfs:/etc/kernel.d/post-remove/20-initramfs:/usr/libexec/booster/kernel-hook-postrm +" + +do_build() { + cd generator + go install -p "$XBPS_MAKEJOBS" -mod=readonly -x -tags "${go_build_tags}" -ldflags "${go_ldflags}" + + cd ../init + CGO_ENABLED=0 go install -p "$XBPS_MAKEJOBS" -mod=readonly -x -tags "${go_build_tags}" -ldflags "${go_ldflags}" +} + +do_install() { + if [ "$CROSS_BUILD" ]; then + vbin ${GOPATH}/bin/linux_${GOARCH}/generator booster + vinstall ${GOPATH}/bin/linux_${GOARCH}/init 755 usr/lib/booster + else + vbin ${GOPATH}/bin/generator booster + vinstall ${GOPATH}/bin/init 755 usr/lib/booster + fi + ronn docs/manpage.md + vman docs/manpage.1 booster.1 + echo "busybox: true" > booster.yaml + + vconf booster.yaml + vinstall ${FILESDIR}/kernel-hook-postinst 755 usr/libexec/booster + vinstall ${FILESDIR}/kernel-hook-postrm 755 usr/libexec/booster + vcompletion contrib/completion/bash bash booster + vlicense LICENSE +}