4 all: whatdoesitdo tests
6 ##### INSTALLATION METHODS #####
8 locked_user.js
: user.js
9 ######## generate a locked configuration file
10 sed
's/^user_pref/lockPref/' $< >|
$@
12 systemwide_user.js
: user.js
13 ######## generate a system-wide configuration file
14 sed
's/user_pref(/pref(/' $< >|
$@
16 debian_locked.js
: user.js
17 ######## generate a locked, system-wide configuration file
18 sed
's/^user_pref(\("[^"]\+"\),\s\+\([^)]\+\));\(\s*\/\/.*\)\?$$/pref(\1, \2, locked);/' $< >|
$@
20 # https://github.com/mozilla/policy-templates/blob/master/README.md
22 # TODO what does it do?
23 jq
-n
-M
"{\"policies\": {\"OfferToSaveLogins\": false, \"DisableBuiltinPDFViewer\": true, \"DisablePocket\": true, \"DisableFormHistory\": true, \"SanitizeOnShutdown\": true, \"SearchBar\": \"separate\", \"DisableTelemetry\": true, \"Cookies\": {\"AcceptThirdParty\": \"never\", \"ExpireAtSessionEnd\": true}, \"EnableTrackingProtection\": {\"Value\": true}, \"PopupBlocking\": {\"Default\": true}, \"FlashPlugin\": {\"Default\": false}, \"DisableFirefoxStudies\": true}}" >|
$@
29 tests
: sourceprefs.js checkdeprecated stats acorn bash_syntax shellcheck
33 ######## validate js syntax
34 acorn
--silent user.js
38 ######## check syntax of all bash scripts
39 $(foreach i
,$(wildcard *.sh
),bash
-n
$(i
);)
43 ######## check/lint all shell scripts
47 ##### MAINTENANCE #####
49 TBBBRANCH
=tor-browser-68.8
.0esr-9.5
-1
51 ######## download Tor Browser custom configuration reference
52 wget
-nv
"https://gitweb.torproject.org/tor-browser.git/plain/browser/app/profile/firefox.js?h=$(TBBBRANCH)" -O
$@
54 regex
= ^\
(user_\
)\?pref
/s
/^.
*pref
("\([^"]\
+\
)",\s*\([^)]\+\).*$$
56 tbb-diff: 000-tor-browser.js
57 ######## differences between values from this user.js and tor browser's values
58 diff <(sed -n '/$(regex)/\1 = \2/p' user.js | sort) <(sed -n '/$(regex)/\1 = \2/p' $< | sort)
61 tbb-diff-2: 000-tor-browser.js
62 ######## TODO what does it do?
63 for setting in $$( comm -12 <(sed -n '/$(regex)/\1/p' user.js | sort) <(sed -n '/$(regex)/\1/p' $< | sort)); do diff <(grep "^\
(user_\
)\?pref
(\"$${setting}\"" user.js | sed -n '/$(regex)/\1 = \2/p' | sort) <(grep "^\
(user_\
)\?pref
(\"$${setting}\"" $< | sed -n '/$(regex)/\1 = \2/p' | sort); done
65 .PHONY: tbb-missing-from-user.js
66 tbb-missing-from-user.js: 000-tor-browser.js
67 ######## preferences that are present in tor browser's defaults, but not in this user.js
68 comm -13 <(sed -n '/$(regex)/\1/p' user.js | sort) <(sed -n '/$(regex)/\1/p' $< | sort)
70 # specify wanted Firefox version/revision below (eg. "tip
", "FIREFOX_AURORA_45_BASE
", "9577ddeaafd85554c2a855f385a87472a089d5c0
"). See https://hg.mozilla.org/mozilla-central/tags
72 FIREFOX_SOURCE_PREFS= \
73 https://hg.mozilla.org/mozilla-central/raw-file/$(SOURCEVERSION)/modules/libpref/init/all.js \
74 https://hg.mozilla.org/mozilla-central/raw-file/$(SOURCEVERSION)/testing/profiles/common/user.js \
75 https://hg.mozilla.org/mozilla-central/raw-file/$(SOURCEVERSION)/testing/profiles/reftest/user.js \
76 https://hg.mozilla.org/mozilla-central/raw-file/$(SOURCEVERSION)/js/src/tests/user.js \
77 https://hg.mozilla.org/mozilla-central/raw-file/$(SOURCEVERSION)/browser/app/profile/firefox.js \
78 https://hg.mozilla.org/mozilla-central/raw-file/tip/devtools/client/preferences/debugger.js \
79 https://hg.mozilla.org/mozilla-central/raw-file/tip/browser/branding/unofficial/pref/firefox-branding.js \
80 https://hg.mozilla.org/mozilla-central/raw-file/tip/browser/branding/official/pref/firefox-branding.js \
81 https://hg.mozilla.org/mozilla-central/raw-file/tip/browser/branding/nightly/pref/firefox-branding.js \
82 https://hg.mozilla.org/mozilla-central/raw-file/tip/browser/branding/aurora/pref/firefox-branding.js \
83 https://hg.mozilla.org/mozilla-central/raw-file/tip/browser/locales/en-US/firefox-l10n.js \
84 https://hg.mozilla.org/mozilla-central/raw-file/tip/devtools/client/webide/preferences/webide.js \
85 https://hg.mozilla.org/mozilla-central/raw-file/tip/browser/app/profile/channel-prefs.js
87 ######## download and sort all known preferences files from Firefox (mozilla-central) source
88 @for SOURCEFILE in $(FIREFOX_SOURCE_PREFS); do wget -nv "$$SOURCEFILE" -O - ; done | egrep "(^pref|^user_pref
)" | sort --unique >| $@
90 .PHONY: upstream-duplicates
91 upstream-duplicates: sourceprefs.js
92 ######## preferences with common values with default Firefox configuration
93 @sed 's/^pref(/user_pref(/' sourceprefs.js | sed -E "s
/[[:space
:]]+/ /g
" | sort > sourceprefs_sorted.js
94 @grep "^user_pref
" user.js | sed -E "s
/[[:space
:]]+/ /g
" | sort > userjs_sorted.js
95 @comm -1 -2 sourceprefs_sorted.js userjs_sorted.js
97 .PHONY: upstream-missing-from-user.js
98 upstream-missing-from-user.js: sourceprefs.js
99 ######## preferences present in firefox source but not covered by user.js
100 ######## configure ignored preferences in ignore.list
101 @SOURCE_PREFS=$$(egrep '(^pref|^user_pref)' $< | awk -F'"' '{print $$2}'); \
102 for SOURCE_PREF in $$SOURCE_PREFS; do \
103 grep "\"$$SOURCE_PREF\"" user.js ignore.list >/dev/null || echo "Not covered by user.js : $$SOURCE_PREF"; \
106 .PHONY: checkdeprecated
107 upstream-deprecated: sourceprefs.js
108 ######## preferences in hardened user.js that are no longer present in firefox source
109 @HARDENED_PREFS=$$(egrep "^user_pref" user.js | cut -d'"' -f2); \
110 for HARDENED_PREF in $$HARDENED_PREFS; do \
111 grep "\"$$HARDENED_PREF\"" $< >/dev/null || echo "Deprecated
: $$HARDENED_PREF"; \
115 stats: sourceprefs.js
116 ######## count preferences number, various stats
117 @echo "$$(egrep
"^user_pref" user.js | wc
-l | cut
-f1
) preferences in user.js
"
118 @echo "$$(wc
-l
$< | cut
-d
" " -f1
) preferences in Firefox source
"
122 ######## generate the README "What does it do?
" section
127 ######## generate/update the README "What does it do?
" section
128 @rm -f sourceprefs.js sourceprefs_sorted.js userjs_sorted.js 000-tor-browser.js debian_locked.js
132 ######## generate the README table of contents
133 @l2headers=$$(egrep "^
## " README.md |cut -d" " -f1 --complement ); \
134 echo
"$$l2headers" | while read line
; do \
135 anchor
=$$(echo
"$$line" | tr
'[:upper:]' '[:lower:]' | sed
's/ /-/g' | sed
's/\?//g'); \
136 echo
"* [$$line](#$$anchor)"; \