mirror of
https://github.com/gravitl/netmaker.git
synced 2025-09-10 07:05:28 +08:00
binary builder script
This commit is contained in:
parent
c0927b6f40
commit
0d9f2db514
4 changed files with 29 additions and 12 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -4,6 +4,8 @@ netmaker-arm64
|
|||
netmaker-32
|
||||
netmaker-amd64
|
||||
netclient/netclient
|
||||
netclient/build
|
||||
netclient/build/
|
||||
netclient/files/netclient
|
||||
netclient/netclient-amd64
|
||||
netclient/netclient-arm
|
||||
|
|
|
@ -8,15 +8,14 @@ import (
|
|||
|
||||
// RunCmd - runs a local command
|
||||
func RunCmd(command string, printerr bool) (string, error) {
|
||||
args := strings.Fields(command)
|
||||
cmd := exec.Command(args[0], args[1:]...)
|
||||
cmd.Wait()
|
||||
out, err := cmd.CombinedOutput()
|
||||
if err != nil && printerr {
|
||||
log.Println("error running command:", command)
|
||||
log.Println(strings.TrimSuffix(string(out), "\n"))
|
||||
}
|
||||
return string(out), err
|
||||
}
|
||||
turn string(out), err
|
||||
args := strings.Fields(command)
|
||||
cmd := exec.Command(args[0], args[1:]...)
|
||||
cmd.Wait()
|
||||
out, err := cmd.CombinedOutput()
|
||||
if err != nil && printerr {
|
||||
log.Println("error running command:", command)
|
||||
log.Println(strings.TrimSuffix(string(out), "\n"))
|
||||
}
|
||||
return string(out), err
|
||||
}
|
||||
|
||||
|
|
14
scripts/build-binaries.sh
Executable file
14
scripts/build-binaries.sh
Executable file
|
@ -0,0 +1,14 @@
|
|||
#!/bin/bash
|
||||
cd netclient
|
||||
env GOOS=linux GOARCH=amd64 go build -o build/netclient main.go
|
||||
env GOOS=linux GOARCH=arm GOARM=5 go build -o build/netclient-arm5 main.go
|
||||
env GOOS=linux GOARCH=arm GOARM=6 go build -o build/netclient-arm6 main.go
|
||||
env GOOS=linux GOARCH=arm GOARM=7 go build -o build/netclient-arm7 main.go
|
||||
env GOOS=linux GOARCH=arm64 go build -o build/netclient-arm64 main.go
|
||||
env GOOS=linux GOARCH=mipsle go build -ldflags "-s -w" -o build/netclient-mipsle main.go && upx build/netclient-mipsle
|
||||
env GOOS=freebsd GOARCH=amd64 go build -o build/netclient-freebsd main.go
|
||||
env GOOS=freebsd GOARCH=arm GOARM=5 go build -o build/netclient-freebsd-arm5 main.go
|
||||
env GOOS=freebsd GOARCH=arm GOARM=6 go build -o build/netclient-freebsd-arm6 main.go
|
||||
env GOOS=freebsd GOARCH=arm GOARM=7 go build -o build/netclient-freebsd-arm7 main.go
|
||||
env GOOS=freebsd GOARCH=arm64 go build -o build/netclient-freebsd-arm64 main.go
|
||||
env GOOS=darwin GOARCH=amd64 go build -o build/netclient-darwmin main.go
|
|
@ -109,7 +109,9 @@ case $(uname | tr '[:upper:]' '[:lower:]') in
|
|||
;;
|
||||
arm*)
|
||||
dist=netclient-$CPU_ARCH
|
||||
;;
|
||||
mipsle)
|
||||
dist=netclient-mipsle
|
||||
;;
|
||||
*)
|
||||
fatal "$CPU_ARCH : cpu architecture not supported"
|
||||
esac
|
||||
|
|
Loading…
Add table
Reference in a new issue