2019-04-16 14:28:17 +00:00
|
|
|
#!/bin/bash
|
|
|
|
# Description: A browser plugin for the pass password store
|
|
|
|
set -e
|
|
|
|
|
|
|
|
function _browserpass {
|
|
|
|
local browser=$1
|
2019-08-20 14:55:41 +00:00
|
|
|
local _prefix=$HOME/.local
|
2019-04-16 14:28:17 +00:00
|
|
|
case $_PLATFORM in
|
|
|
|
darwin)
|
|
|
|
_prefix=/usr/local/opt/browserpass
|
|
|
|
;;
|
2021-12-24 23:35:06 +00:00
|
|
|
arch)
|
|
|
|
_prefix=/usr
|
|
|
|
;;
|
2019-04-16 14:28:17 +00:00
|
|
|
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
|
|
|
|
;;
|
2021-02-05 00:05:51 +00:00
|
|
|
arch)
|
|
|
|
_recipe _arch
|
2021-12-24 23:35:06 +00:00
|
|
|
if command -v chromium 2>&1 >/dev/null \
|
|
|
|
|| command -v google-chrome 2>&1 >/dev/null \
|
|
|
|
|| command -v google-chrome-stable 2>&1 >/dev/null; then
|
|
|
|
_pacman browserpass-chromium
|
|
|
|
fi
|
|
|
|
if command -v firefox 2>&1 >/dev/null \
|
|
|
|
|| command -v firedragon 2>&1 >/dev/null; then
|
|
|
|
_pacman browserpass-firefox
|
|
|
|
fi
|
|
|
|
if command -v google-chrome 2>&1 >/dev/null \
|
|
|
|
|| command -v google-chrome-stable 2>&1 >/dev/null; then
|
|
|
|
_browserpass chrome
|
|
|
|
fi
|
2021-02-05 00:05:51 +00:00
|
|
|
;;
|
2019-08-20 14:55:41 +00:00
|
|
|
*)
|
|
|
|
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
|
2021-12-24 23:35:06 +00:00
|
|
|
command -v google-chrome 2>&1 >/dev/null && _browserpass chrome
|
|
|
|
command -v firefox 2>&1 >/dev/null && _browserpass
|
2019-04-16 14:28:17 +00:00
|
|
|
esac
|