Avoid ignoring errors
This commit is contained in:
+33
-16
@@ -1,10 +1,12 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -eu
|
||||||
|
|
||||||
check_command() {
|
check_command() {
|
||||||
if ! command -v "$1" > /dev/null
|
if ! command -v "$1" >/dev/null
|
||||||
then
|
then
|
||||||
echo "Error: $1 could not be found. Please install it."
|
echo "Error: $1 could not be found. Please install it." >&2
|
||||||
exit 1
|
return 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -13,82 +15,97 @@ check_command go
|
|||||||
check_command 7z
|
check_command 7z
|
||||||
check_command upx
|
check_command upx
|
||||||
|
|
||||||
|
set -x
|
||||||
|
|
||||||
# Windows amd64
|
# Windows amd64
|
||||||
export GOOS=windows
|
export GOOS=windows
|
||||||
export GOARCH=amd64
|
export GOARCH=amd64
|
||||||
FILENAME="go2rtc_win64.zip"
|
FILENAME="go2rtc_win64.zip"
|
||||||
go build -ldflags "-s -w" -trimpath && 7z a -mx9 -bso0 -sdel $FILENAME go2rtc.exe
|
go build -ldflags "-s -w" -trimpath
|
||||||
|
7z a -mx9 -bso0 -sdel $FILENAME go2rtc.exe
|
||||||
|
|
||||||
# Windows 386
|
# Windows 386
|
||||||
export GOOS=windows
|
export GOOS=windows
|
||||||
export GOARCH=386
|
export GOARCH=386
|
||||||
FILENAME="go2rtc_win32.zip"
|
FILENAME="go2rtc_win32.zip"
|
||||||
go build -ldflags "-s -w" -trimpath && 7z a -mx9 -bso0 -sdel $FILENAME go2rtc.exe
|
go build -ldflags "-s -w" -trimpath
|
||||||
|
7z a -mx9 -bso0 -sdel $FILENAME go2rtc.exe
|
||||||
|
|
||||||
# Windows arm64
|
# Windows arm64
|
||||||
export GOOS=windows
|
export GOOS=windows
|
||||||
export GOARCH=arm64
|
export GOARCH=arm64
|
||||||
FILENAME="go2rtc_win_arm64.zip"
|
FILENAME="go2rtc_win_arm64.zip"
|
||||||
go build -ldflags "-s -w" -trimpath && 7z a -mx9 -bso0 -sdel $FILENAME go2rtc.exe
|
go build -ldflags "-s -w" -trimpath
|
||||||
|
7z a -mx9 -bso0 -sdel $FILENAME go2rtc.exe
|
||||||
|
|
||||||
# Linux amd64
|
# Linux amd64
|
||||||
export GOOS=linux
|
export GOOS=linux
|
||||||
export GOARCH=amd64
|
export GOARCH=amd64
|
||||||
FILENAME="go2rtc_linux_amd64"
|
FILENAME="go2rtc_linux_amd64"
|
||||||
go build -ldflags "-s -w" -trimpath -o $FILENAME && upx --lzma --force-overwrite -q --no-progress $FILENAME
|
go build -ldflags "-s -w" -trimpath -o $FILENAME
|
||||||
|
upx --lzma --force-overwrite -q --no-progress $FILENAME
|
||||||
|
|
||||||
# Linux 386
|
# Linux 386
|
||||||
export GOOS=linux
|
export GOOS=linux
|
||||||
export GOARCH=386
|
export GOARCH=386
|
||||||
FILENAME="go2rtc_linux_i386"
|
FILENAME="go2rtc_linux_i386"
|
||||||
go build -ldflags "-s -w" -trimpath -o $FILENAME && upx --lzma --force-overwrite -q --no-progress $FILENAME
|
go build -ldflags "-s -w" -trimpath -o $FILENAME
|
||||||
|
upx --lzma --force-overwrite -q --no-progress $FILENAME
|
||||||
|
|
||||||
# Linux arm64
|
# Linux arm64
|
||||||
export GOOS=linux
|
export GOOS=linux
|
||||||
export GOARCH=arm64
|
export GOARCH=arm64
|
||||||
FILENAME="go2rtc_linux_arm64"
|
FILENAME="go2rtc_linux_arm64"
|
||||||
go build -ldflags "-s -w" -trimpath -o $FILENAME && upx --lzma --force-overwrite -q --no-progress $FILENAME
|
go build -ldflags "-s -w" -trimpath -o $FILENAME
|
||||||
|
upx --lzma --force-overwrite -q --no-progress $FILENAME
|
||||||
|
|
||||||
# Linux arm v7
|
# Linux arm v7
|
||||||
export GOOS=linux
|
export GOOS=linux
|
||||||
export GOARCH=arm
|
export GOARCH=arm
|
||||||
export GOARM=7
|
export GOARM=7
|
||||||
FILENAME="go2rtc_linux_arm"
|
FILENAME="go2rtc_linux_arm"
|
||||||
go build -ldflags "-s -w" -trimpath -o $FILENAME && upx --lzma --force-overwrite -q --no-progress $FILENAME
|
go build -ldflags "-s -w" -trimpath -o $FILENAME
|
||||||
|
upx --lzma --force-overwrite -q --no-progress $FILENAME
|
||||||
|
|
||||||
# Linux arm v6
|
# Linux arm v6
|
||||||
export GOOS=linux
|
export GOOS=linux
|
||||||
export GOARCH=arm
|
export GOARCH=arm
|
||||||
export GOARM=6
|
export GOARM=6
|
||||||
FILENAME="go2rtc_linux_armv6"
|
FILENAME="go2rtc_linux_armv6"
|
||||||
go build -ldflags "-s -w" -trimpath -o $FILENAME && upx --lzma --force-overwrite -q --no-progress $FILENAME
|
go build -ldflags "-s -w" -trimpath -o $FILENAME
|
||||||
|
upx --lzma --force-overwrite -q --no-progress $FILENAME
|
||||||
|
|
||||||
# Linux mipsle
|
# Linux mipsle
|
||||||
export GOOS=linux
|
export GOOS=linux
|
||||||
export GOARCH=mipsle
|
export GOARCH=mipsle
|
||||||
FILENAME="go2rtc_linux_mipsel"
|
FILENAME="go2rtc_linux_mipsel"
|
||||||
go build -ldflags "-s -w" -trimpath -o $FILENAME && upx --lzma --force-overwrite -q --no-progress $FILENAME
|
go build -ldflags "-s -w" -trimpath -o $FILENAME
|
||||||
|
upx --lzma --force-overwrite -q --no-progress $FILENAME
|
||||||
|
|
||||||
# Darwin amd64
|
# Darwin amd64
|
||||||
export GOOS=darwin
|
export GOOS=darwin
|
||||||
export GOARCH=amd64
|
export GOARCH=amd64
|
||||||
FILENAME="go2rtc_mac_amd64.zip"
|
FILENAME="go2rtc_mac_amd64.zip"
|
||||||
go build -ldflags "-s -w" -trimpath && 7z a -mx9 -bso0 -sdel $FILENAME go2rtc
|
go build -ldflags "-s -w" -trimpath
|
||||||
|
7z a -mx9 -bso0 -sdel $FILENAME go2rtc
|
||||||
|
|
||||||
# Darwin arm64
|
# Darwin arm64
|
||||||
export GOOS=darwin
|
export GOOS=darwin
|
||||||
export GOARCH=arm64
|
export GOARCH=arm64
|
||||||
FILENAME="go2rtc_mac_arm64.zip"
|
FILENAME="go2rtc_mac_arm64.zip"
|
||||||
go build -ldflags "-s -w" -trimpath && 7z a -mx9 -bso0 -sdel $FILENAME go2rtc
|
go build -ldflags "-s -w" -trimpath
|
||||||
|
7z a -mx9 -bso0 -sdel $FILENAME go2rtc
|
||||||
|
|
||||||
# FreeBSD amd64
|
# FreeBSD amd64
|
||||||
export GOOS=freebsd
|
export GOOS=freebsd
|
||||||
export GOARCH=amd64
|
export GOARCH=amd64
|
||||||
FILENAME="go2rtc_freebsd_amd64.zip"
|
FILENAME="go2rtc_freebsd_amd64.zip"
|
||||||
go build -ldflags "-s -w" -trimpath && 7z a -mx9 -bso0 -sdel $FILENAME go2rtc
|
go build -ldflags "-s -w" -trimpath
|
||||||
|
7z a -mx9 -bso0 -sdel $FILENAME go2rtc
|
||||||
|
|
||||||
# FreeBSD arm64
|
# FreeBSD arm64
|
||||||
export GOOS=freebsd
|
export GOOS=freebsd
|
||||||
export GOARCH=arm64
|
export GOARCH=arm64
|
||||||
FILENAME="go2rtc_freebsd_arm64.zip"
|
FILENAME="go2rtc_freebsd_arm64.zip"
|
||||||
go build -ldflags "-s -w" -trimpath && 7z a -mx9 -bso0 -sdel $FILENAME go2rtc
|
go build -ldflags "-s -w" -trimpath
|
||||||
|
7z a -mx9 -bso0 -sdel $FILENAME go2rtc
|
||||||
|
|||||||
Reference in New Issue
Block a user