Bump: github.com/rwinkhart/libmutton PRE-TAG => v0.2.1; add script for generating release binaries

This commit is contained in:
2024-08-13 21:46:14 -04:00
parent b68b2a8931
commit 9cc4965ed8
10 changed files with 35 additions and 19 deletions
+3 -3
View File
@@ -24,9 +24,9 @@ After installing, please review the [usage guide](https://github.com/rwinkhart/M
# Roadmap # Roadmap
#### Release v0.2.1 #### Release v0.2.1
- [ ] libmutton v0.2.1 - [x] libmutton v0.2.1
- [ ] Only run getSSHClient once to prevent being asked for keyfile password multiple times - [x] Only run getSSHClient once to prevent being asked for keyfile password multiple times
- [ ] Ensure all config files and entry files are created with 0600 permissions - [x] Ensure all config files and entry files are created with 0600 permissions
- [x] Add fail-specific error codes - [x] Add fail-specific error codes
- [x] Document in man page - [x] Document in man page
- [x] Split into separate repos - [x] Split into separate repos
+2 -2
View File
@@ -4,7 +4,7 @@ go 1.22.6
require ( require (
github.com/charmbracelet/glamour v0.7.0 github.com/charmbracelet/glamour v0.7.0
github.com/rwinkhart/libmutton v0.0.0-20240808213918-f5e5cd31bb85 github.com/rwinkhart/libmutton v0.2.1
golang.org/x/term v0.23.0 golang.org/x/term v0.23.0
) )
@@ -32,6 +32,6 @@ require (
github.com/yuin/goldmark-emoji v1.0.3 // indirect github.com/yuin/goldmark-emoji v1.0.3 // indirect
golang.org/x/crypto v0.26.0 // indirect golang.org/x/crypto v0.26.0 // indirect
golang.org/x/net v0.28.0 // indirect golang.org/x/net v0.28.0 // indirect
golang.org/x/sys v0.23.0 // indirect golang.org/x/sys v0.24.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect
) )
+4 -4
View File
@@ -52,8 +52,8 @@ github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJ
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=
github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
github.com/rwinkhart/libmutton v0.0.0-20240808213918-f5e5cd31bb85 h1:j3Xj6ZVJGwqCM6UHhCiX0WlnoSlDMjM9ZbAylhko65g= github.com/rwinkhart/libmutton v0.2.1 h1:J6tRCOJ22D3r0At7c1PnU5eHQkxxtrtue5b5lu/90Qw=
github.com/rwinkhart/libmutton v0.0.0-20240808213918-f5e5cd31bb85/go.mod h1:treJ/J2D6+LuDQQ435Jg3fsXRHlBnoKlMYExo3VzUKc= github.com/rwinkhart/libmutton v0.2.1/go.mod h1:W4xYquN2Hz5rNyaaIUZCMTLvTNcAx804f1Y4vaUBmiw=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
@@ -88,8 +88,8 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.23.0 h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM= golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg=
golang.org/x/sys v0.23.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
+6 -2
View File
@@ -18,11 +18,15 @@ fi
mkdir -p ./1output mkdir -p ./1output
case "$1" in case "$1" in
release-binaries)
. ./resources/release-binaries.sh
create_release_binaries
;;
pkgbuild-git-stable) pkgbuild-git-stable)
. ./pkgbuild-git-stable.sh . ./resources/pkgbuild-git-stable.sh
create_pkgbuild_git_stable create_pkgbuild_git_stable
;; ;;
*) *)
printf '\nusage: package.sh [target] <revision>\n\ntargets: pkgbuild-git-stable\n\n' printf '\nusage: package.sh [target] <revision>\n\ntargets: release-binaries pkgbuild-git-stable\n\n'
;; ;;
esac esac
@@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
create_pkgbuild_git_stable() { create_pkgbuild_git_stable() {
printf '\ngenerating PKGBUILD...\n' printf '\nGenerating PKGBUILD...\n'
local source="git+https://github.com/rwinkhart/MUTN.git#tag=v\${pkgver}" local source="git+https://github.com/rwinkhart/MUTN.git#tag=v\${pkgver}"
printf "# Maintainer: Randall Winkhart <idgr at tutanota dot com> printf "# Maintainer: Randall Winkhart <idgr at tutanota dot com>
pkgname=mutn pkgname=mutn
+11
View File
@@ -0,0 +1,11 @@
#!/bin/sh
create_release_binaries() {
printf '\nGenerating release binaries...\n'
cd ..
GOOS=linux CGO_ENABLED=0 GOAMD64=v1 go build -o ./packaging/1output/mutn-linux-x86_64_v1 -ldflags="-s -w" -trimpath ./mutn.go
GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build -o ./packaging/1output/mutn-linux-aarch64 -ldflags="-s -w" -trimpath ./mutn.go
GOOS=windows CGO_ENABLED=0 GOAMD64=v1 go build -o ./packaging/1output/mutn-windows-x86_64_v1.exe -ldflags="-s -w" -trimpath ./mutn.go
GOOS=windows GOARCH=arm64 CGO_ENABLED=0 go build -o ./packaging/1output/mutn-windows-aarch64.exe -ldflags="-s -w" -trimpath ./mutn.go
cd ./packaging
}
+2 -1
View File
@@ -11,7 +11,8 @@ var (
) )
const ( const (
MUTNVersion = "0.2.B" // untagged releases feature a letter suffix corresponding to the eventual release version, e.g "0.2.A" -> "0.2.0", "0.2.B" -> "0.2.1"
AnsiBold = "\033[1m" AnsiBold = "\033[1m"
ansiBlackOnWhite = "\033[38;5;0;48;5;15m" ansiBlackOnWhite = "\033[38;5;0;48;5;15m"
MUTNVersion = "0.2.B" // untagged releases feature a letter suffix corresponding to the eventual release version, e.g "0.2.A" -> "0.2.0", "0.2.B" -> "0.2.1"
) )
+1 -1
View File
@@ -15,7 +15,7 @@ func AddEntry(targetLocation string, hideSecrets bool, entryType uint8) {
_, isAccessible := core.TargetIsFile(targetLocation, false, 0) _, isAccessible := core.TargetIsFile(targetLocation, false, 0)
if isAccessible { if isAccessible {
fmt.Println(core.AnsiError + "Target location already exists" + core.AnsiReset) fmt.Println(core.AnsiError + "Target location already exists" + core.AnsiReset)
os.Exit(106) os.Exit(core.ErrorTargetExists)
} }
// ensure target containing directory exists and is a directory (not a file) // ensure target containing directory exists and is a directory (not a file)
+4 -4
View File
@@ -22,7 +22,7 @@ func TempInitCli() {
gpgIDInt := inputMenuGen("Select GPG key:", uidSlice) gpgIDInt := inputMenuGen("Select GPG key:", uidSlice)
if gpgIDInt == 0 { if gpgIDInt == 0 {
fmt.Println(core.AnsiError + "No GPG keys found - please generate one" + core.AnsiReset) fmt.Println(core.AnsiError + "No GPG keys found - please generate one" + core.AnsiReset)
os.Exit(105) os.Exit(core.ErrorTargetNotFound)
} }
gpgID = uidSlice[gpgIDInt-1] gpgID = uidSlice[gpgIDInt-1]
} }
@@ -54,13 +54,13 @@ func TempInitCli() {
sshKeyProtected := inputBinary("Is the identity file password-protected?") sshKeyProtected := inputBinary("Is the identity file password-protected?")
// initialize libmutton directories // initialize libmutton directories
core.DirInit(false) oldDeviceID := core.DirInit(false)
// write config file (temporarily assigns sshEntryRoot and sshIsWindows to null to pass initial device ID registration) // write config file (temporarily assigns sshEntryRoot and sshIsWindows to null to pass initial device ID registration)
core.WriteConfig([][3]string{{"MUTN", "textEditor", textEditor}, {"LIBMUTTON", "gpgID", gpgID}, {"LIBMUTTON", "sshUser", sshUser}, {"LIBMUTTON", "sshIP", sshIP}, {"LIBMUTTON", "sshPort", sshPort}, {"LIBMUTTON", "sshKey", sshKey}, {"LIBMUTTON", "sshKeyProtected", strconv.FormatBool(sshKeyProtected)}, {"LIBMUTTON", "sshEntryRoot", "null"}, {"LIBMUTTON", "sshIsWindows", "null"}}, false) core.WriteConfig([][3]string{{"MUTN", "textEditor", textEditor}, {"LIBMUTTON", "gpgID", gpgID}, {"LIBMUTTON", "sshUser", sshUser}, {"LIBMUTTON", "sshIP", sshIP}, {"LIBMUTTON", "sshPort", sshPort}, {"LIBMUTTON", "sshKey", sshKey}, {"LIBMUTTON", "sshKeyProtected", strconv.FormatBool(sshKeyProtected)}, {"LIBMUTTON", "sshEntryRoot", "null"}, {"LIBMUTTON", "sshIsWindows", "false"}}, false)
// generate and register device ID // generate and register device ID
sshEntryRoot, sshIsWindows := sync.DeviceIDGen() sshEntryRoot, sshIsWindows := sync.DeviceIDGen(oldDeviceID)
// update config file with sshEntryRoot and sshIsWindows // update config file with sshEntryRoot and sshIsWindows
core.WriteConfig([][3]string{{"LIBMUTTON", "sshEntryRoot", sshEntryRoot}, {"LIBMUTTON", "sshIsWindows", sshIsWindows}}, true) core.WriteConfig([][3]string{{"LIBMUTTON", "sshEntryRoot", sshEntryRoot}, {"LIBMUTTON", "sshIsWindows", sshIsWindows}}, true)
+1 -1
View File
@@ -74,7 +74,7 @@ func writeEntryCLI(targetLocation string, unencryptedEntry []string, hideSecrets
EntryReader(unencryptedEntry, hideSecrets, true) EntryReader(unencryptedEntry, hideSecrets, true)
} else { } else {
fmt.Println(core.AnsiError + "No data supplied for entry" + core.AnsiReset) fmt.Println(core.AnsiError + "No data supplied for entry" + core.AnsiReset)
os.Exit(105) os.Exit(core.ErrorTargetNotFound)
} }
} }