From be4e110732c256edad1d5c14ea90197e4d4329e3 Mon Sep 17 00:00:00 2001 From: Ainar Garipov Date: Tue, 1 Jun 2021 16:04:22 +0300 Subject: [PATCH] Pull request: all: imp new plat docs Updates #2441. Updates #2443. Squashed commit of the following: commit 6e5218916753bffb91f9fc6d5a546487add620d5 Author: Ainar Garipov Date: Tue Jun 1 15:56:21 2021 +0300 all: imp new plat docs --- CHANGELOG.md | 4 +++ README.md | 6 ++-- bamboo-specs/release.yaml | 4 +-- internal/home/service.go | 4 ++- scripts/install.sh | 68 +++++++++++++++++++++++---------------- 5 files changed, 54 insertions(+), 32 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 651a2516..59d54986 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,8 @@ and this project adheres to ### Added +- `darwin/arm64` support ([#2443]). +- `freebsd/arm64` support ([#2441]). - Output of the default addresses of the upstreams used for resolving PTRs for private addresses ([#3136]). - Detection and handling of recurrent PTR requests for locally-served addresses @@ -48,6 +50,8 @@ released by then. - Go 1.15 support. +[#2441]: https://github.com/AdguardTeam/AdGuardHome/issues/2441 +[#2443]: https://github.com/AdguardTeam/AdGuardHome/issues/2443 [#3184]: https://github.com/AdguardTeam/AdGuardHome/issues/3184 [#3185]: https://github.com/AdguardTeam/AdGuardHome/issues/3185 [#3186]: https://github.com/AdguardTeam/AdGuardHome/issues/3186 diff --git a/README.md b/README.md index 99723b8f..3956b57b 100644 --- a/README.md +++ b/README.md @@ -285,7 +285,8 @@ curl -sSL https://raw.githubusercontent.com/AdguardTeam/AdGuardHome/master/scrip * Linux ARM: [32-bit ARMv6](https://static.adguard.com/adguardhome/beta/AdGuardHome_linux_armv6.tar.gz) (recommended for Raspberry Pi), [64-bit](https://static.adguard.com/adguardhome/beta/AdGuardHome_linux_arm64.tar.gz), [32-bit ARMv5](https://static.adguard.com/adguardhome/beta/AdGuardHome_linux_armv5.tar.gz), [32-bit ARMv7](https://static.adguard.com/adguardhome/beta/AdGuardHome_linux_armv7.tar.gz) * Linux MIPS: [32-bit MIPS](https://static.adguard.com/adguardhome/beta/AdGuardHome_linux_mips_softfloat.tar.gz), [32-bit MIPSLE](https://static.adguard.com/adguardhome/beta/AdGuardHome_linux_mipsle_softfloat.tar.gz), [64-bit MIPS](https://static.adguard.com/adguardhome/beta/AdGuardHome_linux_mips64_softfloat.tar.gz), [64-bit MIPSLE](https://static.adguard.com/adguardhome/beta/AdGuardHome_linux_mips64le_softfloat.tar.gz) * Windows: [64-bit](https://static.adguard.com/adguardhome/beta/AdGuardHome_windows_amd64.zip), [32-bit](https://static.adguard.com/adguardhome/beta/AdGuardHome_windows_386.zip) - * MacOS: [64-bit](https://static.adguard.com/adguardhome/beta/AdGuardHome_darwin_amd64.zip), [32-bit](https://static.adguard.com/adguardhome/beta/AdGuardHome_darwin_386.zip) + * macOS: [64-bit](https://static.adguard.com/adguardhome/beta/AdGuardHome_darwin_amd64.zip), [32-bit](https://static.adguard.com/adguardhome/beta/AdGuardHome_darwin_386.zip) + * macOS ARM: [64-bit](https://static.adguard.com/adguardhome/beta/AdGuardHome_darwin_arm64.zip) * FreeBSD: [64-bit](https://static.adguard.com/adguardhome/beta/AdGuardHome_freebsd_amd64.tar.gz), [32-bit](https://static.adguard.com/adguardhome/beta/AdGuardHome_freebsd_386.tar.gz) * FreeBSD ARM: [64-bit](https://static.adguard.com/adguardhome/beta/AdGuardHome_freebsd_arm64.tar.gz), [32-bit ARMv5](https://static.adguard.com/adguardhome/beta/AdGuardHome_freebsd_armv5.tar.gz), [32-bit ARMv6](https://static.adguard.com/adguardhome/beta/AdGuardHome_freebsd_armv6.tar.gz), [32-bit ARMv7](https://static.adguard.com/adguardhome/beta/AdGuardHome_freebsd_armv7.tar.gz) @@ -294,7 +295,8 @@ curl -sSL https://raw.githubusercontent.com/AdguardTeam/AdGuardHome/master/scrip * Linux ARM: [32-bit ARMv6](https://static.adguard.com/adguardhome/edge/AdGuardHome_linux_armv6.tar.gz) (recommended for Raspberry Pi), [64-bit](https://static.adguard.com/adguardhome/edge/AdGuardHome_linux_arm64.tar.gz), [32-bit ARMv5](https://static.adguard.com/adguardhome/edge/AdGuardHome_linux_armv5.tar.gz), [32-bit ARMv7](https://static.adguard.com/adguardhome/edge/AdGuardHome_linux_armv7.tar.gz) * Linux MIPS: [32-bit MIPS](https://static.adguard.com/adguardhome/edge/AdGuardHome_linux_mips_softfloat.tar.gz), [32-bit MIPSLE](https://static.adguard.com/adguardhome/edge/AdGuardHome_linux_mipsle_softfloat.tar.gz), [64-bit MIPS](https://static.adguard.com/adguardhome/edge/AdGuardHome_linux_mips64_softfloat.tar.gz), [64-bit MIPSLE](https://static.adguard.com/adguardhome/edge/AdGuardHome_linux_mips64le_softfloat.tar.gz) * Windows: [64-bit](https://static.adguard.com/adguardhome/edge/AdGuardHome_windows_amd64.zip), [32-bit](https://static.adguard.com/adguardhome/edge/AdGuardHome_windows_386.zip) - * MacOS: [64-bit](https://static.adguard.com/adguardhome/edge/AdGuardHome_darwin_amd64.zip), [32-bit](https://static.adguard.com/adguardhome/edge/AdGuardHome_darwin_386.zip) + * macOS: [64-bit](https://static.adguard.com/adguardhome/edge/AdGuardHome_darwin_amd64.zip), [32-bit](https://static.adguard.com/adguardhome/edge/AdGuardHome_darwin_386.zip) + * macOS ARM: [64-bit](https://static.adguard.com/adguardhome/edge/AdGuardHome_darwin_arm64.zip) * FreeBSD: [64-bit](https://static.adguard.com/adguardhome/edge/AdGuardHome_freebsd_amd64.tar.gz), [32-bit](https://static.adguard.com/adguardhome/edge/AdGuardHome_freebsd_386.tar.gz) * FreeBSD ARM: [64-bit](https://static.adguard.com/adguardhome/edge/AdGuardHome_freebsd_arm64.tar.gz), [32-bit ARMv5](https://static.adguard.com/adguardhome/edge/AdGuardHome_freebsd_armv5.tar.gz), [32-bit ARMv6](https://static.adguard.com/adguardhome/edge/AdGuardHome_freebsd_armv6.tar.gz), [32-bit ARMv7](https://static.adguard.com/adguardhome/edge/AdGuardHome_freebsd_armv7.tar.gz) diff --git a/bamboo-specs/release.yaml b/bamboo-specs/release.yaml index 1ede1e1a..d18549fd 100644 --- a/bamboo-specs/release.yaml +++ b/bamboo-specs/release.yaml @@ -266,7 +266,7 @@ # need to build a few of these. 'variables': 'channel': 'beta' - 'dockerGo': 'adguard/golang-ubuntu:2.0' + 'dockerGo': 'adguard/golang-ubuntu:3.1' # release-vX.Y.Z branches are the branches from which the actual final release # is built. - '^release-v[0-9]+\.[0-9]+\.[0-9]+': @@ -276,4 +276,4 @@ # are the ones that actually get released. 'variables': 'channel': 'release' - 'dockerGo': 'adguard/golang-ubuntu:2.0' + 'dockerGo': 'adguard/golang-ubuntu:3.1' diff --git a/internal/home/service.go b/internal/home/service.go index c940da07..d881e9f6 100644 --- a/internal/home/service.go +++ b/internal/home/service.go @@ -282,7 +282,8 @@ func handleServiceUninstallCommand(s service.Service) { func configureService(c *service.Config) { c.Option = service.KeyValue{} - // OS X + // macOS + // Redefines the launchd config file template // The purpose is to enable stdout/stderr redirect by default c.Option["LaunchdConfig"] = launchdConfig @@ -290,6 +291,7 @@ func configureService(c *service.Config) { c.Option["RunAtLoad"] = true // POSIX + // Redirect StdErr & StdOut to files. c.Option["LogOutput"] = true diff --git a/scripts/install.sh b/scripts/install.sh index 92cb6162..6b9e2429 100644 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -52,13 +52,20 @@ check_required() { # Split with space. required="curl" - if [ "$os" = 'linux' ] || [ "$os" = 'freebsd' ] - then + case "$os" + in + ('freebsd'|'linux') required="$required $required_unix" - elif [ "$os" = 'darwin' ] - then + ;; + ('darwin') required="$required $required_darwin" - fi + ;; + (*) + # Generally shouldn't happen, since the OS has already been + # validated. + error_exit "unsupported operating system: $os" + ;; + esac # Don't use quotes to get word splitting. for cmd in ${required} @@ -88,7 +95,7 @@ check_out_dir() { # Function parse_opts parses the options list and validates it's combinations. parse_opts() { - while getopts "C:c:hO:o:rRuUvV" opt $* + while getopts "C:c:hO:o:rRuUvV" opt "$@" do case "$opt" in @@ -181,11 +188,11 @@ set_os() { # Validate. case "$os" in - ('linux'|'freebsd'|'darwin') + ('darwin'|'freebsd'|'linux') # All right, go on. ;; (*) - error_exit "unsupported operating system: $os" + error_exit "unsupported operating system: '$os'" ;; esac @@ -247,29 +254,42 @@ set_cpu() { log "cpu type: $cpu" } -# Function fix_darwin performs some configuration changes for macOS if -# needed. +# Function fix_darwin performs some configuration changes for macOS if needed. +# +# TODO(a.garipov): Remove after the final v0.107.0 release. +# +# See https://github.com/AdguardTeam/AdGuardHome/issues/2443. fix_darwin() { - if ! [ "$os" = 'darwin' ] + if [ "$os" != 'darwin' ] then return 0 fi - # TODO(e.burkov): Remove after we release at least one stable release - # with Apple Silicon support. - # - # See https://github.com/AdguardTeam/AdGuardHome/issues/2443. if [ "$cpu" = 'arm64' ] then - cpu='amd64' - log "use $cpu build on Mac M1 until the native ARM support is added." + case "$channel" + in + ('beta'|'development'|'edge') + # Everything is fine, we have Apple Silicon support on + # these channels. + ;; + ('release') + cpu='amd64' + log "use $cpu build on Mac M1 until the native ARM support is added." + ;; + (*) + # Generally shouldn't happen, since the release channel + # has already been validated. + error_exit "invalid channel '$channel'" + ;; + esac fi # Set the package extension. pkg_ext='zip' # It is important to install AdGuard Home into the /Applications - # directory on MacOS. Otherwise, it may not grant enough privileges to + # directory on macOS. Otherwise, it may not grant enough privileges to # the AdGuard Home. out_dir='/Applications' } @@ -355,8 +375,7 @@ rerun_with_root() { log 'restarting with root privileges' - curl -L -S -s "$script_url" | sudo sh -s -- $opts - exit $? + curl -L -S -s "$script_url" | sudo sh -s -- $opts } # Function download downloads the file from the URL and saves it to the @@ -391,11 +410,6 @@ unpack() { ;; esac - if [ "$?" != '0' ] - then - error_exit "cannot unpack the package into $out_dir" - fi - rm "$pkg_name" } @@ -418,7 +432,7 @@ handle_existing() { then log 'the existing AdGuard Home installation is detected' - if [ "$reinstall" != '1' ] && [ "$uninstall" != '1' ] + if [ "$reinstall" -ne '1' ] && [ "$uninstall" -ne '1' ] then error_exit \ "to reinstall/uninstall the AdGuard Home using\this script specify one of the '-r' or '-u' flags" @@ -489,7 +503,7 @@ cpu='' os='' out_dir='/opt' pkg_ext='tar.gz' -parse_opts $* +parse_opts "$@" echo 'starting AdGuard Home installation script'