dotfiles/gui/pass.sh

72 lines
1.9 KiB
Bash
Raw Normal View History

#!/bin/sh
set -e
DIR=$(dirname "$(readlink -f "$0")")
. "$DIR/../env.sh"
if ! has_cmd go; then
"$PDIR/devel/go.sh"
fi
2021-10-05 15:29:10 +00:00
GNUPG=$HOME/.gnupg
GPG_AGENT_CONF=$GNUPG/gpg-agent.conf
mkdir -p "$GNUPG"
# install pass
case "$PM" in
apt)
2021-10-05 15:29:10 +00:00
sudo apt install -y pass webext-browserpass
2021-08-03 03:51:50 +00:00
if [ -n "$WSL" ]; then
PINENTRY=$PDIR/bin/pinentry-wsl-ps1.sh
2021-10-05 15:29:10 +00:00
BROWSERPASS_NATIVE="$(wsl-win-path.sh %USERPROFILE%)/browser-wsl.bat"
2021-08-03 03:51:50 +00:00
echo "@echo off\r\nbash -c 'browserpass'" \
> "$BROWSERPASS_NATIVE"
else
sudo apt install -y pinentry-gtk2
PINENTRY=$(command -v pinentry-gtk-2)
fi
SETTING="pinentry-program $PINENTRY"
;;
pacman)
sudo pacman -S --noconfirm --needed \
2021-08-26 13:13:36 +00:00
go \
browserpass
2021-10-05 15:29:10 +00:00
# install browserpass-native
intorepo https://github.com/browserpass/browserpass-native.git "$DIR/repos/browserpass-native"
make configure
make
sudo make install
exitrepo
;;
esac
2021-08-26 13:13:36 +00:00
# longer password caching time
2021-08-27 03:30:50 +00:00
cat <<EOF > ~/.gnupg/gpg-agent.conf
2021-10-05 15:29:10 +00:00
$SETTING
2021-08-26 13:13:36 +00:00
default-cache-ttl 28800
max-cache-ttl 28800
EOF
2021-08-27 03:30:50 +00:00
# enable browser-native for google-chrome
2021-10-05 15:29:10 +00:00
#make -C /usr/lib/browserpass hosts-chrome-user
2021-08-27 03:30:50 +00:00
# chrome extension: https://chrome.google.com/webstore/detail/browserpass/naepdomgkenhinolocfifgehidddafch
# enable browserpass for browsers
cd /usr/lib/browserpass
has_cmd chromium && make hosts-chromium-user
has_cmd firefox && make hosts-firefox-user
has_cmd google-chrome && make hosts-chrome-user
cd -
2020-12-27 06:37:37 +00:00
# android
# [OpenKeyChain - encryption/decryption](https://f-droid.org/packages/org.sufficientlysecure.keychain/)
# [PasswordStore - sync / ui](https://f-droid.org/packages/dev.msfjarvis.aps/)
# configuration
2021-08-03 03:51:50 +00:00
if [ -n "$WSL" ]; then
echo "Please update path in *-host.json file located at C:\Program Files\Browserpass to"
echo $BROWSERPASS_NATIVE
fi