Skip to content

Instantly share code, notes, and snippets.

@saiarcot895
Created November 4, 2014 13:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save saiarcot895/a80e0fb8725a1844dc34 to your computer and use it in GitHub Desktop.
Save saiarcot895/a80e0fb8725a1844dc34 to your computer and use it in GitHub Desktop.
set -e
DIR="$( cd "$( dirname "$0" )" && pwd )"
TARGET_DIR="$HOME/.config/google-chrome/NativeMessagingHosts"
# If you use Chromium, uncomment the next line, and comment the previous line
# TARGET_DIR="$HOME/.config/chromium/NativeMessagingHosts"
HOST_NAME=com.initiated.chrome_libnotify_notifications
# Create directory to store native messaging host.
mkdir -p $TARGET_DIR
# Copy native messaging host manifest.
cp "$DIR/$HOST_NAME.json" "$TARGET_DIR"
# Update host path in the manifest.
HOST_PATH=$DIR/invoke_notify
ESCAPED_HOST_PATH=${HOST_PATH////\\/}
sed -i -e "s/HOST_PATH/$ESCAPED_HOST_PATH/" $TARGET_DIR/$HOST_NAME.json
# Set permissions for the manifest so that all users can read it.
chmod o+r $TARGET_DIR/$HOST_NAME.json
echo Native messaging host $HOST_NAME has been installed.
@umpirsky
Copy link

umpirsky commented Nov 5, 2014

I am getting:

$ sh ./install-notify.sh 
./install-notify.sh: 18: ./install-notify.sh: Bad substitution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment