Add build flag to enable the update

A regular make will produce a build without the updater.
An explicit -tags release is now required to bake the updater in.
pull/71/head 0.8.0-beta
lawl 4 years ago
parent 76d5c2e5ff
commit 8ddee5f4bd

@ -14,7 +14,7 @@ release: rnnoise
mkdir -p tmp/.local/bin/
go generate
CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-s -w -extldflags "-static"' .
CGO_ENABLED=0 GOOS=linux go build -tags release -a -ldflags '-s -w -extldflags "-static"' .
upx noisetorch
mv noisetorch tmp/.local/bin/
cd tmp/; \

@ -94,9 +94,6 @@ Install the Go compiler from [golang.org](https://golang.org/). And make sure yo
make # build it
```
If you build from source, it's recommended that you disable automatic update checks.
In `~/.config/noisetorch/config.toml` set `EnableUpdates = false`.
## Special thanks to
* [xiph.org](https://xiph.org)/[Mozilla's](https://mozilla.org) excellent [RNNoise](https://jmvalin.ca/demo/rnnoise/).

@ -20,7 +20,10 @@ const configFile = "config.toml"
func initializeConfigIfNot() {
log.Println("Checking if config needs to be initialized")
conf := config{Threshold: 95, DisplayMonitorSources: false, EnableUpdates: true}
conf := config{Threshold: 95, DisplayMonitorSources: false, EnableUpdates: true} // if you're a package maintainer and you mess with this, we have a problem.
// Unless you set -tags release on the build the updater is *not* compiled in any. DO NOT MESS WITH THIS!
// This isn't and never was the proper location to disable the updater.
configdir := configDir()
ok, err := exists(configdir)
if err != nil {

@ -1,3 +1,5 @@
// +build release
package main
import (

@ -0,0 +1,28 @@
// +build !release
package main
import "errors"
type updateui struct {
serverVersion string
available bool
triggered bool
updatingText string
}
func updateCheck(ctx *ntcontext) {
}
func update(ctx *ntcontext) {
}
func fetchFile(file string) ([]byte, error) {
return make([]byte, 0), errors.New("Disabled by build flags")
}
func publickey() []byte {
return make([]byte, 0)
}
Loading…
Cancel
Save