From e35da2f9508e6d033759da9c6d3b19e8fa9166b8 Mon Sep 17 00:00:00 2001 From: travankor Date: Sat, 13 Mar 2021 07:51:37 -0700 Subject: [PATCH 1/2] New package: booster-0.3 --- srcpkgs/booster/files/kernel-hook-postinst | 15 +++++++++ srcpkgs/booster/files/kernel-hook-postrm | 11 +++++++ srcpkgs/booster/template | 38 ++++++++++++++++++++++ 3 files changed, 64 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..0efbcecb56ec --- /dev/null +++ b/srcpkgs/booster/files/kernel-hook-postinst @@ -0,0 +1,15 @@ +#!/bin/sh +# +# Kernel post-install hook for booster. +# +# Arguments passed to this script: $1 pkgname, $2 version. +# +PKGNAME="$1" +VERSION="$2" + +if [ ! -x usr/bin/booster ]; then + exit 0 +fi + +usr/bin/booster -output boot/initramfs-${VERSION}.img -kernelVersion ${VERSION} +exit $? diff --git a/srcpkgs/booster/files/kernel-hook-postrm b/srcpkgs/booster/files/kernel-hook-postrm new file mode 100644 index 000000000000..ef13d1967a67 --- /dev/null +++ b/srcpkgs/booster/files/kernel-hook-postrm @@ -0,0 +1,11 @@ +#!/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 +exit $? diff --git a/srcpkgs/booster/template b/srcpkgs/booster/template new file mode 100644 index 000000000000..08e1e9a7cd67 --- /dev/null +++ b/srcpkgs/booster/template @@ -0,0 +1,38 @@ +# Template file for 'booster' +pkgname=booster +version=0.3 +revision=1 +build_style=go +go_import_path=github.com/anatol/booster +go_package="${go_import_path}/init ${go_import_path}/generator" +go_mod_mode=readonly +hostmakedepends="git" +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=77067a5056e1070aee0f27130c31ebbf7cacca18644dc4906290371a04f07371 + +do_build() { + cd generator + CGO_CPPFLAGS="${CPPFLAGS}" CGO_CFLAGS="${CFLAGS}" CGO_CXXFLAGS="${CXXFLAGS}" CGO_LDFLAGS="${LDFLAGS}" \ + go build -trimpath -buildmode=pie -mod=readonly -modcacherw -ldflags "-linkmode external -extldflags" + + cd ../init + CGO_ENABLED=0 go build -trimpath -mod=readonly -modcacherw +} + +do_install() { + vbin generator/booster + vman generator/booster.1 + vinstall init/init 755 usr/lib/booster +} + +post_install() { + vlicense LICENSE + + vinstall ${FILESDIR}/kernel-hook-postinst 755 etc/kernel.d/post-install 20-booster + vinstall ${FILESDIR}/kernel-hook-postrm 755 etc/kernel.d/post-remove 20-booster +} From 35cffc601b95a6645a96c3bf2a41167a6be9e670 Mon Sep 17 00:00:00 2001 From: travankor Date: Sun, 14 Mar 2021 20:06:21 -0700 Subject: [PATCH 2/2] booster: update to 0.3. --- srcpkgs/booster/template | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/srcpkgs/booster/template b/srcpkgs/booster/template index 08e1e9a7cd67..37dfb4efab19 100644 --- a/srcpkgs/booster/template +++ b/srcpkgs/booster/template @@ -5,7 +5,6 @@ revision=1 build_style=go go_import_path=github.com/anatol/booster go_package="${go_import_path}/init ${go_import_path}/generator" -go_mod_mode=readonly hostmakedepends="git" depends="busybox-static" short_desc="Fast and secure initramfs generator" @@ -15,19 +14,10 @@ homepage="https://github.com/anatol/booster" distfiles="https://github.com/anatol/booster/archive/${version}.tar.gz" checksum=77067a5056e1070aee0f27130c31ebbf7cacca18644dc4906290371a04f07371 -do_build() { - cd generator - CGO_CPPFLAGS="${CPPFLAGS}" CGO_CFLAGS="${CFLAGS}" CGO_CXXFLAGS="${CXXFLAGS}" CGO_LDFLAGS="${LDFLAGS}" \ - go build -trimpath -buildmode=pie -mod=readonly -modcacherw -ldflags "-linkmode external -extldflags" - - cd ../init - CGO_ENABLED=0 go build -trimpath -mod=readonly -modcacherw -} - do_install() { - vbin generator/booster + vbin ${GO_PATH}/bin/generator booster vman generator/booster.1 - vinstall init/init 755 usr/lib/booster + vinstall ${GO_PATH}/bin/init 755 usr/lib/booster } post_install() {