From e35da2f9508e6d033759da9c6d3b19e8fa9166b8 Mon Sep 17 00:00:00 2001 From: travankor Date: Sat, 13 Mar 2021 07:51:37 -0700 Subject: [PATCH 1/3] 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 29d709ce2e7eb5bdd1128596bb2b0355e0e7e1b1 Mon Sep 17 00:00:00 2001 From: travankor Date: Sun, 14 Mar 2021 20:06:21 -0700 Subject: [PATCH 2/3] booster: update to 0.3. --- srcpkgs/booster/template | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/srcpkgs/booster/template b/srcpkgs/booster/template index 08e1e9a7cd67..aabc1b476705 100644 --- a/srcpkgs/booster/template +++ b/srcpkgs/booster/template @@ -4,8 +4,7 @@ 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 +go_package="${go_import_path}/generator ${go_import_path}/init" hostmakedepends="git" depends="busybox-static" short_desc="Fast and secure initramfs generator" @@ -15,24 +14,14 @@ 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 ${GOPATH}/bin/generator booster + vinstall ${GOPATH}/bin/init 755 usr/lib/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 + vlicense LICENSE } From 88ebbcc7834ae25adb1e3bdaaa23843844fd5773 Mon Sep 17 00:00:00 2001 From: travankor Date: Sun, 14 Mar 2021 20:49:54 -0700 Subject: [PATCH 3/3] booster: update to 0.3. --- srcpkgs/booster/template | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/srcpkgs/booster/template b/srcpkgs/booster/template index aabc1b476705..428d7ef3fb68 100644 --- a/srcpkgs/booster/template +++ b/srcpkgs/booster/template @@ -15,8 +15,13 @@ distfiles="https://github.com/anatol/booster/archive/${version}.tar.gz" checksum=77067a5056e1070aee0f27130c31ebbf7cacca18644dc4906290371a04f07371 do_install() { - vbin ${GOPATH}/bin/generator booster - vinstall ${GOPATH}/bin/init 755 usr/lib/booster + 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 vman generator/booster.1 }