mirror of
https://github.com/correl/dotfiles.git
synced 2024-12-01 03:00:05 +00:00
41 lines
1.4 KiB
Bash
41 lines
1.4 KiB
Bash
#!/bin/bash
|
|
# Description: A browser plugin for the pass password store
|
|
set -e
|
|
|
|
function _browserpass {
|
|
local browser=$1
|
|
local _prefix=$HOME/.local
|
|
case $_PLATFORM in
|
|
darwin)
|
|
_prefix=/usr/local/opt/browserpass
|
|
;;
|
|
esac
|
|
_run "[browserpass] Installing native messaging host to $browser" \
|
|
make PREFIX=$_prefix hosts-$browser-user \
|
|
-f $_prefix/lib/browserpass/Makefile
|
|
}
|
|
|
|
case $_PLATFORM in
|
|
darwin)
|
|
_recipe brew
|
|
|
|
_brew_tap amar1729/formulae
|
|
_brew browserpass
|
|
|
|
test -e /Applications/Google\ Chrome.app && _browserpass chrome
|
|
test -e /Applications/Firefox.app && _browserpass firefox
|
|
;;
|
|
*)
|
|
if ! test -d ~/.local/lib/browserpass; then
|
|
echo "[curl] Downloading browserpass native"
|
|
local tempdir=$(mktemp -d)
|
|
curl -sL https://github.com/browserpass/browserpass-native/releases/download/3.0.6/browserpass-linux64-3.0.6.tar.gz \
|
|
| tar xz -C "$tempdir" --strip-components=1
|
|
pushd "$tempdir" >/dev/null
|
|
_run "[make] Install browserpass" make PREFIX=$HOME/.local BIN=browserpass-linux64 configure install
|
|
popd >/dev/null
|
|
rm -rf "$tempdir"
|
|
fi
|
|
which google-chrome 2>&1 >/dev/null && _browserpass chrome
|
|
which firefox 2>&1 >/dev/null && _browserpass
|
|
esac
|