Browse Source

First version of the package

master
Daniel Berteaud 1 year ago
parent
commit
b8def8896c
6 changed files with 465 additions and 0 deletions
  1. +32
    -0
      WAPT/control
  2. +295
    -0
      WAPT/wapt.psproj
  3. +3
    -0
      autoconf.js
  4. +1
    -0
      custom-strings.txt
  5. +53
    -0
      setup.py
  6. +81
    -0
      thunderbird.cfg.j2

+ 32
- 0
WAPT/control View File

@@ -0,0 +1,32 @@
package : fws-thunderbird-config
version : 1
architecture : all
section : base
priority : optional
maintainer : Daniel Berteaud
description : Configuration management for Thunderbird
depends : fws-thunderbird
conflicts :
maturity : DEV
locale :
target_os : windows
min_os_version : 5
max_os_version :
min_wapt_version : 1.5
sources :
installed_size :
impacted_process : thunderbird.exe
description_fr : Gestion de configuration pour Thunderbird
description_pl :
description_de :
description_es :
audit_schedule : 4w
editor :
keywords :
licence : MIT
homepage : https://www.firewall-services.com/
package_uuid :
signer :
signer_fingerprint:
signature_date :
signed_attributes :

+ 295
- 0
WAPT/wapt.psproj View File

