Skip to content

Commit

Permalink
Add multi arch/os build script
Browse files Browse the repository at this point in the history
  • Loading branch information
gwillem committed Mar 18, 2023
1 parent c78fee3 commit 230d829
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Corediff was created by [Sansec](https://sansec.io/?corediff), specialists in Ma

```
Usage:
magento-corediff [OPTIONS] <path>...
corediff [OPTIONS] <path>...
Application Options:
-d, --database= Hash database path (default: download Sansec database)
Expand All @@ -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 <magento_path> | less -SR
```
Expand Down
21 changes: 11 additions & 10 deletions release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand All @@ -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

0 comments on commit 230d829

Please sign in to comment.