From 4237fcc8471105a2650125b0408a5efed8bce9e3 Mon Sep 17 00:00:00 2001 From: Klesh Wong Date: Thu, 24 Dec 2020 18:02:04 +0800 Subject: [PATCH] [feature] gnu pass for password management --- devel/go.sh | 27 +++++++++++++++++++++++++++ gui/pass.sh | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+) create mode 100755 devel/go.sh create mode 100755 gui/pass.sh diff --git a/devel/go.sh b/devel/go.sh new file mode 100755 index 0000000..010b865 --- /dev/null +++ b/devel/go.sh @@ -0,0 +1,27 @@ +#!/bin/sh + +DIR=$(dirname "$(readlink -f "$0")") +. "$DIR/../env.sh" + +log "Setting up go" +# install go +case "$PM" in + apt) + sudo apt install -y \ + golang + ;; + pacman) + sudo pacman -S --noconfirm --needed \ + go + ;; +esac + +if in_china; then + go env -w GO111MODULE=on + go env -w GOPROXY=https://goproxy.cn,direct +fi + +# coc.nvim +if enhance_vim; then + v -c "CocInstall -sync coc-go|qall" +fi diff --git a/gui/pass.sh b/gui/pass.sh new file mode 100755 index 0000000..de616f2 --- /dev/null +++ b/gui/pass.sh @@ -0,0 +1,47 @@ +#!/bin/sh + +set -e +DIR=$(dirname "$(readlink -f "$0")") +. "$DIR/../env.sh" + +if ! has_cmd go; then + "$PDIR/devel/go.sh" +fi + +# install pass +case "$PM" in + apt) + sudo apt install -y pass pinentry-gtk2 + GNUPG=$HOME/.gnupg + GPG_AGENT_CONF=$GNUPG/gpg-agent.conf + PINENTRY=$(command -v pinentry-gtk-2) + SETTING="pinentry-program $PINENTRY" + mkdir -p "$GNUPG" + if ! grep -Fq "$SETTING" "$GPG_AGENT_CONF"; then + echo "$SETTING" > GPG_AGENT_CONF + fi + ;; + pacman) + # TODO + sudo pacman -S --noconfirm --needed \ + go + ;; +esac + +# install browserpass-native +intorepo https://github.com/browserpass/browserpass-native.git "$DIR/repos/browserpass-native" +make configure +make +sudo make install +exitrepo + +# chrome extension: https://chrome.google.com/webstore/detail/browserpass/naepdomgkenhinolocfifgehidddafch + +# enable browserpass for browsers +cd /usr/lib/browserpass +has_cmd chromium-browser && make hosts-chromium-user +has_cmd firefox && make hosts-firefox-user +has_cmd google-chrome && make hosts-chrome-user +cd - + +# configuration