* [PR PATCH] NetAuth: add completions and manpages
@ 2022-09-24 22:02 classabbyamp
2022-10-12 3:18 ` [PR PATCH] [Updated] " classabbyamp
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: classabbyamp @ 2022-09-24 22:02 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 727 bytes --]
There is a new pull request by classabbyamp against master on the void-packages repository
https://github.com/classabbyamp/void-packages netauth-comp-man
https://github.com/void-linux/void-packages/pull/39451
NetAuth: add completions and manpages
<!-- Uncomment relevant sections and delete options which are not applicable -->
#### Testing the changes
- I tested the changes in this PR: **briefly**
fails on cross right now:
```
Could not get default user: user: unknown userid 1000
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x51b4f8]
```
A patch file from https://github.com/void-linux/void-packages/pull/39451.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-netauth-comp-man-39451.patch --]
[-- Type: text/x-diff, Size: 5911 bytes --]
From 8ebdaaa5c5f745664e15f37b6624cf297b219388 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Sat, 24 Sep 2022 17:55:02 -0400
Subject: [PATCH] NetAuth: add completions and manpages
---
srcpkgs/NetAuth/patches/cli-generate.patch | 36 ++++++++
srcpkgs/NetAuth/patches/config-loading.patch | 87 ++++++++++++++++++++
srcpkgs/NetAuth/template | 12 ++-
3 files changed, 134 insertions(+), 1 deletion(-)
create mode 100644 srcpkgs/NetAuth/patches/cli-generate.patch
create mode 100644 srcpkgs/NetAuth/patches/config-loading.patch
diff --git a/srcpkgs/NetAuth/patches/cli-generate.patch b/srcpkgs/NetAuth/patches/cli-generate.patch
new file mode 100644
index 000000000000..ba8c8bc97f96
--- /dev/null
+++ b/srcpkgs/NetAuth/patches/cli-generate.patch
@@ -0,0 +1,36 @@
+From cb7cfa5bc0530e43fdbc227783187a141d857139 Mon Sep 17 00:00:00 2001
+From: classabbyamp <dev@placeviolette.net>
+Date: Sat, 24 Sep 2022 17:40:11 -0400
+Subject: [PATCH] internal/ctl/system-ctl: don't run initialize(), rename to
+ system-cli
+
+the default initialize() is not necessary when generating completions
+and docs, so we can override it with an empty function.
+
+Also, the file was renamed to `system-cli` to put it more inline with
+other files' naming conventions.
+---
+ internal/ctl/{system-ctl.go => system-cli.go} | 3 +++
+ 1 file changed, 3 insertions(+)
+ rename internal/ctl/{system-ctl.go => system-cli.go} (68%)
+
+diff --git a/internal/ctl/system-ctl.go b/internal/ctl/system-cli.go
+similarity index 68%
+rename from internal/ctl/system-ctl.go
+rename to internal/ctl/system-cli.go
+index 3dbd9d3..0a42d05 100644
+--- a/internal/ctl/system-ctl.go
++++ b/internal/ctl/system-cli.go
+@@ -8,9 +8,12 @@ var (
+ cliCmd = &cobra.Command{
+ Use: "cli",
+ Short: "Extra utilities for the CLI",
++ PersistentPreRun: cli_initialize,
+ }
+ )
+
+ func init() {
+ systemCmd.AddCommand(cliCmd)
+ }
++
++func cli_initialize(*cobra.Command, []string) {}
diff --git a/srcpkgs/NetAuth/patches/config-loading.patch b/srcpkgs/NetAuth/patches/config-loading.patch
new file mode 100644
index 000000000000..c197c569bc06
--- /dev/null
+++ b/srcpkgs/NetAuth/patches/config-loading.patch
@@ -0,0 +1,87 @@
+From 1df568cd25d6ccac79e56451406e021ead49c0c4 Mon Sep 17 00:00:00 2001
+From: Michael Aldridge <aldridge.mac@gmail.com>
+Date: Wed, 31 Aug 2022 16:44:40 -0500
+Subject: [PATCH] pkg/netauth: Handle config loading in library layer
+
+---
+ cmd/netauth/main.go | 7 -------
+ internal/ctl/root.go | 9 ---------
+ pkg/netauth/netauth.go | 13 +++++++++++++
+ 3 files changed, 13 insertions(+), 16 deletions(-)
+
+diff --git a/cmd/netauth/main.go b/cmd/netauth/main.go
+index d66dd8a..7695cd5 100644
+--- a/cmd/netauth/main.go
++++ b/cmd/netauth/main.go
+@@ -4,7 +4,6 @@ import (
+ "os"
+
+ "github.com/hashicorp/go-hclog"
+- "github.com/spf13/viper"
+
+ "github.com/netauth/netauth/internal/ctl"
+
+@@ -22,12 +21,6 @@ var (
+ )
+
+ func main() {
+- // This runs here so we can reset the defaults that are set
+- // during various init() methods.
+- viper.SetDefault("token.cache", "fs")
+- viper.SetDefault("token.keyprovider", "fs")
+- viper.SetDefault("token.backend", "jwt-rsa")
+-
+ level, set := os.LookupEnv("NETAUTH_LOGLEVEL")
+ if !set {
+ appLogger = hclog.NewNullLogger()
+diff --git a/internal/ctl/root.go b/internal/ctl/root.go
+index faf35b0..b20c0d2 100644
+--- a/internal/ctl/root.go
++++ b/internal/ctl/root.go
+@@ -61,15 +61,6 @@ func onInit() {
+ viper.BindPFlags(pflag.CommandLine)
+ if cfg != "" {
+ viper.SetConfigFile(cfg)
+- } else {
+- viper.SetConfigName("config")
+- viper.AddConfigPath(".")
+- viper.AddConfigPath("$HOME/.netauth")
+- viper.AddConfigPath("/etc/netauth/")
+- }
+- if err := viper.ReadInConfig(); err != nil {
+- fmt.Println("Error reading config:", err)
+- os.Exit(1)
+ }
+ viper.Set("client.ServiceName", "netauth")
+
+diff --git a/pkg/netauth/netauth.go b/pkg/netauth/netauth.go
+index 831d64f..77a203c 100644
+--- a/pkg/netauth/netauth.go
++++ b/pkg/netauth/netauth.go
+@@ -17,6 +17,14 @@ import (
+ func init() {
+ viper.SetDefault("core.port", 1729)
+ viper.SetDefault("tls.certificate", "keys/tls.pem")
++ viper.SetDefault("token.cache", "fs")
++ viper.SetDefault("token.keyprovider", "fs")
++ viper.SetDefault("token.backend", "jwt-rsa")
++
++ viper.SetConfigName("config")
++ viper.AddConfigPath(".")
++ viper.AddConfigPath("$HOME/.netauth")
++ viper.AddConfigPath("/etc/netauth/")
+ }
+
+ // NewWithLog uses the specified logger to contruct a NetAuth client.
+@@ -24,6 +32,11 @@ func init() {
+ // handler that is provided should have the correct name and be
+ // parented to the correct point on the log tree.
+ func NewWithLog(l hclog.Logger) (*Client, error) {
++ if err := viper.ReadInConfig(); err != nil {
++ fmt.Println("Error reading config:", err)
++ os.Exit(1)
++ }
++
+ if viper.GetString("core.conf") == "" {
+ viper.Set("core.conf", filepath.Dir(viper.ConfigFileUsed()))
+ l.Debug("Config relative load path set", "path", viper.GetString("core.conf"))
diff --git a/srcpkgs/NetAuth/template b/srcpkgs/NetAuth/template
index 4586019d0690..481186f72335 100644
--- a/srcpkgs/NetAuth/template
+++ b/srcpkgs/NetAuth/template
@@ -1,9 +1,10 @@
# Template file for 'NetAuth'
pkgname=NetAuth
version=0.6.0
-revision=1
+revision=2
wrksrc=netauth-$version
build_style="go"
+build_helper="qemu"
go_import_path="github.com/netauth/netauth"
go_package="${go_import_path}/cmd/netauth
${go_import_path}/cmd/netauthd"
@@ -20,6 +21,15 @@ do_check() {
}
post_install() {
+ for sh in bash zsh; do
+ vtargetrun ${DESTDIR}/usr/bin/netauth system cli ${sh} netauth.${sh}
+ vcompletion netauth.${sh} ${sh} netauth
+ done
+ mkdir manpages
+ vtargetrun ${DESTDIR}/usr/bin/netauth system cli man manpages
+ for p in manpages/*; do
+ vman "${p}"
+ done
vlicense LICENSE
vsv netauthd
}
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PR PATCH] [Updated] NetAuth: add completions and manpages
2022-09-24 22:02 [PR PATCH] NetAuth: add completions and manpages classabbyamp
@ 2022-10-12 3:18 ` classabbyamp
2022-10-19 4:45 ` Vaelatern
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: classabbyamp @ 2022-10-12 3:18 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 762 bytes --]
There is an updated pull request by classabbyamp against master on the void-packages repository
https://github.com/classabbyamp/void-packages netauth-comp-man
https://github.com/void-linux/void-packages/pull/39451
NetAuth: add completions and manpages
<!-- Uncomment relevant sections and delete options which are not applicable -->
#### Testing the changes
- I tested the changes in this PR: **briefly**
fails locally on cross (but succeeds in ci):
```
Could not get default user: user: unknown userid 1000
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x51b4f8]
```
A patch file from https://github.com/void-linux/void-packages/pull/39451.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-netauth-comp-man-39451.patch --]
[-- Type: text/x-diff, Size: 5965 bytes --]
From 70278dd31add11fc204e7e9032ce0daf844efe71 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Sat, 24 Sep 2022 17:55:02 -0400
Subject: [PATCH] NetAuth: add completions and manpages
---
srcpkgs/NetAuth/patches/cli-generate.patch | 36 ++++++++
srcpkgs/NetAuth/patches/config-loading.patch | 87 ++++++++++++++++++++
srcpkgs/NetAuth/template | 10 +++
3 files changed, 133 insertions(+)
create mode 100644 srcpkgs/NetAuth/patches/cli-generate.patch
create mode 100644 srcpkgs/NetAuth/patches/config-loading.patch
diff --git a/srcpkgs/NetAuth/patches/cli-generate.patch b/srcpkgs/NetAuth/patches/cli-generate.patch
new file mode 100644
index 000000000000..ba8c8bc97f96
--- /dev/null
+++ b/srcpkgs/NetAuth/patches/cli-generate.patch
@@ -0,0 +1,36 @@
+From cb7cfa5bc0530e43fdbc227783187a141d857139 Mon Sep 17 00:00:00 2001
+From: classabbyamp <dev@placeviolette.net>
+Date: Sat, 24 Sep 2022 17:40:11 -0400
+Subject: [PATCH] internal/ctl/system-ctl: don't run initialize(), rename to
+ system-cli
+
+the default initialize() is not necessary when generating completions
+and docs, so we can override it with an empty function.
+
+Also, the file was renamed to `system-cli` to put it more inline with
+other files' naming conventions.
+---
+ internal/ctl/{system-ctl.go => system-cli.go} | 3 +++
+ 1 file changed, 3 insertions(+)
+ rename internal/ctl/{system-ctl.go => system-cli.go} (68%)
+
+diff --git a/internal/ctl/system-ctl.go b/internal/ctl/system-cli.go
+similarity index 68%
+rename from internal/ctl/system-ctl.go
+rename to internal/ctl/system-cli.go
+index 3dbd9d3..0a42d05 100644
+--- a/internal/ctl/system-ctl.go
++++ b/internal/ctl/system-cli.go
+@@ -8,9 +8,12 @@ var (
+ cliCmd = &cobra.Command{
+ Use: "cli",
+ Short: "Extra utilities for the CLI",
++ PersistentPreRun: cli_initialize,
+ }
+ )
+
+ func init() {
+ systemCmd.AddCommand(cliCmd)
+ }
++
++func cli_initialize(*cobra.Command, []string) {}
diff --git a/srcpkgs/NetAuth/patches/config-loading.patch b/srcpkgs/NetAuth/patches/config-loading.patch
new file mode 100644
index 000000000000..c197c569bc06
--- /dev/null
+++ b/srcpkgs/NetAuth/patches/config-loading.patch
@@ -0,0 +1,87 @@
+From 1df568cd25d6ccac79e56451406e021ead49c0c4 Mon Sep 17 00:00:00 2001
+From: Michael Aldridge <aldridge.mac@gmail.com>
+Date: Wed, 31 Aug 2022 16:44:40 -0500
+Subject: [PATCH] pkg/netauth: Handle config loading in library layer
+
+---
+ cmd/netauth/main.go | 7 -------
+ internal/ctl/root.go | 9 ---------
+ pkg/netauth/netauth.go | 13 +++++++++++++
+ 3 files changed, 13 insertions(+), 16 deletions(-)
+
+diff --git a/cmd/netauth/main.go b/cmd/netauth/main.go
+index d66dd8a..7695cd5 100644
+--- a/cmd/netauth/main.go
++++ b/cmd/netauth/main.go
+@@ -4,7 +4,6 @@ import (
+ "os"
+
+ "github.com/hashicorp/go-hclog"
+- "github.com/spf13/viper"
+
+ "github.com/netauth/netauth/internal/ctl"
+
+@@ -22,12 +21,6 @@ var (
+ )
+
+ func main() {
+- // This runs here so we can reset the defaults that are set
+- // during various init() methods.
+- viper.SetDefault("token.cache", "fs")
+- viper.SetDefault("token.keyprovider", "fs")
+- viper.SetDefault("token.backend", "jwt-rsa")
+-
+ level, set := os.LookupEnv("NETAUTH_LOGLEVEL")
+ if !set {
+ appLogger = hclog.NewNullLogger()
+diff --git a/internal/ctl/root.go b/internal/ctl/root.go
+index faf35b0..b20c0d2 100644
+--- a/internal/ctl/root.go
++++ b/internal/ctl/root.go
+@@ -61,15 +61,6 @@ func onInit() {
+ viper.BindPFlags(pflag.CommandLine)
+ if cfg != "" {
+ viper.SetConfigFile(cfg)
+- } else {
+- viper.SetConfigName("config")
+- viper.AddConfigPath(".")
+- viper.AddConfigPath("$HOME/.netauth")
+- viper.AddConfigPath("/etc/netauth/")
+- }
+- if err := viper.ReadInConfig(); err != nil {
+- fmt.Println("Error reading config:", err)
+- os.Exit(1)
+ }
+ viper.Set("client.ServiceName", "netauth")
+
+diff --git a/pkg/netauth/netauth.go b/pkg/netauth/netauth.go
+index 831d64f..77a203c 100644
+--- a/pkg/netauth/netauth.go
++++ b/pkg/netauth/netauth.go
+@@ -17,6 +17,14 @@ import (
+ func init() {
+ viper.SetDefault("core.port", 1729)
+ viper.SetDefault("tls.certificate", "keys/tls.pem")
++ viper.SetDefault("token.cache", "fs")
++ viper.SetDefault("token.keyprovider", "fs")
++ viper.SetDefault("token.backend", "jwt-rsa")
++
++ viper.SetConfigName("config")
++ viper.AddConfigPath(".")
++ viper.AddConfigPath("$HOME/.netauth")
++ viper.AddConfigPath("/etc/netauth/")
+ }
+
+ // NewWithLog uses the specified logger to contruct a NetAuth client.
+@@ -24,6 +32,11 @@ func init() {
+ // handler that is provided should have the correct name and be
+ // parented to the correct point on the log tree.
+ func NewWithLog(l hclog.Logger) (*Client, error) {
++ if err := viper.ReadInConfig(); err != nil {
++ fmt.Println("Error reading config:", err)
++ os.Exit(1)
++ }
++
+ if viper.GetString("core.conf") == "" {
+ viper.Set("core.conf", filepath.Dir(viper.ConfigFileUsed()))
+ l.Debug("Config relative load path set", "path", viper.GetString("core.conf"))
diff --git a/srcpkgs/NetAuth/template b/srcpkgs/NetAuth/template
index be7f2cb0f81f..cf02007c3c1c 100644
--- a/srcpkgs/NetAuth/template
+++ b/srcpkgs/NetAuth/template
@@ -4,6 +4,7 @@ version=0.6.1
revision=1
wrksrc=netauth-$version
build_style="go"
+build_helper="qemu"
go_import_path="github.com/netauth/netauth"
go_package="${go_import_path}/cmd/netauth
${go_import_path}/cmd/netauthd"
@@ -15,6 +16,15 @@ distfiles="https://github.com/NetAuth/NetAuth/archive/v$version.tar.gz"
checksum=cf84b2e63b7a59ec6e415ead1a94994b040b30fee2b27e482073371cfb0fb444
post_install() {
+ for sh in bash zsh; do
+ vtargetrun ${DESTDIR}/usr/bin/netauth system cli ${sh} netauth.${sh}
+ vcompletion netauth.${sh} ${sh} netauth
+ done
+ mkdir manpages
+ vtargetrun ${DESTDIR}/usr/bin/netauth system cli man manpages
+ for p in manpages/*; do
+ vman "${p}"
+ done
vlicense LICENSE
vsv netauthd
}
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: NetAuth: add completions and manpages
2022-09-24 22:02 [PR PATCH] NetAuth: add completions and manpages classabbyamp
2022-10-12 3:18 ` [PR PATCH] [Updated] " classabbyamp
@ 2022-10-19 4:45 ` Vaelatern
2022-10-19 5:55 ` the-maldridge
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Vaelatern @ 2022-10-19 4:45 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 913 bytes --]
New comment by Vaelatern on void-packages repository
https://github.com/void-linux/void-packages/pull/39451#issuecomment-1283420652
Comment:
Hey @classabbyamp and @the-maldridge what do you think about
```
diff --git a/srcpkgs/NetAuth/template b/srcpkgs/NetAuth/template
index be7f2cb0f81..22ca583f769 100644
--- a/srcpkgs/NetAuth/template
+++ b/srcpkgs/NetAuth/template
@@ -1,11 +1,12 @@
# Template file for 'NetAuth'
pkgname=NetAuth
version=0.6.1
-revision=1
+revision=2
wrksrc=netauth-$version
build_style="go"
go_import_path="github.com/netauth/netauth"
go_package="${go_import_path}/cmd/netauth
+ ${go_import_path}/cmd/nsutil
${go_import_path}/cmd/netauthd"
short_desc="Network authentication and identity system"
maintainer="Michael Aldridge <maldridge@netauth.org>"
```
Trying to bootstrap a standalone little netauth instance, and finding it tricky without nsutil :)
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: NetAuth: add completions and manpages
2022-09-24 22:02 [PR PATCH] NetAuth: add completions and manpages classabbyamp
2022-10-12 3:18 ` [PR PATCH] [Updated] " classabbyamp
2022-10-19 4:45 ` Vaelatern
@ 2022-10-19 5:55 ` the-maldridge
2022-10-19 6:19 ` [PR PATCH] [Updated] " classabbyamp
2022-10-19 15:57 ` [PR PATCH] [Merged]: " classabbyamp
4 siblings, 0 replies; 6+ messages in thread
From: the-maldridge @ 2022-10-19 5:55 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 356 bytes --]
New comment by the-maldridge on void-packages repository
https://github.com/void-linux/void-packages/pull/39451#issuecomment-1283468888
Comment:
Yeah I'd been planning to drop in nsutil at version 0.7, but that was being held on getting HA storage into the release. I think in the meantime it should be fine to build nsutil on the 0.6.x release series.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PR PATCH] [Updated] NetAuth: add completions and manpages
2022-09-24 22:02 [PR PATCH] NetAuth: add completions and manpages classabbyamp
` (2 preceding siblings ...)
2022-10-19 5:55 ` the-maldridge
@ 2022-10-19 6:19 ` classabbyamp
2022-10-19 15:57 ` [PR PATCH] [Merged]: " classabbyamp
4 siblings, 0 replies; 6+ messages in thread
From: classabbyamp @ 2022-10-19 6:19 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 762 bytes --]
There is an updated pull request by classabbyamp against master on the void-packages repository
https://github.com/classabbyamp/void-packages netauth-comp-man
https://github.com/void-linux/void-packages/pull/39451
NetAuth: add completions and manpages
<!-- Uncomment relevant sections and delete options which are not applicable -->
#### Testing the changes
- I tested the changes in this PR: **briefly**
fails locally on cross (but succeeds in ci):
```
Could not get default user: user: unknown userid 1000
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x51b4f8]
```
A patch file from https://github.com/void-linux/void-packages/pull/39451.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-netauth-comp-man-39451.patch --]
[-- Type: text/x-diff, Size: 6123 bytes --]
From 76fc787caeb9c571c4fc54b7c00f8c42d1cb8737 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Sat, 24 Sep 2022 17:55:02 -0400
Subject: [PATCH] NetAuth: add completions and manpages, build nsutil
---
srcpkgs/NetAuth/patches/cli-generate.patch | 36 ++++++++
srcpkgs/NetAuth/patches/config-loading.patch | 87 ++++++++++++++++++++
srcpkgs/NetAuth/template | 11 +++
3 files changed, 134 insertions(+)
create mode 100644 srcpkgs/NetAuth/patches/cli-generate.patch
create mode 100644 srcpkgs/NetAuth/patches/config-loading.patch
diff --git a/srcpkgs/NetAuth/patches/cli-generate.patch b/srcpkgs/NetAuth/patches/cli-generate.patch
new file mode 100644
index 000000000000..ba8c8bc97f96
--- /dev/null
+++ b/srcpkgs/NetAuth/patches/cli-generate.patch
@@ -0,0 +1,36 @@
+From cb7cfa5bc0530e43fdbc227783187a141d857139 Mon Sep 17 00:00:00 2001
+From: classabbyamp <dev@placeviolette.net>
+Date: Sat, 24 Sep 2022 17:40:11 -0400
+Subject: [PATCH] internal/ctl/system-ctl: don't run initialize(), rename to
+ system-cli
+
+the default initialize() is not necessary when generating completions
+and docs, so we can override it with an empty function.
+
+Also, the file was renamed to `system-cli` to put it more inline with
+other files' naming conventions.
+---
+ internal/ctl/{system-ctl.go => system-cli.go} | 3 +++
+ 1 file changed, 3 insertions(+)
+ rename internal/ctl/{system-ctl.go => system-cli.go} (68%)
+
+diff --git a/internal/ctl/system-ctl.go b/internal/ctl/system-cli.go
+similarity index 68%
+rename from internal/ctl/system-ctl.go
+rename to internal/ctl/system-cli.go
+index 3dbd9d3..0a42d05 100644
+--- a/internal/ctl/system-ctl.go
++++ b/internal/ctl/system-cli.go
+@@ -8,9 +8,12 @@ var (
+ cliCmd = &cobra.Command{
+ Use: "cli",
+ Short: "Extra utilities for the CLI",
++ PersistentPreRun: cli_initialize,
+ }
+ )
+
+ func init() {
+ systemCmd.AddCommand(cliCmd)
+ }
++
++func cli_initialize(*cobra.Command, []string) {}
diff --git a/srcpkgs/NetAuth/patches/config-loading.patch b/srcpkgs/NetAuth/patches/config-loading.patch
new file mode 100644
index 000000000000..c197c569bc06
--- /dev/null
+++ b/srcpkgs/NetAuth/patches/config-loading.patch
@@ -0,0 +1,87 @@
+From 1df568cd25d6ccac79e56451406e021ead49c0c4 Mon Sep 17 00:00:00 2001
+From: Michael Aldridge <aldridge.mac@gmail.com>
+Date: Wed, 31 Aug 2022 16:44:40 -0500
+Subject: [PATCH] pkg/netauth: Handle config loading in library layer
+
+---
+ cmd/netauth/main.go | 7 -------
+ internal/ctl/root.go | 9 ---------
+ pkg/netauth/netauth.go | 13 +++++++++++++
+ 3 files changed, 13 insertions(+), 16 deletions(-)
+
+diff --git a/cmd/netauth/main.go b/cmd/netauth/main.go
+index d66dd8a..7695cd5 100644
+--- a/cmd/netauth/main.go
++++ b/cmd/netauth/main.go
+@@ -4,7 +4,6 @@ import (
+ "os"
+
+ "github.com/hashicorp/go-hclog"
+- "github.com/spf13/viper"
+
+ "github.com/netauth/netauth/internal/ctl"
+
+@@ -22,12 +21,6 @@ var (
+ )
+
+ func main() {
+- // This runs here so we can reset the defaults that are set
+- // during various init() methods.
+- viper.SetDefault("token.cache", "fs")
+- viper.SetDefault("token.keyprovider", "fs")
+- viper.SetDefault("token.backend", "jwt-rsa")
+-
+ level, set := os.LookupEnv("NETAUTH_LOGLEVEL")
+ if !set {
+ appLogger = hclog.NewNullLogger()
+diff --git a/internal/ctl/root.go b/internal/ctl/root.go
+index faf35b0..b20c0d2 100644
+--- a/internal/ctl/root.go
++++ b/internal/ctl/root.go
+@@ -61,15 +61,6 @@ func onInit() {
+ viper.BindPFlags(pflag.CommandLine)
+ if cfg != "" {
+ viper.SetConfigFile(cfg)
+- } else {
+- viper.SetConfigName("config")
+- viper.AddConfigPath(".")
+- viper.AddConfigPath("$HOME/.netauth")
+- viper.AddConfigPath("/etc/netauth/")
+- }
+- if err := viper.ReadInConfig(); err != nil {
+- fmt.Println("Error reading config:", err)
+- os.Exit(1)
+ }
+ viper.Set("client.ServiceName", "netauth")
+
+diff --git a/pkg/netauth/netauth.go b/pkg/netauth/netauth.go
+index 831d64f..77a203c 100644
+--- a/pkg/netauth/netauth.go
++++ b/pkg/netauth/netauth.go
+@@ -17,6 +17,14 @@ import (
+ func init() {
+ viper.SetDefault("core.port", 1729)
+ viper.SetDefault("tls.certificate", "keys/tls.pem")
++ viper.SetDefault("token.cache", "fs")
++ viper.SetDefault("token.keyprovider", "fs")
++ viper.SetDefault("token.backend", "jwt-rsa")
++
++ viper.SetConfigName("config")
++ viper.AddConfigPath(".")
++ viper.AddConfigPath("$HOME/.netauth")
++ viper.AddConfigPath("/etc/netauth/")
+ }
+
+ // NewWithLog uses the specified logger to contruct a NetAuth client.
+@@ -24,6 +32,11 @@ func init() {
+ // handler that is provided should have the correct name and be
+ // parented to the correct point on the log tree.
+ func NewWithLog(l hclog.Logger) (*Client, error) {
++ if err := viper.ReadInConfig(); err != nil {
++ fmt.Println("Error reading config:", err)
++ os.Exit(1)
++ }
++
+ if viper.GetString("core.conf") == "" {
+ viper.Set("core.conf", filepath.Dir(viper.ConfigFileUsed()))
+ l.Debug("Config relative load path set", "path", viper.GetString("core.conf"))
diff --git a/srcpkgs/NetAuth/template b/srcpkgs/NetAuth/template
index be7f2cb0f81f..c4da1bad52ef 100644
--- a/srcpkgs/NetAuth/template
+++ b/srcpkgs/NetAuth/template
@@ -4,8 +4,10 @@ version=0.6.1
revision=1
wrksrc=netauth-$version
build_style="go"
+build_helper="qemu"
go_import_path="github.com/netauth/netauth"
go_package="${go_import_path}/cmd/netauth
+ ${go_import_path}/cmd/nsutil
${go_import_path}/cmd/netauthd"
short_desc="Network authentication and identity system"
maintainer="Michael Aldridge <maldridge@netauth.org>"
@@ -15,6 +17,15 @@ distfiles="https://github.com/NetAuth/NetAuth/archive/v$version.tar.gz"
checksum=cf84b2e63b7a59ec6e415ead1a94994b040b30fee2b27e482073371cfb0fb444
post_install() {
+ for sh in bash zsh; do
+ vtargetrun ${DESTDIR}/usr/bin/netauth system cli ${sh} netauth.${sh}
+ vcompletion netauth.${sh} ${sh} netauth
+ done
+ mkdir manpages
+ vtargetrun ${DESTDIR}/usr/bin/netauth system cli man manpages
+ for p in manpages/*; do
+ vman "${p}"
+ done
vlicense LICENSE
vsv netauthd
}
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PR PATCH] [Merged]: NetAuth: add completions and manpages
2022-09-24 22:02 [PR PATCH] NetAuth: add completions and manpages classabbyamp
` (3 preceding siblings ...)
2022-10-19 6:19 ` [PR PATCH] [Updated] " classabbyamp
@ 2022-10-19 15:57 ` classabbyamp
4 siblings, 0 replies; 6+ messages in thread
From: classabbyamp @ 2022-10-19 15:57 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 587 bytes --]
There's a merged pull request on the void-packages repository
NetAuth: add completions and manpages
https://github.com/void-linux/void-packages/pull/39451
Description:
<!-- Uncomment relevant sections and delete options which are not applicable -->
#### Testing the changes
- I tested the changes in this PR: **briefly**
fails locally on cross (but succeeds in ci):
```
Could not get default user: user: unknown userid 1000
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x51b4f8]
```
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-10-19 15:57 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-24 22:02 [PR PATCH] NetAuth: add completions and manpages classabbyamp
2022-10-12 3:18 ` [PR PATCH] [Updated] " classabbyamp
2022-10-19 4:45 ` Vaelatern
2022-10-19 5:55 ` the-maldridge
2022-10-19 6:19 ` [PR PATCH] [Updated] " classabbyamp
2022-10-19 15:57 ` [PR PATCH] [Merged]: " classabbyamp
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).