Skip to content

Commit

Permalink
making templates and build them instead of having fixed variables (re…
Browse files Browse the repository at this point in the history
…fres #3)
  • Loading branch information
LeoIannacone committed Nov 8, 2014
1 parent 7795d9e commit a3b8992
Show file tree
Hide file tree
Showing 7 changed files with 67 additions and 74 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
*.pyc
app/goopg-web-extension-id.js
app/lib/css/goopg-bootstrap.css
app/lib/fonts/
26 changes: 6 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,32 +35,18 @@ make
cd -
```

# Install in Chrome #
# Install the extension in Chrome/Chromium #
* Open [chrome://extensions](chrome://extensions) in the browser
* Click on "Developer mode"
* Then click on "Load unpackage extension" and select the dir `app`

# Update the app ID #
Once extension is installed, get the `NEW_ID` extension in chrome://extension and run:
# Update the app ID and install the host #
Once extension is installed, get the `NEW_ID` extension in chrome://extension and run the following commmands:
```bash
cd templates
NEW_ID=the_id_you_found
OLD_ID=ppopiamobkilibbniemlecehjmbfbjjp
sed s/$OLD_ID/$NEW_ID/ -i app/goopg-web-extension-id.js host/com.leoiannacone.goopg.json
```

# Install the host

If you use chromium:
```bash
cd host
bash install.sh
cd -
```

If you use chrome:
```bash
cd host
bash install.sh google-chrome
BROWSER=your_browser # (chrome or chromium)
bash build.sh $NEW_ID $BROWSER
cd -
```

Expand Down
File renamed without changes.
51 changes: 0 additions & 51 deletions host/install.sh

This file was deleted.

57 changes: 57 additions & 0 deletions templates/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#!/bin/sh
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

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"
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "com.leoiannacone.goopg",
"description": "GPG wrapper",
"path": "HOST_PATH",
"path": "@HOST_PATH@",
"type": "stdio",
"allowed_origins": [
"chrome-extension://ppopiamobkilibbniemlecehjmbfbjjp/"
"chrome-extension://@EXT_ID@/"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
// out of the main file, so people can git-pull without
// having conflicts with their own EXTENSION_ID

var GOOPG_EXTENSION_ID = "ppopiamobkilibbniemlecehjmbfbjjp";
var GOOPG_EXTENSION_ID = "@EXT_ID@";

0 comments on commit a3b8992

Please sign in to comment.