summarylogtreecommitdiffstats
path: root/02-cleaner.patch
blob: 74a147ed7d1c901f961a1da68335321e7f1024da (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
--- prefsCleaner.sh
+++ prefsCleaner.sh
@@ -11,10 +10,0 @@
-readonly CURRDIR=$(pwd)
-
-## get the full path of this script (readlink for Linux, greadlink for Mac with coreutils installed)
-SCRIPT_FILE=$(readlink -f "${BASH_SOURCE[0]}" 2>/dev/null || greadlink -f "${BASH_SOURCE[0]}" 2>/dev/null)
-
-## fallback for Macs without coreutils
-[ -z "$SCRIPT_FILE" ] && SCRIPT_FILE=${BASH_SOURCE[0]}
-
-
-AUTOUPDATE=true
@@ -23,11 +12,0 @@
-## download method priority: curl -> wget
-DOWNLOAD_METHOD=''
-if command -v curl >/dev/null; then
-	DOWNLOAD_METHOD='curl --max-redirs 3 -so'
-elif command -v wget >/dev/null; then
-	DOWNLOAD_METHOD='wget --max-redirect 3 --quiet -O'
-else
-	AUTOUPDATE=false
-	echo -e "No curl or wget detected.\nAutomatic self-update disabled!"
-fi
-
@@ -35,2 +13,0 @@
-	## change directory back to the original working directory
-	cd "${CURRDIR}"
@@ -46,7 +23 @@
-    -d           Don't auto-update prefsCleaner.sh"
-}
-
-download_file() { # expects URL as argument ($1)
-  declare -r tf=$(mktemp)
-
-  $DOWNLOAD_METHOD "${tf}" "$1" &>/dev/null && echo "$tf" || echo '' # return the temp-filename or empty string on error
+"
@@ -64,18 +34,0 @@
-## returns the version number of a prefsCleaner.sh file
-get_prefsCleaner_version() {
-	echo "$(sed -n '5 s/.*[[:blank:]]\([[:digit:]]*\.[[:digit:]]*\)/\1/p' "$1")"
-}
-
-## updates the prefsCleaner.sh file based on the latest public version
-update_prefsCleaner() {
-	declare -r tmpfile="$(download_file 'https://raw.githubusercontent.com/arkenfox/user.js/master/prefsCleaner.sh')"
-	[ -z "$tmpfile" ] && echo -e "Error! Could not download prefsCleaner.sh" && return 1 # check if download failed
-
-	[[ $(get_prefsCleaner_version "$SCRIPT_FILE") == $(get_prefsCleaner_version "$tmpfile") ]] && return 0
-
-	mv "$tmpfile" "$SCRIPT_FILE"
-	chmod u+x "$SCRIPT_FILE"
-	"$SCRIPT_FILE" "$@" -d
-	exit 0
-}
-
@@ -121 +74 @@
-while getopts "sd" opt; do
+while getopts "s" opt; do
@@ -126,3 +78,0 @@
-		d)
-			AUTOUPDATE=false
-			;;
@@ -132,3 +81,0 @@
-## change directory to the Firefox profile directory
-cd "$(dirname "${SCRIPT_FILE}")"
-
@@ -138,5 +84,0 @@
-elif [ -n "$(find ./ -user 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
-	fQuit 1
@@ -144,2 +85,0 @@
-
-[ "$AUTOUPDATE" = true ] && update_prefsCleaner "$@"