Windows support (fixed #217)

* Swap out gopass dependency

Remove github.com/mewbak/gopass in favor of github.com/howeyc/gopass

* Add Windows to Makefile and build_release

Added Windows/386 and Windows/amd64 to the Makefile.  Some minor changes
needed to be made to build_release to give the windows binary the ".exe"
extension.

* Makefile: remove windows/amd64
This commit is contained in:
Nick Scheibenpflug 2016-09-15 13:52:55 -04:00 committed by Andrey Petrov
parent 3535fb35bb
commit 55c1def24d
6 changed files with 17 additions and 11 deletions

7
.gitmodules vendored
View File

@ -6,10 +6,6 @@
path = vendor/github.com/jessevdk/go-flags
url = https://github.com/jessevdk/go-flags
branch = master
[submodule "vendor/github.com/mewbak/gopass"]
path = vendor/github.com/mewbak/gopass
url = https://github.com/mewbak/gopass
branch = master
[submodule "vendor/github.com/shazow/rateio"]
path = vendor/github.com/shazow/rateio
url = https://github.com/shazow/rateio
@ -18,3 +14,6 @@
path = vendor/github.com/dustin/go-humanize
url = https://github.com/dustin/go-humanize
branch = master
[submodule "vendor/github.com/howeyc/gopass"]
path = vendor/github.com/howeyc/gopass
url = https://github.com/howeyc/gopass.git

View File

@ -39,3 +39,4 @@ release:
GOOS=linux GOARCH=386 $(LDFLAGS) ./build_release "github.com/shazow/ssh-chat/cmd/ssh-chat" README.md LICENSE
GOOS=darwin GOARCH=amd64 $(LDFLAGS) ./build_release "github.com/shazow/ssh-chat/cmd/ssh-chat" README.md LICENSE
GOOS=freebsd GOARCH=amd64 $(LDFLAGS) ./build_release "github.com/shazow/ssh-chat/cmd/ssh-chat" README.md LICENSE
GOOS=windows GOARCH=386 $(LDFLAGS) ./build_release "github.com/shazow/ssh-chat/cmd/ssh-chat" README.md LICENSE

View File

@ -37,6 +37,11 @@ build() {
local bin="$(basename $package)"
local tarball="${bin}-${GOOS}_${GOARCH}.tgz"
local outdir="$BUILDDIR/$bin"
local tardir="$bin"
if [ "$GOOS" == "windows" ]; then
bin="$bin.exe"
fi
if [[ -d "$outdir" ]]; then
echo "err: outdir already exists: $PWD/$outdir"
@ -51,7 +56,7 @@ build() {
fi
# Create tarball
tar -C "$BUILDDIR" -czvf "$BUILDDIR/$tarball" "$bin"
tar -C "$BUILDDIR" -czvf "$BUILDDIR/$tarball" "$tardir"
# Cleanup
rm -rf "$outdir"

View File

@ -7,7 +7,7 @@ import (
"io/ioutil"
"os"
"github.com/mewbak/gopass"
"github.com/howeyc/gopass"
)
// ReadPrivateKey attempts to read your private key and possibly decrypt it if it
@ -28,14 +28,15 @@ func ReadPrivateKey(path string) ([]byte, error) {
return privateKey, nil
}
passphrase := os.Getenv("IDENTITY_PASSPHRASE")
if passphrase == "" {
passphrase, err = gopass.GetPass("Enter passphrase: ")
passphrase := []byte(os.Getenv("IDENTITY_PASSPHRASE"))
if len(passphrase) == 0 {
fmt.Print("Enter passphrase: ")
passphrase, err = gopass.GetPasswd()
if err != nil {
return nil, fmt.Errorf("couldn't read passphrase: %v", err)
}
}
der, err := x509.DecryptPEMBlock(block, []byte(passphrase))
der, err := x509.DecryptPEMBlock(block, passphrase)
if err != nil {
return nil, fmt.Errorf("decrypt failed: %v", err)
}

1
vendor/github.com/howeyc/gopass generated vendored Submodule

@ -0,0 +1 @@
Subproject commit 26c6e1184fd5255fa5f5289d0b789a4819c203a4

1
vendor/github.com/mewbak/gopass generated vendored

@ -1 +0,0 @@
Subproject commit fa08fb4d03e3a626c172af829a5029727baf9222