@@ -0,0 +1,295 @@
[PyScripter]
Version=3.3.2.0
[Project]
ClassName=TProjectRootNode
StoreRelativePaths=TRUE
ShowFileExtensions=FALSE
[Project\ChildNodes\Node0]
ClassName=TProjectFilesNode
[Project\ChildNodes\Node0\ChildNodes\Node0]
ClassName=TProjectFolderNode
Name=wapt
[Project\ChildNodes\Node0\ChildNodes\Node0\ChildNodes\Node0]
ClassName=TProjectFileNode
FileName=C:\Program Files (x86)\wapt\common.py
[Project\ChildNodes\Node0\ChildNodes\Node0\ChildNodes\Node1]
ClassName=TProjectFileNode
FileName=C:\Program Files (x86)\wapt\setuphelpers.py
[Project\ChildNodes\Node0\ChildNodes\Node0\ChildNodes\Node2]
ClassName=TProjectFileNode
FileName=C:\Program Files (x86)\wapt\wapt-get.ini
[Project\ChildNodes\Node0\ChildNodes\Node0\ChildNodes\Node3]
ClassName=TProjectFileNode
FileName=C:\Program Files (x86)\wapt\wapt-get.py
[Project\ChildNodes\Node0\ChildNodes\Node0\ChildNodes\Node4]
ClassName=TProjectFileNode
FileName=C:\Program Files (x86)\wapt\waptpackage.py
[Project\ChildNodes\Node0\ChildNodes\Node0\ChildNodes]
Count=5
[Project\ChildNodes\Node0\ChildNodes\Node1]
ClassName=TProjectFileNode
FileName=$[Project-Path]changelog.txt
[Project\ChildNodes\Node0\ChildNodes\Node2]
ClassName=TProjectFileNode
FileName=$[Project-Path]control
[Project\ChildNodes\Node0\ChildNodes\Node3]
ClassName=TProjectFileNode
FileName=$[Project-Path]..\setup.py
[Project\ChildNodes\Node0\ChildNodes]
Count=4
[Project\ChildNodes\Node1]
ClassName=TProjectRunConfiguationsNode
[Project\ChildNodes\Node1\ChildNodes\Node0]
ClassName=TProjectRunConfiguationNode
Name=install
[Project\ChildNodes\Node1\ChildNodes\Node0\RunConfig]
ScriptName=C:\Program Files (x86)\wapt\wapt-get.py
EngineType=peRemote
ReinitializeBeforeRun=TRUE
Parameters=install "$[Project-Path].."
WorkingDir=$[Project-Path]..
WriteOutputToFile=FALSE
OutputFileName=$[ActiveScript-NoExt].log
AppendToFile=FALSE
[Project\ChildNodes\Node1\ChildNodes\Node0\RunConfig\ExternalRun]
Caption=External Run
Description=Run script using an external Python Interpreter
ApplicationName=$[PythonExe-Short]
Parameters=$[ActiveScript-Short]
WorkingDirectory=$[ActiveScript-Dir]
ShortCut=0
MessagesFormat=$[FileName] $[LineNumber]
[Project\ChildNodes\Node1\ChildNodes\Node1]
ClassName=TProjectRunConfiguationNode
Name=remove
[Project\ChildNodes\Node1\ChildNodes\Node1\RunConfig]
ScriptName=C:\Program Files (x86)\wapt\wapt-get.py
EngineType=peRemote
ReinitializeBeforeRun=TRUE
Parameters=remove "$[Project-Path].."
WorkingDir=$[Project-Path]..
WriteOutputToFile=FALSE
OutputFileName=$[ActiveScript-NoExt].log
AppendToFile=FALSE
[Project\ChildNodes\Node1\ChildNodes\Node1\RunConfig\ExternalRun]
Caption=External Run
Description=Run script using an external Python Interpreter
ApplicationName=$[PythonExe-Short]
Parameters=$[ActiveScript-Short]
WorkingDirectory=$[ActiveScript-Dir]
ShortCut=0
MessagesFormat=$[FileName] $[LineNumber]
[Project\ChildNodes\Node1\ChildNodes\Node2]
ClassName=TProjectRunConfiguationNode
Name=session-setup
[Project\ChildNodes\Node1\ChildNodes\Node2\RunConfig]
ScriptName=C:\Program Files (x86)\wapt\wapt-get.py
EngineType=peRemote
ReinitializeBeforeRun=TRUE
Parameters=session-setup "$[Project-Path].."
WorkingDir=$[Project-Path]..
WriteOutputToFile=FALSE
OutputFileName=$[ActiveScript-NoExt].log
AppendToFile=FALSE
[Project\ChildNodes\Node1\ChildNodes\Node2\RunConfig\ExternalRun]
Caption=External Run
Description=Run script using an external Python Interpreter
ApplicationName=$[PythonExe-Short]
Parameters=$[ActiveScript-Short]
WorkingDirectory=$[ActiveScript-Dir]
ShortCut=0
MessagesFormat=$[FileName] $[LineNumber]
[Project\ChildNodes\Node1\ChildNodes\Node3]
ClassName=TProjectRunConfiguationNode
Name=update
[Project\ChildNodes\Node1\ChildNodes\Node3\RunConfig]
ScriptName=C:\Program Files (x86)\wapt\wapt-get.py
EngineType=peRemote
ReinitializeBeforeRun=TRUE
Parameters=update
WorkingDir=$[Project-Path]..
WriteOutputToFile=FALSE
OutputFileName=$[ActiveScript-NoExt].log
AppendToFile=FALSE
[Project\ChildNodes\Node1\ChildNodes\Node3\RunConfig\ExternalRun]
Caption=External Run
Description=Run script using an external Python Interpreter
ApplicationName=$[PythonExe-Short]
Parameters=$[ActiveScript-Short]
WorkingDirectory=$[ActiveScript-Dir]
ShortCut=0
MessagesFormat=$[FileName] $[LineNumber]
[Project\ChildNodes\Node1\ChildNodes\Node4]
ClassName=TProjectRunConfiguationNode
Name=upgrade
[Project\ChildNodes\Node1\ChildNodes\Node4\RunConfig]
ScriptName=C:\Program Files (x86)\wapt\wapt-get.py
EngineType=peRemote
ReinitializeBeforeRun=TRUE
Parameters=-f upgrade
WorkingDir=$[ActiveScript-Dir]
WriteOutputToFile=FALSE
OutputFileName=$[ActiveScript-NoExt].log
AppendToFile=FALSE
[Project\ChildNodes\Node1\ChildNodes\Node4\RunConfig\ExternalRun]
Caption=External Run
Description=Run script using an external Python Interpreter
ApplicationName=$[PythonExe-Short]
Parameters=$[ActiveScript-Short]
WorkingDirectory=$[ActiveScript-Dir]
ShortCut=0
MessagesFormat=$[FileName] $[LineNumber]
[Project\ChildNodes\Node1\ChildNodes\Node5]
ClassName=TProjectRunConfiguationNode
Name=-i build-upload
[Project\ChildNodes\Node1\ChildNodes\Node5\RunConfig]
ScriptName=C:\Program Files (x86)\wapt\wapt-get.py
EngineType=peRemote
ReinitializeBeforeRun=TRUE
Parameters=-i build-upload "$[Project-Path].."
WorkingDir=$[Project-Path]..
WriteOutputToFile=FALSE
OutputFileName=$[ActiveScript-NoExt].log
AppendToFile=FALSE
[Project\ChildNodes\Node1\ChildNodes\Node5\RunConfig\ExternalRun]
Caption=External Run
Description=Run script using an external Python Interpreter
ApplicationName=$[PythonExe-Short]
Parameters=$[ActiveScript-Short]
WorkingDirectory=$[ActiveScript-Dir]
ShortCut=0
MessagesFormat=$[FileName] $[LineNumber]
[Project\ChildNodes\Node1\ChildNodes\Node6]
ClassName=TProjectRunConfiguationNode
Name=svn update
[Project\ChildNodes\Node1\ChildNodes\Node6\RunConfig]
ScriptName=C:\Program Files (x86)\wapt\wapt-get.py
EngineType=peRemote
ReinitializeBeforeRun=TRUE
Parameters=sources "$[Project-Path].."
WorkingDir=$[Project-Path]..
WriteOutputToFile=FALSE
OutputFileName=$[ActiveScript-NoExt].log
AppendToFile=FALSE
[Project\ChildNodes\Node1\ChildNodes\Node6\RunConfig\ExternalRun]
Caption=External Run
Description=Run script using an external Python Interpreter
ApplicationName=$[PythonExe-Short]
Parameters=$[ActiveScript-Short]
WorkingDirectory=$[ActiveScript-Dir]
ShortCut=0
MessagesFormat=$[FileName] $[LineNumber]
[Project\ChildNodes\Node1\ChildNodes\Node7]
ClassName=TProjectRunConfiguationNode
Name=uninstall
[Project\ChildNodes\Node1\ChildNodes\Node7\RunConfig]
ScriptName=C:\Program Files (x86)\wapt\wapt-get.py
EngineType=peRemote
ReinitializeBeforeRun=TRUE
Parameters=uninstall "$[Project-Path].."
WorkingDir=$[Project-Path]..
WriteOutputToFile=FALSE
OutputFileName=$[ActiveScript-NoExt].log
AppendToFile=FALSE
[Project\ChildNodes\Node1\ChildNodes\Node7\RunConfig\ExternalRun]
Caption=External Run
Description=Run script using an external Python Interpreter
ApplicationName=$[PythonExe-Short]
Parameters=$[ActiveScript-Short]
WorkingDirectory=$[Project-Path]..
ShortCut=0
MessagesFormat=$[FileName] $[LineNumber]
[Project\ChildNodes\Node1\ChildNodes\Node8]
ClassName=TProjectRunConfiguationNode
Name=update-package-sources
[Project\ChildNodes\Node1\ChildNodes\Node8\RunConfig]
ScriptName=C:\Program Files (x86)\wapt\wapt-get.py
EngineType=peRemote
ReinitializeBeforeRun=TRUE
Parameters=update-package-sources "$[Project-Path].."
WorkingDir=$[Project-Path]..
WriteOutputToFile=FALSE
OutputFileName=$[ActiveScript-NoExt].log
AppendToFile=FALSE
[Project\ChildNodes\Node1\ChildNodes\Node8\RunConfig\ExternalRun]
Caption=External Run
Description=Run script using an external Python Interpreter
ApplicationName=$[PythonExe-Short]
Parameters=$[ActiveScript-Short]
WorkingDirectory=$[ActiveScript-Dir]
ShortCut=0
MessagesFormat=$[FileName] $[LineNumber]
[Project\ChildNodes\Node1\ChildNodes\Node9]
ClassName=TProjectRunConfiguationNode
Name=audit
[Project\ChildNodes\Node1\ChildNodes\Node9\RunConfig]
ScriptName=C:\Program Files (x86)\wapt\wapt-get.py
EngineType=peRemote
ReinitializeBeforeRun=TRUE
Parameters=audit "$[Project-Path].."
WorkingDir=$[Project-Path]..
WriteOutputToFile=FALSE
OutputFileName=$[ActiveScript-NoExt].log
AppendToFile=FALSE
[Project\ChildNodes\Node1\ChildNodes\Node9\RunConfig\ExternalRun]
Caption=External Run
Description=Run script using an external Python Interpreter
ApplicationName=$[PythonExe-Short]
Parameters=$[ActiveScript-Short]
WorkingDirectory=$[ActiveScript-Dir]
ShortCut=0
MessagesFormat=$[FileName] $[LineNumber]
[Project\ChildNodes\Node1\ChildNodes]
Count=10
[Project\ChildNodes]
Count=2
[Project\ExtraPythonPath]
Count=0

