diff --git a/Makefile b/Makefile index a0b6e73c..0c3bd56b 100644 --- a/Makefile +++ b/Makefile @@ -5,6 +5,7 @@ GOPATH := $(shell go env GOPATH) JSFILES = $(shell find client -path client/node_modules -prune -o -type f -name '*.js') STATIC = build/static/index.html CHANNEL ?= release +GOARM_VER := TARGET=AdGuardHome @@ -23,7 +24,7 @@ $(STATIC): $(JSFILES) client/node_modules $(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/... 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 clean: diff --git a/README.md b/README.md index 3a1aedfb..8b9dc5d6 100644 --- a/README.md +++ b/README.md @@ -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) * 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) * [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) * [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) * [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) * [MIPSLE](https://static.adguard.com/adguardhome/beta/AdGuardHome_linux_mipsle.tar.gz) diff --git a/home/control_update.go b/home/control_update.go index 02c1fec0..69c62885 100644 --- a/home/control_update.go +++ b/home/control_update.go @@ -42,7 +42,11 @@ func getVersionResp(data []byte) []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 { ret["can_autoupdate"] = true } diff --git a/home/home.go b/home/home.go index fcefa4b6..44fbe855 100644 --- a/home/home.go +++ b/home/home.go @@ -42,6 +42,7 @@ var ( versionString string updateChannel string versionCheckURL string + ARMVersion string ) const versionCheckPeriod = time.Hour * 8 @@ -64,10 +65,11 @@ type homeContext struct { var Context homeContext // Main is the entry point -func Main(version string, channel string) { +func Main(version string, channel string, armVer string) { // Init update-related global variables versionString = version updateChannel = channel + ARMVersion = armVer 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 diff --git a/main.go b/main.go index 823890ea..9d441aee 100644 --- a/main.go +++ b/main.go @@ -12,7 +12,10 @@ var version = "undefined" // channel can be set via ldflags var channel = "release" +// ARM version number. Set via linker flags. +var goarm = "" + func main() { debug.SetGCPercent(10) - home.Main(version, channel) + home.Main(version, channel, goarm) } diff --git a/release.sh b/release.sh index 748e407a..4f2a4c42 100755 --- a/release.sh +++ b/release.sh @@ -12,17 +12,21 @@ version=`git describe --abbrev=4 --dirty --always --tags` f() { make cleanfast; CGO_DISABLED=1 make if [[ $GOOS == darwin ]]; then - zip $dst/AdGuardHome_MacOS.zip AdGuardHome README.md LICENSE.txt + zip $dst/AdGuardHome_MacOS.zip AdGuardHome README.md LICENSE.txt elif [[ $GOOS == windows ]]; then - zip $dst/AdGuardHome_Windows_"$GOARCH".zip AdGuardHome.exe README.md LICENSE.txt + zip $dst/AdGuardHome_Windows_"$GOARCH".zip AdGuardHome.exe README.md LICENSE.txt else - rm -rf dist/AdguardHome - mkdir -p dist/AdGuardHome - cp -pv {AdGuardHome,LICENSE.txt,README.md} dist/AdGuardHome/ - pushd dist - tar zcvf AdGuardHome_"$GOOS"_"$GOARCH".tar.gz AdGuardHome/ - popd - rm -rf dist/AdguardHome + rm -rf dist/AdguardHome + mkdir -p dist/AdGuardHome + cp -pv {AdGuardHome,LICENSE.txt,README.md} dist/AdGuardHome/ + 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/ + fi + popd + rm -rf dist/AdguardHome fi } @@ -37,6 +41,7 @@ mkdir -p $dst CHANNEL=$channel GOOS=darwin GOARCH=amd64 f CHANNEL=$channel GOOS=linux GOARCH=amd64 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=arm64 GOARM=6 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_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_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_mips\": \"$baseUrl/AdGuardHome_linux_mips.tar.gz\"," >> $dst/version.json echo " \"download_linux_mipsle\": \"$baseUrl/AdGuardHome_linux_mipsle.tar.gz\"," >> $dst/version.json