+ release.sh: add armv5 build

Close #1239

Squashed commit of the following:

commit 707e2f8e265e294c7b1328c375648f799a5ae293
Author: Simon Zolin <s.zolin@adguard.com>
Date:   Fri Jan 10 16:32:52 2020 +0300

    leave "AdGuardHome_linux_arm" by default

commit cca01fd03200e70d6ee2201540570382f2b7fdf4
Author: Simon Zolin <s.zolin@adguard.com>
Date:   Fri Jan 10 14:53:37 2020 +0300

    fix auto-update; update readme

commit f393a4f511861ef1998c68775bb8f234c5ce1838
Author: Simon Zolin <s.zolin@adguard.com>
Date:   Fri Jan 10 13:00:37 2020 +0300

    + release.sh: add armv5 build; rename armv6 build

commit 73f2d20ba6b0a94a9929882fe15175ba80b528d7
Author: Simon Zolin <s.zolin@adguard.com>
Date:   Fri Jan 10 12:59:55 2020 +0300

    * release.sh: fix indentation
This commit is contained in:
Simon Zolin 2020-01-15 18:58:12 +03:00
parent d154502b31
commit eb6c4eb132
6 changed files with 32 additions and 15 deletions

View File

@ -5,6 +5,7 @@ GOPATH := $(shell go env GOPATH)
JSFILES = $(shell find client -path client/node_modules -prune -o -type f -name '*.js') JSFILES = $(shell find client -path client/node_modules -prune -o -type f -name '*.js')
STATIC = build/static/index.html STATIC = build/static/index.html
CHANNEL ?= release CHANNEL ?= release
GOARM_VER :=
TARGET=AdGuardHome TARGET=AdGuardHome
@ -23,7 +24,7 @@ $(STATIC): $(JSFILES) client/node_modules
$(TARGET): $(STATIC) *.go home/*.go dhcpd/*.go dnsfilter/*.go dnsforward/*.go $(TARGET): $(STATIC) *.go home/*.go dhcpd/*.go dnsfilter/*.go dnsforward/*.go
GOOS=$(NATIVE_GOOS) GOARCH=$(NATIVE_GOARCH) GO111MODULE=off go get -v github.com/gobuffalo/packr/... GOOS=$(NATIVE_GOOS) GOARCH=$(NATIVE_GOARCH) GO111MODULE=off go get -v github.com/gobuffalo/packr/...
PATH=$(GOPATH)/bin:$(PATH) packr -z PATH=$(GOPATH)/bin:$(PATH) packr -z
CGO_ENABLED=0 go build -ldflags="-s -w -X main.version=$(GIT_VERSION) -X main.channel=$(CHANNEL)" -asmflags="-trimpath=$(PWD)" -gcflags="-trimpath=$(PWD)" CGO_ENABLED=0 go build -ldflags="-s -w -X main.version=$(GIT_VERSION) -X main.channel=$(CHANNEL) -X main.goarm=$(GOARM_VER)" -asmflags="-trimpath=$(PWD)" -gcflags="-trimpath=$(PWD)"
PATH=$(GOPATH)/bin:$(PATH) packr clean PATH=$(GOPATH)/bin:$(PATH) packr clean
clean: clean:

View File

@ -170,14 +170,15 @@ or you can use the Docker image from the `edge` tag, which is synced with the re
* [Docker Hub](https://hub.docker.com/r/adguard/adguardhome) * [Docker Hub](https://hub.docker.com/r/adguard/adguardhome)
* Beta builds * Beta builds
* [Rapsberry Pi (32-bit ARM)](https://static.adguard.com/adguardhome/beta/AdGuardHome_linux_arm.tar.gz) * [Raspberry Pi (32-bit ARMv6)](https://static.adguard.com/adguardhome/beta/AdGuardHome_linux_arm.tar.gz)
* [MacOS](https://static.adguard.com/adguardhome/beta/AdGuardHome_MacOS.zip) * [MacOS](https://static.adguard.com/adguardhome/beta/AdGuardHome_MacOS.zip)
* [Windows 64-bit](https://static.adguard.com/adguardhome/beta/AdGuardHome_Windows_amd64.zip) * [Windows 64-bit](https://static.adguard.com/adguardhome/beta/AdGuardHome_Windows_amd64.zip)
* [Windows 32-bit](https://static.adguard.com/adguardhome/beta/AdGuardHome_Windows_386.zip) * [Windows 32-bit](https://static.adguard.com/adguardhome/beta/AdGuardHome_Windows_386.zip)
* [Linux 64-bit](https://static.adguard.com/adguardhome/beta/AdGuardHome_linux_amd64.tar.gz) * [Linux 64-bit](https://static.adguard.com/adguardhome/beta/AdGuardHome_linux_amd64.tar.gz)
* [Linux 32-bit](https://static.adguard.com/adguardhome/beta/AdGuardHome_linux_386.tar.gz) * [Linux 32-bit](https://static.adguard.com/adguardhome/beta/AdGuardHome_linux_386.tar.gz)
* [FreeBSD 64-bit](https://static.adguard.com/adguardhome/beta/AdGuardHome_freebsd_amd64.tar.gz) * [FreeBSD 64-bit](https://static.adguard.com/adguardhome/beta/AdGuardHome_freebsd_amd64.tar.gz)
* [64-bit ARM](https://static.adguard.com/adguardhome/beta/AdGuardHome_linux_arm64.tar.gz) * [Linux 64-bit ARM](https://static.adguard.com/adguardhome/beta/AdGuardHome_linux_arm64.tar.gz)
* [Linux 32-bit ARMv5](https://static.adguard.com/adguardhome/beta/AdGuardHome_linux_armv5.tar.gz)
* [MIPS](https://static.adguard.com/adguardhome/beta/AdGuardHome_linux_mips.tar.gz) * [MIPS](https://static.adguard.com/adguardhome/beta/AdGuardHome_linux_mips.tar.gz)
* [MIPSLE](https://static.adguard.com/adguardhome/beta/AdGuardHome_linux_mipsle.tar.gz) * [MIPSLE](https://static.adguard.com/adguardhome/beta/AdGuardHome_linux_mipsle.tar.gz)

View File

@ -42,7 +42,11 @@ func getVersionResp(data []byte) []byte {
return []byte{} return []byte{}
} }
_, ok := versionJSON[fmt.Sprintf("download_%s_%s", runtime.GOOS, runtime.GOARCH)] dloadName := fmt.Sprintf("download_%s_%s", runtime.GOOS, runtime.GOARCH)
if runtime.GOARCH == "arm" && ARMVersion != "6" {
dloadName = fmt.Sprintf("download_%s_%sv%s", runtime.GOOS, runtime.GOARCH, ARMVersion)
}
_, ok := versionJSON[dloadName]
if ok && ret["new_version"] != versionString && versionString >= selfUpdateMinVersion { if ok && ret["new_version"] != versionString && versionString >= selfUpdateMinVersion {
ret["can_autoupdate"] = true ret["can_autoupdate"] = true
} }

View File

@ -42,6 +42,7 @@ var (
versionString string versionString string
updateChannel string updateChannel string
versionCheckURL string versionCheckURL string
ARMVersion string
) )
const versionCheckPeriod = time.Hour * 8 const versionCheckPeriod = time.Hour * 8
@ -64,10 +65,11 @@ type homeContext struct {
var Context homeContext var Context homeContext
// Main is the entry point // Main is the entry point
func Main(version string, channel string) { func Main(version string, channel string, armVer string) {
// Init update-related global variables // Init update-related global variables
versionString = version versionString = version
updateChannel = channel updateChannel = channel
ARMVersion = armVer
versionCheckURL = "https://static.adguard.com/adguardhome/" + updateChannel + "/version.json" versionCheckURL = "https://static.adguard.com/adguardhome/" + updateChannel + "/version.json"
// config can be specified, which reads options from there, but other command line flags have to override config values // config can be specified, which reads options from there, but other command line flags have to override config values

View File

@ -12,7 +12,10 @@ var version = "undefined"
// channel can be set via ldflags // channel can be set via ldflags
var channel = "release" var channel = "release"
// ARM version number. Set via linker flags.
var goarm = ""
func main() { func main() {
debug.SetGCPercent(10) debug.SetGCPercent(10)
home.Main(version, channel) home.Main(version, channel, goarm)
} }

View File

@ -20,7 +20,11 @@ f() {
mkdir -p dist/AdGuardHome mkdir -p dist/AdGuardHome
cp -pv {AdGuardHome,LICENSE.txt,README.md} dist/AdGuardHome/ cp -pv {AdGuardHome,LICENSE.txt,README.md} dist/AdGuardHome/
pushd dist pushd dist
if [[ $GOARCH == arm ]] && [[ $GOARM != 6 ]]; then
tar zcvf AdGuardHome_"$GOOS"_armv"$GOARM".tar.gz AdGuardHome/
else
tar zcvf AdGuardHome_"$GOOS"_"$GOARCH".tar.gz AdGuardHome/ tar zcvf AdGuardHome_"$GOOS"_"$GOARCH".tar.gz AdGuardHome/
fi
popd popd
rm -rf dist/AdguardHome rm -rf dist/AdguardHome
fi fi
@ -37,6 +41,7 @@ mkdir -p $dst
CHANNEL=$channel GOOS=darwin GOARCH=amd64 f CHANNEL=$channel GOOS=darwin GOARCH=amd64 f
CHANNEL=$channel GOOS=linux GOARCH=amd64 f CHANNEL=$channel GOOS=linux GOARCH=amd64 f
CHANNEL=$channel GOOS=linux GOARCH=386 GO386=387 f CHANNEL=$channel GOOS=linux GOARCH=386 GO386=387 f
CHANNEL=$channel GOOS=linux GOARCH=arm GOARM=5 f
CHANNEL=$channel GOOS=linux GOARCH=arm GOARM=6 f CHANNEL=$channel GOOS=linux GOARCH=arm GOARM=6 f
CHANNEL=$channel GOOS=linux GOARCH=arm64 GOARM=6 f CHANNEL=$channel GOOS=linux GOARCH=arm64 GOARM=6 f
CHANNEL=$channel GOOS=windows GOARCH=amd64 f CHANNEL=$channel GOOS=windows GOARCH=amd64 f
@ -59,6 +64,7 @@ echo " \"download_darwin_amd64\": \"$baseUrl/AdGuardHome_MacOS.zip\"," >> $dst/
echo " \"download_linux_amd64\": \"$baseUrl/AdGuardHome_linux_amd64.tar.gz\"," >> $dst/version.json echo " \"download_linux_amd64\": \"$baseUrl/AdGuardHome_linux_amd64.tar.gz\"," >> $dst/version.json
echo " \"download_linux_386\": \"$baseUrl/AdGuardHome_linux_386.tar.gz\"," >> $dst/version.json echo " \"download_linux_386\": \"$baseUrl/AdGuardHome_linux_386.tar.gz\"," >> $dst/version.json
echo " \"download_linux_arm\": \"$baseUrl/AdGuardHome_linux_arm.tar.gz\"," >> $dst/version.json echo " \"download_linux_arm\": \"$baseUrl/AdGuardHome_linux_arm.tar.gz\"," >> $dst/version.json
echo " \"download_linux_armv5\": \"$baseUrl/AdGuardHome_linux_armv5.tar.gz\"," >> $dst/version.json
echo " \"download_linux_arm64\": \"$baseUrl/AdGuardHome_linux_arm64.tar.gz\"," >> $dst/version.json echo " \"download_linux_arm64\": \"$baseUrl/AdGuardHome_linux_arm64.tar.gz\"," >> $dst/version.json
echo " \"download_linux_mips\": \"$baseUrl/AdGuardHome_linux_mips.tar.gz\"," >> $dst/version.json echo " \"download_linux_mips\": \"$baseUrl/AdGuardHome_linux_mips.tar.gz\"," >> $dst/version.json
echo " \"download_linux_mipsle\": \"$baseUrl/AdGuardHome_linux_mipsle.tar.gz\"," >> $dst/version.json echo " \"download_linux_mipsle\": \"$baseUrl/AdGuardHome_linux_mipsle.tar.gz\"," >> $dst/version.json