+ 3
- 0
autoconf.js View File

@@ -0,0 +1,3 @@
// Autoconfig
pref("general.config.obscure_value", 0);
pref("general.config.filename", "firefox.cfg");

+ 1
- 0
custom-strings.txt View File

@@ -0,0 +1 @@
chrome%3A//messenger/locale/messengercompose/composeMsgs.properties#cloudAttachmentListFooter=<small>Partagez facilement vos documents avec <a href=http://www.firewall-services.com/><b>Firewall Services</b>&#8482;</a></small>

+ 53
- 0
setup.py View File

@@ -0,0 +1,53 @@
# -*- coding: utf-8 -*-
from setuphelpers import *
import json
from cryptography.fernet import Fernet
import os
from jinja2 import Environment, FileSystemLoader
uninstallkey = []
variables = {
'thunderbird_config_url': 'https://server/mcd/thunderbird.cfg',
'thunderbird_config_append_domain': ''
}
# Read local variables file if available
if isfile(makepath(programfiles32,'wapt','private','symetric.txt')) and isfile(makepath(programfiles32,'wapt','private','variables.txt')):
print('Reading local encrypted variables file')
f = Fernet(open(makepath(programfiles32,'wapt','private','symetric.txt'),'r').read())
variables.update(json.loads(f.decrypt(open(makepath(programfiles32,'wapt','private','variables.txt'),'r').read())))
install_dir = programfiles
if iswin64():
install_dir = programfiles32
def install():
filecopyto('autoconf.js', makepath(install_dir,'Mozilla Thunderbird','defaults','pref'))
if not isdir(makepath(install_dir, 'Mozilla Thunderbird','chrome')):
mkdirs(makepath(install_dir, 'Mozilla Thunderbird','chrome'))
filecopyto('custom-strings.txt', makepath(install_dir,'Mozilla Thunderbird','chrome'))
jinja2 = Environment(
loader=FileSystemLoader(os.path.dirname(os.path.abspath(__file__))),
trim_blocks=True
)
open(makepath(install_dir,'Mozilla Thunderbird','thunderbird.cfg'),'w').write(
jinja2.get_template('thunderbird.cfg.j2').render(
thunderbird_config_url = variables['thunderbird_config_url'],
thunderbird_config_append_domain = variables['thunderbird_config_append_domain']
)
)
def uninstall():
os.unlink(makepath(install_dir,'Mozilla Thunderbird','defaults','pref','autoconf.js'))
os.unlink(makepath(install_dir,'Mozilla Thunderbird','chrome','custom-strings.txt'))
os.unlink(makepath(install_dir,'Mozilla Thunderbird','thunderbird.cfg'))
def audit():
if (
not isfile(makepath(install_dir,'Mozilla Thunderbird','defaults','pref','autoconf.js')) or
not isfile(makepath(install_dir,'Mozilla Thunderbird','chrome','custom-strings.txt')) or
not isfile(makepath(install_dir,'Mozilla Thunderbird','thunderbird.cfg'))
):
print('At least one config file is missing')
return "ERROR"
return "OK"

