commit 1789fea4f14f40c5163ee055f5d3ae7cb19b7b31 parent 82d20c328d53dba5495017b46fefbc00c205d966 Author: earthlng <earthlng@users.noreply.github.com> Date: Sat, 25 Nov 2017 18:58:10 +0100 updater.sh - next attempt ... at fixing the script path detection. should hopefully fix #264 (comment) Diffstat:
| M | updater.sh | | | 11 | +++++++---- |
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/updater.sh b/updater.sh @@ -2,7 +2,7 @@ ### ghacks-user.js updater for Mac/Linux ## author: @overdodactyl -## version: 1.1 +## version: 1.2 ghacksjs="https://raw.githubusercontent.com/ghacksuserjs/ghacks-user.js/master/user.js" @@ -10,11 +10,14 @@ echo -e "\nThis script should be run from your Firefox profile directory.\n" currdir=$(pwd) -## get the full path of this script (greadlink for Mac, readlink for Linux) -scriptfullpath=$(greadlink -f "${BASH_SOURCE[0]}" 2>/dev/null || readlink -f "${BASH_SOURCE[0]}") +## get the full path of this script (readlink for Linux, greadlink for Mac with coreutils installed) +sfp=$(readlink -f "${BASH_SOURCE[0]}" 2>/dev/null || greadlink -f "${BASH_SOURCE[0]}" 2>/dev/null) + +## fallback for Macs without coreutils +if [ -z "$sfp" ]; then sfp=${BASH_SOURCE[0]}; fi ## change directory to the Firefox profile directory -cd "$(dirname "${scriptfullpath}")" +cd "$(dirname "${sfp}")" echo -e "Updating the user.js for Firefox profile:\n$(pwd)\n"