Improve macOS installation experience (#44)

This commit is contained in:
Maxim Baz
2019-04-10 20:33:29 +02:00
committed by GitHub
parent d5b5462eab
commit 8fa9a5095b
2 changed files with 48 additions and 31 deletions

View File

@@ -13,6 +13,10 @@ GO_LDFLAGS := "-extldflags ${LDFLAGS}"
APP_ID := com.github.browserpass.native
OS := $(shell uname -s)
# GNU tools
SED := $(shell which gsed 2>/dev/null || which sed 2>/dev/null)
INSTALL := $(shell which ginstall 2>/dev/null || which install 2>/dev/null)
#######################
# For local development
@@ -80,19 +84,19 @@ dist: clean browserpass-linux64 browserpass-darwin64 browserpass-openbsd64 brows
.PHONY: configure
configure:
sed -i "s|%%replace%%|$(BIN_DIR)/$(BIN)|" browser-files/chromium-host.json
sed -i "s|%%replace%%|$(BIN_DIR)/$(BIN)|" browser-files/firefox-host.json
$(SED) -i 's|"path": ".*"|"path": "'"$(BIN_DIR)/$(BIN)"'"|' browser-files/chromium-host.json
$(SED) -i 's|"path": ".*"|"path": "'"$(BIN_DIR)/$(BIN)"'"|' browser-files/firefox-host.json
.PHONY: install
install:
install -Dm755 -t "$(BIN_DIR)/" $(BIN)
install -Dm644 -t "$(LIB_DIR)/browserpass/" Makefile
install -Dm644 -t "$(SHARE_DIR)/licenses/browserpass/" LICENSE
install -Dm644 -t "$(SHARE_DIR)/doc/browserpass/" README.md
$(INSTALL) -Dm755 -t "$(BIN_DIR)/" $(BIN)
$(INSTALL) -Dm644 -t "$(LIB_DIR)/browserpass/" Makefile
$(INSTALL) -Dm644 -t "$(SHARE_DIR)/licenses/browserpass/" LICENSE
$(INSTALL) -Dm644 -t "$(SHARE_DIR)/doc/browserpass/" README.md
install -Dm644 browser-files/chromium-host.json "$(LIB_DIR)/browserpass/hosts/chromium/$(APP_ID).json"
install -Dm644 browser-files/chromium-policy.json "$(LIB_DIR)/browserpass/policies/chromium/$(APP_ID).json"
install -Dm644 browser-files/firefox-host.json "$(LIB_DIR)/browserpass/hosts/firefox/$(APP_ID).json"
$(INSTALL) -Dm644 browser-files/chromium-host.json "$(LIB_DIR)/browserpass/hosts/chromium/$(APP_ID).json"
$(INSTALL) -Dm644 browser-files/chromium-policy.json "$(LIB_DIR)/browserpass/policies/chromium/$(APP_ID).json"
$(INSTALL) -Dm644 browser-files/firefox-host.json "$(LIB_DIR)/browserpass/hosts/firefox/$(APP_ID).json"
# Browser-specific hosts targets
@@ -183,13 +187,13 @@ hosts-vivaldi-user:
.PHONY: hosts-brave
hosts-brave:
@case $(OS) in \
Linux) mkdir -p "/etc/opt/brave/native-messaging-hosts/"; \
ln -sfv "$(LIB_DIR)/browserpass/hosts/chromium/$(APP_ID).json" "/etc/opt/brave/native-messaging-hosts/$(APP_ID).json"; \
[ -e "/etc/opt/brave/native-messaging-hosts/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
Linux) mkdir -p "/etc/opt/chrome/native-messaging-hosts/"; \
ln -sfv "$(LIB_DIR)/browserpass/hosts/chromium/$(APP_ID).json" "/etc/opt/chrome/native-messaging-hosts/$(APP_ID).json"; \
[ -e "/etc/opt/chrome/native-messaging-hosts/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
;; \
Darwin) mkdir -p "/Library/Application Support/BraveSoftware/Brave-Browser/NativeMessagingHosts/"; \
ln -sfv "$(LIB_DIR)/browserpass/hosts/chromium/$(APP_ID).json" "/Library/Application Support/BraveSoftware/Brave-Browser/NativeMessagingHosts/$(APP_ID).json"; \
[ -e "/Library/Application Support/BraveSoftware/Brave-Browser/NativeMessagingHosts/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
Darwin) mkdir -p "/Library/Application Support/Chromium/NativeMessagingHosts/"; \
ln -sfv "$(LIB_DIR)/browserpass/hosts/chromium/$(APP_ID).json" "/Library/Application Support/Chromium/NativeMessagingHosts/$(APP_ID).json"; \
[ -e "/Library/Application Support/Chromium/NativeMessagingHosts/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
;; \
*) echo "The operating system $(OS) is not supported"; exit 1 ;; \
esac
@@ -201,9 +205,9 @@ hosts-brave-user:
ln -sfv "$(LIB_DIR)/browserpass/hosts/chromium/$(APP_ID).json" "${HOME}/.config/BraveSoftware/Brave-Browser/NativeMessagingHosts/$(APP_ID).json"; \
[ -e "${HOME}/.config/BraveSoftware/Brave-Browser/NativeMessagingHosts/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
;; \
Darwin) mkdir -p "${HOME}/Library/Application Support/BraveSoftware/Brave-Browser/NativeMessagingHosts/"; \
ln -sfv "$(LIB_DIR)/browserpass/hosts/chromium/$(APP_ID).json" "${HOME}/Library/Application Support/BraveSoftware/Brave-Browser/NativeMessagingHosts/$(APP_ID).json"; \
[ -e "${HOME}/Library/Application Support/BraveSoftware/Brave-Browser/NativeMessagingHosts/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
Darwin) mkdir -p "${HOME}/Library/Application Support/Google/Chrome/NativeMessagingHosts/"; \
ln -sfv "$(LIB_DIR)/browserpass/hosts/chromium/$(APP_ID).json" "${HOME}/Library/Application Support/Google/Chrome/NativeMessagingHosts/$(APP_ID).json"; \
[ -e "${HOME}/Library/Application Support/Google/Chrome/NativeMessagingHosts/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
;; \
*) echo "The operating system $(OS) is not supported"; exit 1 ;; \
esac
@@ -325,13 +329,13 @@ policies-vivaldi-user:
.PHONY: policies-brave
policies-brave:
@case $(OS) in \
Linux) mkdir -p "/etc/opt/brave/policies/managed/"; \
ln -sfv "$(LIB_DIR)/browserpass/policies/chromium/$(APP_ID).json" "/etc/opt/brave/policies/managed/$(APP_ID).json"; \
[ -e "/etc/opt/brave/policies/managed/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
Linux) mkdir -p "/etc/opt/chrome/policies/managed/"; \
ln -sfv "$(LIB_DIR)/browserpass/policies/chromium/$(APP_ID).json" "/etc/opt/chrome/policies/managed/$(APP_ID).json"; \
[ -e "/etc/opt/chrome/policies/managed/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
;; \
Darwin) mkdir -p "/Library/Application Support/BraveSoftware/Brave-Browser/policies/managed/"; \
ln -sfv "$(LIB_DIR)/browserpass/policies/chromium/$(APP_ID).json" "/Library/Application Support/BraveSoftware/Brave-Browser/policies/managed/$(APP_ID).json"; \
[ -e "/Library/Application Support/BraveSoftware/Brave-Browser/policies/managed/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
Darwin) mkdir -p "/Library/Application Support/Chromium/policies/managed/"; \
ln -sfv "$(LIB_DIR)/browserpass/policies/chromium/$(APP_ID).json" "/Library/Application Support/Chromium/policies/managed/$(APP_ID).json"; \
[ -e "/Library/Application Support/Chromium/policies/managed/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
;; \
*) echo "The operating system $(OS) is not supported"; exit 1 ;; \
esac
@@ -343,9 +347,9 @@ policies-brave-user:
ln -sfv "$(LIB_DIR)/browserpass/policies/chromium/$(APP_ID).json" "${HOME}/.config/BraveSoftware/Brave-Browser/policies/managed/$(APP_ID).json"; \
[ -e "${HOME}/.config/BraveSoftware/Brave-Browser/policies/managed/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
;; \
Darwin) mkdir -p "${HOME}/Library/Application Support/BraveSoftware/Brave-Browser/policies/managed/"; \
ln -sfv "$(LIB_DIR)/browserpass/policies/chromium/$(APP_ID).json" "${HOME}/Library/Application Support/BraveSoftware/Brave-Browser/policies/managed/$(APP_ID).json"; \
[ -e "${HOME}/Library/Application Support/BraveSoftware/Brave-Browser/policies/managed/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
Darwin) mkdir -p "${HOME}/Library/Application Support/Google/Chrome/policies/managed/"; \
ln -sfv "$(LIB_DIR)/browserpass/policies/chromium/$(APP_ID).json" "${HOME}/Library/Application Support/Google/Chrome/policies/managed/$(APP_ID).json"; \
[ -e "${HOME}/Library/Application Support/Google/Chrome/policies/managed/$(APP_ID).json" ] || echo "Error: the symlink points to a non-existent location" >&2; \
;; \
*) echo "The operating system $(OS) is not supported"; exit 1 ;; \
esac