+ 81
- 0
thunderbird.cfg.j2 View File

@@ -0,0 +1,81 @@
// Autoconf
if(getenv("USER") != "") {
var user = getenv("USER");
} else {
var env_user = getenv("USERNAME");
}
{% if thunderbird_config_append_domain is defined and thunderbird_config_append_domain != '' %}
var mail = env_user + '@{{ thunderbird_config_append_domain }}';
{% else %}
var mail = env_user;
{% endif %}
lockPref("mail.identity.useremail", mail);
lockPref("autoadmin.append_emailaddr", true);
lockPref("autoadmin.global_config_url", "{{ thunderbird_config_url }}");
lockPref("autoadmin.failover_to_cached", true);
lockPref("autoadmin.offline_failover", true);
// Javascript to enable the distribution/bundles directory
const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
var gBundlePrefFiles = [];
Cu.import("resource://gre/modules/Services.jsm");
function loadBundleDirs() {
var distributionBundleDir = Services.dirsvc.get("GreD", Ci.nsIFile);
distributionBundleDir.append("distribution");
distributionBundleDir.append("bundles");
if (!distributionBundleDir.exists() || !distributionBundleDir.isDirectory()) {
return;
}
var enumerator = distributionBundleDir.directoryEntries;
while (enumerator.hasMoreElements()) {
var file = enumerator.getNext().QueryInterface(Ci.nsIFile);
var dirName = file.leafName;
file.append("chrome.manifest");
Components.manager.QueryInterface(Ci.nsIComponentRegistrar).autoRegister(file);
file.leafName = "defaults";
file.append("preferences");
if (!file.exists() || !file.isDirectory()) {
continue;
}
var resource = Services.io.getProtocolHandler("resource")
.QueryInterface(Components.interfaces.nsIResProtocolHandler);
// We can't use a file URL to load prefs.
// Create a resource URL that maps to the prefs directory.
var prefAlias = Services.io.newFileURI(file);
resource.setSubstitution(dirName + "_prefs", prefAlias);
var prefEnumerator = file.directoryEntries;
while (prefEnumerator.hasMoreElements()) {
var prefFile = prefEnumerator.getNext().QueryInterface(Ci.nsIFile);
gBundlePrefFiles.push("resource://" + dirName + "_prefs/" + prefFile.leafName);
}
}
}
var loadPrefObserver = {
observe: function observe(subject, topic, data) {
if (gBundlePrefFiles.length > 0) {
// Create a temporary scope so the pref function works
var temp = {};
temp.pref = function(a, b) {
defaultPref(a, b);
}
gBundlePrefFiles.forEach(function(prefFile) {
Services.scriptloader.loadSubScript(prefFile, temp);
});
}
}
}
Services.obs.addObserver(loadPrefObserver, "load-extension-defaults", false);
try {
loadBundleDirs();
} catch(e) {}

Loading…
Cancel
Save