diff --git a/.goreleaser.yml b/.goreleaser.yml index b2e11b09..289c864c 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -10,8 +10,7 @@ before: - go generate ./... builds: - - - main: ./main.go + - main: ./main.go ldflags: - -s -w -X main.version={{.Version}} -X main.channel={{.Env.CHANNEL}} -X main.goarm={{.Env.GOARM}} env: @@ -43,8 +42,7 @@ builds: goarch: mipsle archives: - - - # Archive name template. + - # Archive name template. # Defaults: # - if format is `tar.gz`, `tar.xz`, `gz` or `zip`: # - `{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}{{ if .Mips }}_{{ .Mips }}{{ end }}` @@ -62,8 +60,7 @@ archives: - README.md snapcrafts: - - - name: adguard-home + - name: adguard-home base: core18 name_template: '{{ .ProjectName }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}' summary: Network-wide ads & trackers blocking DNS server @@ -80,11 +77,24 @@ snapcrafts: confinement: strict publish: false license: GPL-3.0 + extra_files: + - source: scripts/snap/local/adguard-home-web.sh + destination: adguard-home-web.sh + mode: 0755 + - source: scripts/snap/gui/adguard-home-web.desktop + destination: meta/gui/adguard-home-web.desktop + mode: 0644 + - source: scripts/snap/gui/adguard-home-web.png + destination: meta/gui/adguard-home-web.png + mode: 0644 apps: adguard-home: command: AdGuardHome -w $SNAP_DATA --no-check-update plugs: [ network-bind ] daemon: simple + adguard-home-web: + command: adguard-home-web.sh + plugs: [ desktop ] checksum: name_template: 'checksums.txt' diff --git a/scripts/snap/README.md b/scripts/snap/README.md new file mode 100644 index 00000000..6997dfee --- /dev/null +++ b/scripts/snap/README.md @@ -0,0 +1,6 @@ +# Snap GUI + +These files are added to the AdGuard Home snap in order to add an app icon: +https://github.com/AdguardTeam/AdGuardHome/pull/1836 + +See .goreleaser.yml: snapcrafts.extra_files \ No newline at end of file diff --git a/scripts/snap/gui/adguard-home-web.desktop b/scripts/snap/gui/adguard-home-web.desktop new file mode 100644 index 00000000..3d68d8b0 --- /dev/null +++ b/scripts/snap/gui/adguard-home-web.desktop @@ -0,0 +1,8 @@ +[Desktop Entry] +Type=Application +Encoding=UTF-8 +Name=AdGuard Home +Comment=Network-wide ads & trackers blocking DNS server +Exec=adguard-home.adguard-home-web +Icon=${SNAP}/meta/gui/adguard-home-web.png +Terminal=false diff --git a/scripts/snap/gui/adguard-home-web.png b/scripts/snap/gui/adguard-home-web.png new file mode 100644 index 00000000..ce3555c0 Binary files /dev/null and b/scripts/snap/gui/adguard-home-web.png differ diff --git a/scripts/snap/local/adguard-home-web.sh b/scripts/snap/local/adguard-home-web.sh new file mode 100755 index 00000000..262025df --- /dev/null +++ b/scripts/snap/local/adguard-home-web.sh @@ -0,0 +1,10 @@ +#!/bin/bash +# Get admin tool port from configuration +bind_port=$(grep bind_port $SNAP_DATA/AdGuardHome.yaml | awk -F ' ' '{print $2}') + +if [ -z "$bind_port" ]; then + xdg-open http://localhost:3000 +else + xdg-open http://localhost:$bind_port +fi +