View File

@@ -54,6 +54,8 @@ Primary key fingerprint: EB4F 9E5A 60D3 2232 BB52 150C 12C8 7A28 FEAC 6B20
Unpack the archive. If you decided to compile the application yourself, refer to the [Building the app](#building-the-app) section on how to do so. Once complete, continue with the steps below.
If you are on macOS, first install the necessary tools: `brew install coreutils gnu-sed`.
If you downloaded a release archive with pre-compiled binary, follow these steps to install the app:
```
@@ -62,6 +64,15 @@ make BIN=browserpass-XXXX configure # Configure the hosts json files
sudo make BIN=browserpass-XXXX install # Install the app
```
In addition, both `configure` and `install` targets respect `PREFIX`, `DESTDIR` parameters if you want to customize the install location (e.g. to install to a `$HOME` dir to avoid using `sudo`).
For example, if you are on macOS, you probably want to install Browserpass in `/usr/local/bin`, therefore you need to run:
```
make BIN=browserpass-darwin64 PREFIX=/usr/local configure # Configure the hosts json files
sudo make BIN=browserpass-darwin64 PREFIX=/usr/local install # Install the app
```
If you compiled the app yourself, you can omit `BIN` parameter:
```
@@ -69,8 +80,6 @@ make configure # Configure the hosts json files
sudo make install # Install the app
```
In addition, both `configure` and `install` targets respect `PREFIX`, `DESTDIR` parameters if you want to customize the install location (e.g. to install to a `$HOME` dir to avoid using `sudo`).
Finally proceed to the [Configure browsers](#configure-browsers) section.
#### Install on Nix / NixOS
@@ -125,13 +134,17 @@ Remember to check [Hints for configuring gpg](#hints-for-configuring-gpg) on how
The following operating systems provide packages for certain browsers that can be installed using a package manager:
- Arch Linux: [browserpass-chromium](https://www.archlinux.org/packages/community/any/browserpass-chromium/) and [browserpass-firefox](https://www.archlinux.org/packages/community/any/browserpass-firefox/)
- Available since Saturday, 13 April: ~Arch Linux: [browserpass-chromium](https://www.archlinux.org/packages/community/any/browserpass-chromium/) and [browserpass-firefox](https://www.archlinux.org/packages/community/any/browserpass-firefox/)~
If you installed a distro package above, you are done!
If something went wrong, or if there's no package for your OS and/or a browser of your choice, proceed with the steps below.
The Makefile (which is also available in `/usr/lib/browserpass/`, if you installed via package manager) contains the following `make` goals to configure the browsers you use:
First, enter the directory with installed Browserpass, by default it is `/usr/lib/browserpass/`, but if you used `PREFIX` or `DESTDIR` when running `make install`, it might be different for you. For example, on macOS the directory is likely to be `/usr/local/lib/browserpass/`.
See below the list of available `make` goals to configure various browsers.
If you provided `PREFIX` and/or `DESTDIR` while running `make install`, remember that you must provide the same parameters, for example `sudo make PREFIX=/usr/local hosts-chromium`:
| Command | Description |
| -------------------------- | -------------------------------------------------------------------------- |