3fe7b7
diff -up thunderbird-68.1.1/extensions/pref/autoconfig/src/nsReadConfig.cpp.1170092 thunderbird-68.1.1/extensions/pref/autoconfig/src/nsReadConfig.cpp
3fe7b7
--- thunderbird-68.1.1/extensions/pref/autoconfig/src/nsReadConfig.cpp.1170092	2019-09-24 16:36:11.000000000 +0200
3fe7b7
+++ thunderbird-68.1.1/extensions/pref/autoconfig/src/nsReadConfig.cpp	2019-10-03 11:27:33.905512072 +0200
3fe7b7
@@ -246,8 +246,20 @@ nsresult nsReadConfig::openAndEvaluateJS
10afcc
     if (NS_FAILED(rv)) return rv;
10afcc
 
10afcc
     rv = NS_NewLocalFileInputStream(getter_AddRefs(inStr), jsFile);
10afcc
-    if (NS_FAILED(rv)) return rv;
10afcc
+    if (NS_FAILED(rv)) {
10afcc
+      // Look for cfg file in /etc/<application>/pref
10afcc
+      rv = NS_GetSpecialDirectory(NS_APP_PREFS_SYSTEM_CONFIG_DIR,
10afcc
+                                  getter_AddRefs(jsFile));
10afcc
+      NS_ENSURE_SUCCESS(rv, rv);
10afcc
+
10afcc
+      rv = jsFile->AppendNative(NS_LITERAL_CSTRING("pref"));
10afcc
+      NS_ENSURE_SUCCESS(rv, rv);
10afcc
+      rv = jsFile->AppendNative(nsDependentCString(aFileName));
10afcc
+      NS_ENSURE_SUCCESS(rv, rv);
10afcc
 
10afcc
+      rv = NS_NewLocalFileInputStream(getter_AddRefs(inStr), jsFile);
10afcc
+      NS_ENSURE_SUCCESS(rv, rv);
10afcc
+    }
10afcc
   } else {
10afcc
     nsAutoCString location("resource://gre/defaults/autoconfig/");
10afcc
     location += aFileName;
3fe7b7
diff -up thunderbird-68.1.1/modules/libpref/Preferences.cpp.1170092 thunderbird-68.1.1/modules/libpref/Preferences.cpp
3fe7b7
--- thunderbird-68.1.1/modules/libpref/Preferences.cpp.1170092	2019-09-24 16:36:50.000000000 +0200
3fe7b7
+++ thunderbird-68.1.1/modules/libpref/Preferences.cpp	2019-10-03 11:27:33.906512075 +0200
3fe7b7
@@ -4436,6 +4436,8 @@ static nsresult pref_ReadDefaultPrefs(co
10afcc
   //
10afcc
   // Thus, in the omni.jar case, we always load app-specific default
10afcc
   // preferences from omni.jar, whether or not `$app == $gre`.
10afcc
+  // At very end load configuration from system config location:
10afcc
+  // - /etc/firefox/pref/*.js
10afcc
 
3fe7b7
   nsresult rv = NS_ERROR_FAILURE;
10afcc
   nsZipFind* findPtr;
3fe7b7
diff -up thunderbird-68.1.1/toolkit/xre/nsXREDirProvider.cpp.1170092 thunderbird-68.1.1/toolkit/xre/nsXREDirProvider.cpp
3fe7b7
--- thunderbird-68.1.1/toolkit/xre/nsXREDirProvider.cpp.1170092	2019-09-24 16:37:39.000000000 +0200
3fe7b7
+++ thunderbird-68.1.1/toolkit/xre/nsXREDirProvider.cpp	2019-10-03 11:33:45.858681620 +0200
3fe7b7
@@ -524,6 +524,21 @@ nsXREDirProvider::GetFile(const char* aP
10afcc
       }
10afcc
     }
10afcc
   }
10afcc
+
10afcc
+#if defined(XP_UNIX)
10afcc
+  if (!strcmp(aProperty, NS_APP_PREFS_SYSTEM_CONFIG_DIR)) {
10afcc
+    nsCString sysConfigDir = NS_LITERAL_CSTRING("/etc/");
10afcc
+    nsCOMPtr<nsIXULAppInfo> appInfo = do_GetService("@mozilla.org/xre/app-info;1");
10afcc
+    if (!appInfo)
10afcc
+      return NS_ERROR_NOT_AVAILABLE;
10afcc
+    nsCString appName;
10afcc
+    appInfo->GetName(appName);
10afcc
+    ToLowerCase(appName);
10afcc
+    sysConfigDir.Append(appName);
10afcc
+    return NS_NewNativeLocalFile(sysConfigDir, false, aFile);
10afcc
+  }
10afcc
+#endif
10afcc
+
10afcc
   if (NS_FAILED(rv) || !file) return NS_ERROR_FAILURE;
10afcc
 
10afcc
   if (ensureFilePermissions) {
3fe7b7
@@ -880,6 +895,16 @@ nsresult nsXREDirProvider::GetFilesInter
10afcc
     LoadDirIntoArray(mXULAppDir, kAppendPrefDir, directories);
10afcc
     LoadDirsIntoArray(mAppBundleDirectories, kAppendPrefDir, directories);
10afcc
 
10afcc
+    // Add /etc/<application>/pref/ directory if it exists
10afcc
+    nsCOMPtr<nsIFile> systemPrefDir;
10afcc
+    rv = NS_GetSpecialDirectory(NS_APP_PREFS_SYSTEM_CONFIG_DIR,
10afcc
+                                getter_AddRefs(systemPrefDir));
10afcc
+    if (NS_SUCCEEDED(rv)) {
10afcc
+      rv = systemPrefDir->AppendNative(NS_LITERAL_CSTRING("pref"));
10afcc
+      if (NS_SUCCEEDED(rv))
10afcc
+        directories.AppendObject(systemPrefDir);
10afcc
+    }
10afcc
+
3fe7b7
     rv = NS_NewArrayEnumerator(aResult, directories, NS_GET_IID(nsIFile));
10afcc
   } else if (!strcmp(aProperty, NS_APP_CHROME_DIR_LIST)) {
10afcc
     // NS_APP_CHROME_DIR_LIST is only used to get default (native) icons
3fe7b7
diff -up thunderbird-68.1.1/xpcom/io/nsAppDirectoryServiceDefs.h.1170092 thunderbird-68.1.1/xpcom/io/nsAppDirectoryServiceDefs.h
3fe7b7
--- thunderbird-68.1.1/xpcom/io/nsAppDirectoryServiceDefs.h.1170092	2019-09-24 16:37:44.000000000 +0200
3fe7b7
+++ thunderbird-68.1.1/xpcom/io/nsAppDirectoryServiceDefs.h	2019-10-03 11:27:33.907512077 +0200
10afcc
@@ -62,6 +62,7 @@
10afcc
 #define NS_APP_PREFS_DEFAULTS_DIR_LIST "PrefDL"
10afcc
 #define NS_APP_PREFS_OVERRIDE_DIR \
10afcc
   "PrefDOverride"  // Directory for per-profile defaults
10afcc
+#define NS_APP_PREFS_SYSTEM_CONFIG_DIR          "PrefSysConf"   // Directory with system-wide configuration
10afcc
 
10afcc
 #define NS_APP_USER_PROFILE_50_DIR "ProfD"
10afcc
 #define NS_APP_USER_PROFILE_LOCAL_50_DIR "ProfLD"