From deeb06dc6d3177cbe76e4594c324f9b24816e237 Mon Sep 17 00:00:00 2001 From: moarbytes Date: Wed, 30 Oct 2019 11:49:08 -0500 Subject: [PATCH 1/2] Create build-mac.sh Changed instances of sed -i to sed -i '' so it will work on MacOS and other systems with BSD sed. --- templates/build-mac.sh | 53 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 templates/build-mac.sh diff --git a/templates/build-mac.sh b/templates/build-mac.sh new file mode 100644 index 0000000..a313881 --- /dev/null +++ b/templates/build-mac.sh @@ -0,0 +1,53 @@ +#!/bin/bash + +set -e + +usage() { + echo "usage: ${0##*/} extension_id [chromium|google-chrome]" + exit 1 +} + +EXT_ID=$1 +BROWSER=$2 + +DIR="$( cd "$( dirname "$0" )" && pwd )" + +if [ "$BROWSER" = "" ] ; then + BROWSER="chromium" +fi + +if [ "$BROWSER" != "chromium" -a "$BROWSER" != "google-chrome" ] ; then + usage +fi + +if [ "$EXT_ID" = "" ]; then + usage +fi + +if [ "$TARGET_DIR" = "" ] ; then + TARGET_DIR="$HOME/.config/$BROWSER/NativeMessagingHosts" +fi + +if [ "$HOST_PATH" = "" ] ; then + HOST_PATH=$(realpath "$DIR/../host") +fi + +# Create directory to store native messaging host. +mkdir -p "$TARGET_DIR" + +# Copy native messaging host manifest. +JSON="com.leoiannacone.goopg.json" +cp "$DIR/$JSON.in" "$TARGET_DIR/$JSON" + +# Update host path in the manifest. +HOST_PATH="$HOST_PATH/chrome-main.py" +sed -i '' "s|@HOST_PATH@|$HOST_PATH|" "$TARGET_DIR/$JSON" +sed -i '' "s|@EXT_ID@|$EXT_ID|" "$TARGET_DIR/$JSON" + +# Set permissions for the manifest so that all users can read it. +chmod o+r "$TARGET_DIR/$JSON" + +echo Native messaging host $JSON has been installed. "$TARGET_DIR/$JSON" +# make the goopg-web-extension-id +JS=goopg-web-extension-id.js +sed "s|@EXT_ID@|$EXT_ID|" "$DIR/$JS.in" > "$DIR/../app/$JS" From ae18d15780a9156fd8f406740c443dfcb07923af Mon Sep 17 00:00:00 2001 From: moarbytes Date: Wed, 30 Oct 2019 11:57:09 -0500 Subject: [PATCH 2/2] Update mac-install.md Added pointer to install coreutils via homebrew (realpath) and edited the build.sh step to reference build-mac.sh --- doc/mac-install.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/doc/mac-install.md b/doc/mac-install.md index f41e826..171faf7 100644 --- a/doc/mac-install.md +++ b/doc/mac-install.md @@ -10,15 +10,19 @@ What you have to do to get it properly installed is: ``` python-googleapi python-gflags python-xdg python-gnupg ``` +3. Install coreutils via homebrew (provides `realpath`) +``` +brew install coreutils +``` -3. Clone this repository: +4. Clone this repository: ``` git clone https://github.com/LeoIannacone/goopg/ ``` Save it somewhere because you will need this files and you cannot remove them. -4. Then install the plugin using this command in the goopg directory: +5. Then install the plugin using this command in the goopg directory: ``` export TARGET_DIR=~/NativeMessagingHosts - bash templates/build.sh ifpoaednafmgolabhpjmbimllaoidelg chrome + bash templates/build-mac.sh ifpoaednafmgolabhpjmbimllaoidelg chrome ```