mirror of
https://github.com/correl/dotfiles.git
synced 2024-11-25 11:09:52 +00:00
46 lines
1.5 KiB
Bash
46 lines
1.5 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
|
|
;;
|
|
arch)
|
|
_recipe _arch
|
|
which chromium 2>&1 >/dev/null && _pacman browserpass-chromium
|
|
which firefox 2>&1 >/dev/null && _pacman 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
|