2020-12-24 10:02:04 +00:00
|
|
|
#!/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"
|
2022-05-03 15:20:26 +00:00
|
|
|
chmod 700 "$GNUPG"
|
2020-12-24 10:02:04 +00:00
|
|
|
|
|
|
|
# install pass
|
|
|
|
case "$PM" in
|
|
|
|
apt)
|
2021-10-05 15:32:57 +00:00
|
|
|
sudo apt install -y pass
|
2021-08-03 03:51:50 +00:00
|
|
|
if [ -n "$WSL" ]; then
|
|
|
|
PINENTRY=$PDIR/bin/pinentry-wsl-ps1.sh
|
2022-05-29 16:00:30 +00:00
|
|
|
BROWSERPASS_NATIVE="$(wsl-win-path.sh %USERPROFILE%)/browserpass-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
|
2020-12-24 10:02:04 +00:00
|
|
|
;;
|
|
|
|
pacman)
|
|
|
|
sudo pacman -S --noconfirm --needed \
|
2021-08-26 13:13:36 +00:00
|
|
|
go \
|
2022-05-15 03:34:22 +00:00
|
|
|
browserpass pass pinentry
|
2022-05-03 15:20:26 +00:00
|
|
|
PINENTRY=$(command -v pinentry-qt)
|
|
|
|
;;
|
|
|
|
xbps)
|
|
|
|
sudo xbps-install -y go browserpass pass pinentry
|
|
|
|
PINENTRY=$(command -v pinentry-qt)
|
2020-12-24 10:02:04 +00:00
|
|
|
;;
|
|
|
|
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
|
2022-05-03 15:20:26 +00:00
|
|
|
pinentry-program $PINENTRY
|
2022-12-19 08:41:58 +00:00
|
|
|
default-cache-ttl 43200
|
|
|
|
max-cache-ttl 43200
|
2021-08-26 13:13:36 +00:00
|
|
|
EOF
|
|
|
|
|
2021-10-05 15:32:57 +00:00
|
|
|
|
|
|
|
# install browserpass-native
|
2021-11-10 13:00:57 +00:00
|
|
|
intorepo https://github.com/browserpass/browserpass-native.git "$DIR/repos/browserpass-native"
|
|
|
|
make configure
|
|
|
|
make
|
|
|
|
sudo make install
|
|
|
|
exitrepo
|
2021-10-05 15:32:57 +00:00
|
|
|
|
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
|
|
|
|
2020-12-24 10:02:04 +00:00
|
|
|
|
|
|
|
# chrome extension: https://chrome.google.com/webstore/detail/browserpass/naepdomgkenhinolocfifgehidddafch
|
|
|
|
|
|
|
|
# enable browserpass for browsers
|
2022-05-15 03:34:22 +00:00
|
|
|
if [ -d /usr/lib/browserpass ]; then
|
2021-11-10 13:00:57 +00:00
|
|
|
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 -
|
|
|
|
fi
|
2020-12-24 10:02:04 +00:00
|
|
|
|
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/)
|
|
|
|
|
2020-12-24 10:02:04 +00:00
|
|
|
# configuration
|
2021-08-03 03:51:50 +00:00
|
|
|
|
|
|
|
if [ -n "$WSL" ]; then
|
2022-05-29 16:00:30 +00:00
|
|
|
echo 'Please update path in files "C:\Program Files\Browserpass\*-host.json" to'
|
|
|
|
cmd.exe /c 'echo %USERPROFILE%\browserpass-wsl.bat' 2>/dev/null | sed 's/\\/\\\\/g'
|
2021-08-03 03:51:50 +00:00
|
|
|
fi
|