From 2c1e4ae542f76ce47f22422fbcd75078502d222d Mon Sep 17 00:00:00 2001 From: earthlng Date: Sat, 25 Nov 2017 14:31:17 +0100 Subject: [PATCH 1/3] updater.sh - next attempt ... at fixing the script path detection. should hopefully fix https://github.com/ghacksuserjs/ghacks-user.js/issues/264#issuecomment-346891526 --- updater.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/updater.sh b/updater.sh index ca8ee93..d8709dc 100644 --- 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,8 +10,8 @@ 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) +scriptfullpath=$(readlink -f "${BASH_SOURCE[0]}" 2>/dev/null || "${BASH_SOURCE[0]}") ## change directory to the Firefox profile directory cd "$(dirname "${scriptfullpath}")" From 41a55ad5f2a4e29a36754d7d35588e30cb52a85e Mon Sep 17 00:00:00 2001 From: earthlng Date: Sat, 25 Nov 2017 14:37:25 +0100 Subject: [PATCH 2/3] Update updater.sh --- updater.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/updater.sh b/updater.sh index d8709dc..9b32157 100644 --- a/updater.sh +++ b/updater.sh @@ -10,8 +10,8 @@ echo -e "\nThis script should be run from your Firefox profile directory.\n" currdir=$(pwd) -## get the full path of this script (readlink for Linux) -scriptfullpath=$(readlink -f "${BASH_SOURCE[0]}" 2>/dev/null || "${BASH_SOURCE[0]}") +## get the full path of this script (readlink for Linux, greadlink for Mac with coreutils installed, fallback otherwise) +scriptfullpath=$(readlink -f "${BASH_SOURCE[0]}" 2>/dev/null || greadlink -f "${BASH_SOURCE[0]}" 2>/dev/null || "${BASH_SOURCE[0]}") ## change directory to the Firefox profile directory cd "$(dirname "${scriptfullpath}")" From 679ca592334e2e50247b9a8c50083d790ec6682b Mon Sep 17 00:00:00 2001 From: earthlng Date: Sat, 25 Nov 2017 18:56:49 +0100 Subject: [PATCH 3/3] Update updater.sh --- updater.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/updater.sh b/updater.sh index 9b32157..d9548ea 100644 --- a/updater.sh +++ b/updater.sh @@ -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 (readlink for Linux, greadlink for Mac with coreutils installed, fallback otherwise) -scriptfullpath=$(readlink -f "${BASH_SOURCE[0]}" 2>/dev/null || greadlink -f "${BASH_SOURCE[0]}" 2>/dev/null || "${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"