updater.sh/prefsCleaner.sh: Check for root and abort (#1651)
* updater.sh/prefsCleaner.sh: Check for root and abort Check if running as root and if any files have the owner/group as root|wheel. Abort on both. Should (hopefully) prevent stuff like: https://github.com/arkenfox/user.js/issues/1587 Discussion: https://github.com/arkenfox/user.js/pull/1595 --------- Co-authored-by: Mohammed Anas <triallax@tutanota.com> Co-authored-by: earthlng <earthlng@users.noreply.github.com>
This commit is contained in:
parent
c84c419544
commit
f2e4a79ca0
@ -2,12 +2,23 @@
|
|||||||
|
|
||||||
## prefs.js cleaner for Linux/Mac
|
## prefs.js cleaner for Linux/Mac
|
||||||
## author: @claustromaniac
|
## author: @claustromaniac
|
||||||
## version: 1.6
|
## version: 1.7
|
||||||
|
|
||||||
## special thanks to @overdodactyl and @earthlng for a few snippets that I stol..*cough* borrowed from the updater.sh
|
## special thanks to @overdodactyl and @earthlng for a few snippets that I stol..*cough* borrowed from the updater.sh
|
||||||
|
|
||||||
## DON'T GO HIGHER THAN VERSION x.9 !! ( because of ASCII comparison in update_prefsCleaner() )
|
## DON'T GO HIGHER THAN VERSION x.9 !! ( because of ASCII comparison in update_prefsCleaner() )
|
||||||
|
|
||||||
|
# Check if running as root and if any files have the owner/group as root/wheel.
|
||||||
|
if [ "${EUID:-"$(id -u)"}" -eq 0 ]; then
|
||||||
|
printf 'You shouldn't run this with elevated privileges (such as with doas/sudo).\n'
|
||||||
|
exit 1
|
||||||
|
elif [ -n "$(find ./ -user 0 -o -group 0)" ]; then
|
||||||
|
printf 'It looks like this script was previously run with elevated privileges,
|
||||||
|
you will need to change ownership of the following files to your user:\n'
|
||||||
|
find . -user 0 -o -group 0
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
readonly CURRDIR=$(pwd)
|
readonly CURRDIR=$(pwd)
|
||||||
|
|
||||||
## get the full path of this script (readlink for Linux, greadlink for Mac with coreutils installed)
|
## get the full path of this script (readlink for Linux, greadlink for Mac with coreutils installed)
|
||||||
@ -138,7 +149,7 @@ echo -e "\n\n"
|
|||||||
echo " ╔══════════════════════════╗"
|
echo " ╔══════════════════════════╗"
|
||||||
echo " ║ prefs.js cleaner ║"
|
echo " ║ prefs.js cleaner ║"
|
||||||
echo " ║ by claustromaniac ║"
|
echo " ║ by claustromaniac ║"
|
||||||
echo " ║ v1.6 ║"
|
echo " ║ v1.7 ║"
|
||||||
echo " ╚══════════════════════════╝"
|
echo " ╚══════════════════════════╝"
|
||||||
echo -e "\nThis script should be run from your Firefox profile directory.\n"
|
echo -e "\nThis script should be run from your Firefox profile directory.\n"
|
||||||
echo "It will remove any entries from prefs.js that also exist in user.js."
|
echo "It will remove any entries from prefs.js that also exist in user.js."
|
||||||
|
13
updater.sh
13
updater.sh
@ -2,12 +2,23 @@
|
|||||||
|
|
||||||
## arkenfox user.js updater for macOS and Linux
|
## arkenfox user.js updater for macOS and Linux
|
||||||
|
|
||||||
## version: 3.5
|
## version: 3.6
|
||||||
## Author: Pat Johnson (@overdodactyl)
|
## Author: Pat Johnson (@overdodactyl)
|
||||||
## Additional contributors: @earthlng, @ema-pe, @claustromaniac, @infinitewarp
|
## Additional contributors: @earthlng, @ema-pe, @claustromaniac, @infinitewarp
|
||||||
|
|
||||||
## DON'T GO HIGHER THAN VERSION x.9 !! ( because of ASCII comparison in update_updater() )
|
## DON'T GO HIGHER THAN VERSION x.9 !! ( because of ASCII comparison in update_updater() )
|
||||||
|
|
||||||
|
# Check if running as root and if any files have the owner/group as root/wheel.
|
||||||
|
if [ "${EUID:-"$(id -u)"}" -eq 0 ]; then
|
||||||
|
printf 'You shouldn't run this with elevated privileges (such as with doas/sudo).\n'
|
||||||
|
exit 1
|
||||||
|
elif [ -n "$(find ./ -user 0 -o -group 0)" ]; then
|
||||||
|
printf 'It looks like this script was previously run with elevated privileges,
|
||||||
|
you will need to change ownership of the following files to your user:\n'
|
||||||
|
find . -user 0 -o -group 0
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
readonly CURRDIR=$(pwd)
|
readonly CURRDIR=$(pwd)
|
||||||
|
|
||||||
SCRIPT_FILE=$(readlink -f "${BASH_SOURCE[0]}" 2>/dev/null || greadlink -f "${BASH_SOURCE[0]}" 2>/dev/null)
|
SCRIPT_FILE=$(readlink -f "${BASH_SOURCE[0]}" 2>/dev/null || greadlink -f "${BASH_SOURCE[0]}" 2>/dev/null)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user