Skip to content

Commit

Permalink
Be POSIX sh compatible
Browse files Browse the repository at this point in the history
Signed-off-by: Olivier Mehani <olivier.mehani@learnosity.com>
  • Loading branch information
shtrom committed Apr 4, 2018
1 parent e9c729e commit 77f8dbb
Showing 1 changed file with 6 additions and 17 deletions.
23 changes: 6 additions & 17 deletions src/install_host_app.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env bash
#!/usr/bin/env sh

# This script is derived from `install.sh` in Danny van Kooten's "browserpass":
# https://github.com/dannyvankooten/browserpass
Expand All @@ -11,22 +11,11 @@ HOST_URL="https://github.com/passff/passff-host/releases/download/$VERSION/passf
MANIFEST_URL="https://github.com/passff/passff-host/releases/download/$VERSION/passff.json"
KERNEL_NAME=$(uname -s)

PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"

case "$KERNEL_NAME" in
*BSD* | *Darwin*)
IS_BSD=true
;;
*)
IS_BSD=false
;;
esac

# Find target dirs for various browsers & OS'es
# https://developer.chrome.com/extensions/nativeMessaging#native-messaging-host-location
# https://wiki.mozilla.org/WebExtensions/Native_Messaging
if [ "$KERNEL_NAME" == 'Darwin' ]; then
if [ "$(whoami)" == "root" ]; then
if [ "$KERNEL_NAME" = 'Darwin' ]; then
if [ "$(whoami)" = "root" ]; then
TARGET_DIR_CHROME="/Library/Google/Chrome/NativeMessagingHosts"
TARGET_DIR_CHROMIUM="/Library/Application Support/Chromium/NativeMessagingHosts"
TARGET_DIR_FIREFOX="/Library/Application Support/Mozilla/NativeMessagingHosts"
Expand All @@ -38,7 +27,7 @@ if [ "$KERNEL_NAME" == 'Darwin' ]; then
TARGET_DIR_VIVALDI="$HOME/Library/Application Support/Vivaldi/NativeMessagingHosts"
fi
else
if [ "$(whoami)" == "root" ]; then
if [ "$(whoami)" = "root" ]; then
TARGET_DIR_CHROME="/etc/opt/chrome/native-messaging-hosts"
TARGET_DIR_CHROMIUM="/etc/chromium/native-messaging-hosts"
TARGET_DIR_FIREFOX="/usr/lib/mozilla/native-messaging-hosts"
Expand All @@ -51,15 +40,15 @@ else
fi
fi

function usage {
usage() {
echo "Usage: $0 [OPTION] [chrome|chromium|firefox|opera|vivaldi]
Options:
-l, --local Install files from disk instead of downloading them
-h, --help Show this message"
}

while [[ $# -gt 0 ]]; do
while [ $# -gt 0 ]; do
case $1 in
chrome)
BROWSER_NAME="Chrome"
Expand Down

0 comments on commit 77f8dbb

Please sign in to comment.