feat: implement distribution-specific build

pull/129/head
Sefa Eyeoglu 3 years ago
parent a0620ae92c
commit 8a55a20753

@ -1,3 +1,6 @@
UPDATE_URL=https://noisetorch.epicgamer.org
UPDATE_PUBKEY=3mL+rBi4yBZ1wGimQ/oSQCjxELzgTh+673H4JdzQBOk=
dev: rnnoise
mkdir -p bin/
go generate
@ -14,7 +17,7 @@ release: rnnoise
mkdir -p tmp/.local/bin/
go generate
CGO_ENABLED=0 GOOS=linux go build -tags release -a -ldflags '-s -w -extldflags "-static"' .
CGO_ENABLED=0 GOOS=linux go build -tags release -a -ldflags '-s -w -extldflags "-static" -X main.distribution=official -X main.updateURL=${UPDATE_URL} -X main.publicKeyString=${UPDATE_PUBKEY}' .
upx noisetorch
mv noisetorch tmp/.local/bin/
cd tmp/; \

@ -41,6 +41,10 @@ type device struct {
}
const appName = "NoiseTorch"
var distribution = "custom" // will be changed by build
var updateURL = "" // ditto
var publicKeyString = "" // ditto
func main() {
opt := parseCLIOpts()
@ -50,7 +54,7 @@ func main() {
} else {
log.SetOutput(ioutil.Discard)
}
log.Printf("Application starting. Version: %s\n", version)
log.Printf("Application starting. Version: %s (%s)\n", version, distribution)
log.Printf("CAP_SYS_RESOURCE: %t\n", hasCapSysResource(getCurrentCaps()))
initializeConfigIfNot()

@ -345,7 +345,7 @@ func versionView(ctx *ntcontext, w *nucular.Window) {
w.Row(50).Dynamic(1)
w.Label("Version", "CB")
w.Row(50).Dynamic(1)
w.Label(version, "CB")
w.Label(fmt.Sprintf("%s (%s)", version, distribution), "CB")
w.Row(50).Dynamic(1)
w.Spacing(1)
w.Row(20).Dynamic(2)

@ -14,9 +14,6 @@ import (
"strings"
)
var updateURL = "https://noisetorch.epicgamer.org"
var publicKeyString = "3mL+rBi4yBZ1wGimQ/oSQCjxELzgTh+673H4JdzQBOk="
type updateui struct {
serverVersion string
available bool
@ -24,7 +21,14 @@ type updateui struct {
updatingText string
}
func updateable() bool {
return updateURL != "" && publicKeyString != ""
}
func updateCheck(ctx *ntcontext) {
if !updateable() {
return
}
log.Println("Checking for updates")
bodybuf, err := fetchFile("version.txt")
if err != nil {
@ -41,6 +45,9 @@ func updateCheck(ctx *ntcontext) {
}
func update(ctx *ntcontext) {
if !updateable() {
return
}
sig, err := fetchFile("NoiseTorch_x64.tgz.sig")
if err != nil {
log.Println("Couldn't fetch signature", err)

@ -9,6 +9,10 @@ type updateui struct {
updatingText string
}
func updateable() bool {
return false
}
func updateCheck(ctx *ntcontext) {
// noop for non-release versions
}

Loading…
Cancel
Save