From 230d8293fa20ce34bd18a689421fd265f3c58b38 Mon Sep 17 00:00:00 2001 From: Willem de Groot Date: Sat, 18 Mar 2023 12:39:45 +0100 Subject: [PATCH] Add multi arch/os build script --- README.md | 7 ++++--- release.sh | 21 +++++++++++---------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index c231a9b..7bb4c9d 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ Corediff was created by [Sansec](https://sansec.io/?corediff), specialists in Ma ``` Usage: - magento-corediff [OPTIONS] ... + corediff [OPTIONS] ... Application Options: -d, --database= Hash database path (default: download Sansec database) @@ -35,10 +35,11 @@ Alternatively you can scan all files with the `--ignore-paths` option. NB this w # Installation -Use our binary package: +Use our binary package (available for Linux & Mac, arm64 & amd64) ```sh -curl https://api.sansec.io/downloads/corediff -O +osarch=$(uname -sm | tr 'LD ' 'ld-') +curl https://sansec.io/downloads/$osarch/corediff -O chmod 755 corediff ./corediff | less -SR ``` diff --git a/release.sh b/release.sh index 53aaed9..47e1117 100755 --- a/release.sh +++ b/release.sh @@ -18,16 +18,17 @@ function chronic { set -e } -# if different arch -chronic go build -o ~/bin/corediff +targets="linux,amd64 linux,arm64 darwin,arm64 darwin,amd64" # linux,arm64 +for x in $targets; do + os=$(echo $x | cut -d, -f1) + arch=$(echo $x | cut -d, -f2) + + fn="corediff-$os-$arch" + echo Building $fn + chronic env GOOS=$os GOARCH=$arch go build -o build/$fn && + chronic rsync build/$fn ssweb:/data/downloads/$os-$arch/corediff +done -( - export GOARCH=amd64 - export GOOS=linux - chronic go build -o /tmp/corediff - chronic rsync /tmp/corediff ssweb:/data/ecomscan/downloads -) -#chronic upx -qq ~/bin/corediff >corediff.bin chronic corediff -d corediff.bin -m \ @@ -41,5 +42,5 @@ chronic rsync corediff.bin ssweb:/data/ecomscan/downloads/corediff.bin echo echo 'Finished! Run:' echo -echo ' curl https://api.sansec.io/downloads/corediff -O && chmod 755 corediff' +echo " curl https://sansec.io/downloads/$(uname -sm | tr 'LD ' 'ld-')/corediff -O && chmod 755 corediff" echo