mirror of
https://github.com/arkenfox/user.js.git
synced 2025-05-07 17:33:45 +02:00
Update prefsCleaner.sh
This commit is contained in:
parent
7f095463b6
commit
f1ad9f6e08
1 changed files with 7 additions and 11 deletions
|
@ -2,7 +2,7 @@
|
|||
|
||||
## prefs.js cleaner for Linux/Mac
|
||||
## author: @claustromaniac
|
||||
## version: 1.0b7
|
||||
## version: 1.0
|
||||
|
||||
## special thanks to @overdodactyl and @earthlng for a few snippets that I stol..*cough* borrowed from the updater.sh
|
||||
|
||||
|
@ -38,21 +38,19 @@ fClean() {
|
|||
prefs="@@"
|
||||
prefexp="user_pref[ ]*\([ ]*[\"']([^\"']*)[\"'][ ]*,"
|
||||
while read -r line; do
|
||||
if [[ "$line" =~ $prefexp ]]; then
|
||||
if [[ $prefs != *"@@${BASH_REMATCH[1]}@@"* ]]; then
|
||||
if [[ "$line" =~ $prefexp && $prefs != *"@@${BASH_REMATCH[1]}@@"* ]]; then
|
||||
prefs="${prefs}${BASH_REMATCH[1]}@@"
|
||||
fi
|
||||
fi
|
||||
done <<< "`grep -E "$prefexp" user.js`"
|
||||
done <<< "`grep -E \"$prefexp\" user.js`"
|
||||
|
||||
while IFS='' read -r line || [[ -n "$line" ]]; do
|
||||
if [[ "$line" =~ ^$prefexp ]]; then
|
||||
if [[ $prefs != *"@@${BASH_REMATCH[1]}@@"* ]]; then
|
||||
echo "$line"
|
||||
fi
|
||||
continue
|
||||
else
|
||||
echo "$line"
|
||||
fi
|
||||
echo "$line"
|
||||
done < "$1" > prefs.js
|
||||
}
|
||||
|
||||
|
@ -60,7 +58,7 @@ echo -e "\n\n"
|
|||
echo " ╔══════════════════════════╗"
|
||||
echo " ║ prefs.js cleaner ║"
|
||||
echo " ║ by claustromaniac ║"
|
||||
echo " ║ v1.0b7 ║"
|
||||
echo " ║ v1.0 ║"
|
||||
echo " ╚══════════════════════════╝"
|
||||
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."
|
||||
|
@ -76,9 +74,7 @@ select option in Start Help Exit; do
|
|||
fi
|
||||
|
||||
fFF_check
|
||||
## create backup folder if it doesn't exist
|
||||
mkdir -p userjs_backups;
|
||||
bakfile="userjs_backups/prefs.js.backup.$(date +"%Y-%m-%d_%H%M")"
|
||||
bakfile="prefs.js.backup.$(date +"%Y-%m-%d_%H%M")"
|
||||
mv prefs.js "${bakfile}" || fQuit 1 "Operation aborted.\nReason: Could not create backup file $bakfile"
|
||||
echo -e "\nprefs.js backed up: $bakfile"
|
||||
echo "Cleaning prefs.js..."
|
||||
|
|
Loading…
Add table
Reference in a new issue