3.3 Updater Scripts

earthlng edited this page Dec 1, 2018 · 26 revisions

Unless you want to use the user.js exactly as it is, you must follow our naming convention for applying your changes for our updater scripts to work

  • profile\ user-overrides.js
  • profile\ user.js-overrides \ *.js [Windows updater script only, multiple js files]

** Special thanks to claustromaniac for the updater.bat and overdodactyl for the updater.sh.

:small_orange_diamond: Mac/Linux

Download the updater.sh script and save it in your profile folder. You can run it without any command line arguments and it will backup your current user.js, download the latest ghacks user.js and if it finds a user-overrides.js in the same folder it will append that to the user.js.

Since v1.3 the script compares its version number to the one online. If there is a newer version of updater.sh online, it asks you for confirmation to download and run it. 2 command-line parameters are available to change this behavior:

Available command-line parameters (case-insensitive):

  • -donotupdate to disable the self-update OR -update to skip the confirmation prompt

NEW command-line arguments in v2.0 !! ...

Optional Arguments:

-h		 Show this help message and exit
-p PROFILE	 absolute path to your Firefox profile (if different than the dir of this script)
		 IMPORTANT: if the path include spaces, wrap the entire argument in quotes!
-l 		 Choose your Firefox profile from a list. (will auto-select the profile if only 1 exists)
-u		 Update updater.sh and execute silently.  Do not seek confirmation.
-d		 Do not look for updates to updater.sh
-s		 Silently update user.js.  Do not seek confirmation.
-b		 Only keep one backup of user.js
-o OVERRIDE	 Filename(s) and/or path(s) to override file(s) (if different than user-overrides.js).
		 If used with -p, paths should be relative to PROFILE or absolute paths.
		 If given a directory, all *.js files inside will be appended recursively.
		 You can pass multiple files or directories by passing a comma separated list.
			 IMPORTANT: do not add spaces between files/paths!  Ex: -o file1.js,file2.js,dir1
			 IMPORTANT: if any files/paths include spaces, wrap the entire argument in quotes!
				 Ex: -o "override folder" 
-n		 Do not append any overrides, even if user-overrides.js exists
-c		 Create a diff file comparing old and new user.js
-v		 Open the resulting user.js file
-r		 Only download user.js to a temporary file and open it
-e               Activate ESR related preferences

Deprecated Arguments (they still work for now):

-donotupdate	 Use instead -d
-update		 Use instead -u

:small_orange_diamond: Windows

Download the updater.bat script and save it in your profile folder. You can run it without any command line arguments and it will backup your current user.js, download the latest ghacks user.js and if it finds a user-overrides.js in the same folder it will append that to the user.js.

!! Unicode encoded override files should be stored without the BOM header !!

Available command-line parameters (case-insensitive):

  • -MultiOverrides uses any and all .js files in a user.js-overrides sub-folder as overrides instead of the default user-overrides.js file. Files are appended in alphabetical order.

  • -singleBackup to use a single backup file and overwrite it on new updates, instead of cumulative backups. This was the default behaviour before v4.3.

  • -unattended runs the script without user-input

  • -updatebatch the updater will auto-update itself on execution

  • -log writes the console output to the logfile user.js-update-log.txt

  • -LogP works just like -Log but also opens the logfile after updating

  • -Merge merges overrides instead of appending them

    • _user.js.parrot lines are not merged
    • Comments are appended normally
    • Overrides for inactive (commented out) user.js prefs will be appended
    • When -Merge and -MultiOverrides are used together, a user-overrides-merged.js file is also generated in the root directory for quick reference. It contains only the merged data from override files and can be safely discarded after updating, or used as the new user-overrides.js.
    • When there are conflicting records for the same pref, the value of the last one declared will be used.
    • v4.5+ supports commenting-out active user_pref lines (see example below)

The following example illustrates how -merge works:

ghacks user.js file contains this:

/* 0103: set your "home" page (see 0102) ***/
   // user_pref("browser.startup.homepage", "https://www.example.com/");

/* 0510: disable Pocket (FF39+) ***/
user_pref("extensions.pocket.enabled", false);

/* 1202: control TLS versions with min and max ***/
user_pref("security.tls.version.max", 4); // 4 = allow up to and including TLS 1.3

/* 2503: disable giving away network info (FF31+) */
user_pref("dom.netinfo.enabled", false);

user-overrides.js:

/*** my user.js overrides ***/
user_pref("browser.startup.homepage", "https://www.foo.bar/"); // 01xx
user_pref("extensions.pocket.enabled", true); // 0510 - I like Pocket
user_pref("dom.netinfo.enabled", false); // 25xx - enforcing false

//// --- comment-out --- 'security.tls.version.max' -1202- wait until FF enables TLS1.3 for everyone

final user.js after update + merging:

/* 0103: set your "home" page (see 0102) ***/
   // user_pref("browser.startup.homepage", "https://www.example.com/");

/* 0510: disable Pocket (FF39+) ***/
user_pref("extensions.pocket.enabled", true); // 0510 - I like Pocket

/* 1202: control TLS versions with min and max ***/
//user_pref("security.tls.version.max", 4); // 4 = allow up to and including TLS 1.3

/*** 4600: RFP (4500) ALTERNATIVES [SETUP] ***/
/* [NOTE] ESR52.x and non-RFP users replace the * with a slash on this line to enable these
// 4607: [2503] disable giving away network info (FF31+)
user_pref("dom.netinfo.enabled", false); // 25xx - enforcing false
// ***/

/*** my user.js overrides ***/
user_pref("browser.startup.homepage", "https://www.foo.bar/"); // 01xx

//// --- comment-out --- 'security.tls.version.max' -1202- wait until FF enables TLS1.3 for everyone

a couple things to note here:

  • 0103 was not merged because it's inactive in the user.js. Instead the override was appended at the bottom.
  • 0510 was merged with the override, including the comment from the overrides file.
  • 1202 was commented out and the original value and comment are kept intact
  • the netinfo line was merged but the pref has been moved to 4600 in the updated user.js (see info below)
  • the special comment-out command was also appended at the bottom as a reminder that you gave that command

With -merge it's best to always add a comment behind your overrides to make them easily noticeable when you compare your new user.js with one of your backups. A good way is to use the number of the pref's section. That will also make it easier to spot when a pref you want to override gets moved to a commented-out section like 9999: DEPRECATED or 4600: RFP ALTERNATIVES, resulting in your override becoming inactive, which may or may not be what you want. (see dom.netinfo.enabled in the example) If that's not what you want, you can prepend the dom.netinfo.enabled line with a TAB or JS multi-line-comment (or in v4.0+ one or more spaces also works), like this:

    user_pref("dom.netinfo.enabled", false); // 25xx - enforcing false -- prepended with a TAB
/* !!! */ user_pref("dom.netinfo.enabled", false); // 25xx - enforcing false -- or a JS-multi-line comment
 user_pref("dom.netinfo.enabled", false); // 25xx - enforcing false -- for v4.0 space(s) also works

If you want the -merge function to comment out a pref you have to use this exact format:

//// --- comment-out --- 'prefname.goes.here'

Anything after the closing single-quote is optional and can be used for comments/reminders. (see example above)

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.