fix for profile detection
this should now work no matter how the script is called (including symlinks) on both Mac and Linux. + Storing and restoring the original working directory to prevent problems in certain circumstances.
This commit is contained in:
parent
7ae034a23c
commit
500c129d48
17
updater.sh
17
updater.sh
@ -2,14 +2,22 @@
|
||||
|
||||
### ghacks-user.js updater for Mac/Linux
|
||||
## author: @overdodactyl
|
||||
## version: 1.0
|
||||
## version: 1.1
|
||||
|
||||
ghacksjs="https://raw.githubusercontent.com/ghacksuserjs/ghacks-user.js/master/user.js"
|
||||
|
||||
cd "`dirname $0`"
|
||||
|
||||
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]}")
|
||||
|
||||
## change directory to the Firefox profile directory
|
||||
cd "$(dirname "${scriptfullpath}")"
|
||||
|
||||
echo -e "Updating the user.js for Firefox profile:\n$(pwd)\n"
|
||||
|
||||
if [ -e user.js ]; then
|
||||
echo "Your current user.js file for this profile will be backed up and the latest ghacks version from github will take its place."
|
||||
echo -e "\nIf currently using the ghacks user.js, please compare versions:"
|
||||
@ -42,3 +50,6 @@ if [[ $REPLY =~ ^[Yy]$ ]]; then
|
||||
else
|
||||
echo "Process aborted"
|
||||
fi
|
||||
|
||||
## change directory back to the original working directory
|
||||
cd "${currdir}"
|
||||
|
Loading…
Reference in New Issue
Block a user