parent
e21348b254
commit
c0b0235183
4 changed files with 413 additions and 0 deletions
@ -0,0 +1,32 @@ |
||||
package : fws-sogo-addons |
||||
version : 1 |
||||
architecture : all |
||||
section : base |
||||
priority : optional |
||||
maintainer : Daniel Berteaud <daniel@firewall-services.com> |
||||
description : SOGo addons for Thunderbird |
||||
depends : fws-thunderbird, fws-7zip |
||||
conflicts : |
||||
maturity : DEV |
||||
locale : |
||||
target_os : windows |
||||
min_os_version : |
||||
max_os_version : |
||||
min_wapt_version : |
||||
sources : |
||||
installed_size : |
||||
impacted_process : |
||||
description_fr : |
||||
description_pl : |
||||
description_de : |
||||
description_es : |
||||
audit_schedule : 4w |
||||
editor : |
||||
keywords : |
||||
licence : |
||||
homepage : |
||||
package_uuid : |
||||
signer : |
||||
signer_fingerprint: |
||||
signature_date : |
||||
signed_attributes : |
@ -0,0 +1,20 @@ |
||||
<?xml version="1.0"?> |
||||
<!DOCTYPE RDF> |
||||
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" |
||||
xmlns:isi="http://inverse.ca/sogo-integrator/" |
||||
xmlns:em="http://www.mozilla.org/2004/em-rdf#" |
||||
xmlns:NC="http://home.netscape.com/NC-rdf#"> |
||||
<Seq about="http://inverse.ca/sogo-integrator/extensions" |
||||
isi:updateURL="https://{{ sogo_server }}/plugins/updates.php?plugin=%ITEM_ID%&version=%ITEM_VERSION%&platform=%PLATFORM%"> |
||||
<li> |
||||
<Description |
||||
em:id="sogo-integrator@inverse.ca" |
||||
em:name="SOGo Integrator"/> |
||||
</li> |
||||
<li> |
||||
<Description |
||||
em:id="sogo-connector@inverse.ca" |
||||
em:name="SOGo Connector"/> |
||||
</li> |
||||
</Seq> |
||||
</RDF> |
@ -0,0 +1,66 @@ |
||||
# -*- coding: UTF-8 -*- |
||||
from setuphelpers import * |
||||
import json |
||||
from cryptography.fernet import Fernet |
||||
import os |
||||
from jinja2 import Environment, FileSystemLoader |
||||
|
||||
uninstallkey = [] |
||||
|
||||
variables = { |
||||
'sogo_server': 'mail.server.local' |
||||
} |
||||
|
||||
# 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 |
||||
connector_version = '60.0.0' |
||||
integrator_version = '60.0.0' |
||||
|
||||
def install(): |
||||
for extension in ['connector','integrator']: |
||||
if not isdir(makepath(install_dir,'Mozilla Thunderbird','distribution','bundles','sogo-' + extension)): |
||||
mkdirs(makepath(install_dir,'Mozilla Thunderbird','distribution','bundles','sogo-' + extension)) |
||||
|
||||
# connector can be extracted as is |
||||
run('"%s" x -y -o"%s" sogo-connector-%s.xpi' % (makepath(programfiles,'7-Zip','7z.exe'), makepath(install_dir,'Mozilla Thunderbird','distribution','bundles','sogo-connector'), connector_version)) |
||||
|
||||
# Integrator must be customized, so first extract it |
||||
run('"%s" x -y -o"%s" sogo-integrator-%s-sogo-demo.xpi' % (makepath(programfiles,'7-Zip','7z.exe'), makepath(install_dir,'Mozilla Thunderbird','distribution','bundles','sogo-integrator'), integrator_version)) |
||||
# And replace the extensions.rdf content |
||||
jinja2 = Environment( |
||||
loader=FileSystemLoader(os.path.dirname(os.path.abspath(__file__))), |
||||
trim_blocks=True |
||||
) |
||||
open(makepath(install_dir,'Mozilla Thunderbird','distribution','bundles','sogo-integrator','chrome','content','extensions.rdf'),'w').write( |
||||
jinja2.get_template('extensions.rdf.j2').render( |
||||
sogo_server = variables['sogo_server'] |
||||
) |
||||
) |
||||
# Also remove custom settings |
||||
os.unlink(makepath(install_dir,'Mozilla Thunderbird','distribution','bundles','sogo-integrator','defaults','preferences','site.js')) |
||||
|
||||
|
||||
def uninstall(): |
||||
print('Removing SOGo extensions for Thunderbird') |
||||
for extension in ['connector','integrator']: |
||||
remove_tree(makepath(install_dir,'Mozilla Thunderbird','distribution','bundles','sogo-' + extension)) |
||||
|
||||
def audit(): |
||||
try: |
||||
run('type "%s" | find /I "em:version=" | find "%s"' % (makepath(install_dir,'Mozilla Thunderbird','distribution','bundles','sogo-connector','install.rdf'), connector_version)) |
||||
except: |
||||
print('SOGO connector version check failed') |
||||
return "ERROR" |
||||
try: |
||||
run('type "%s" | find /I "em:version=" | find "%s"' % (makepath(install_dir,'Mozilla Thunderbird','distribution','bundles','sogo-integrator','install.rdf'), integrator_version)) |
||||
except: |
||||
print('SOGO integrator version check failed') |
||||
return "ERROR" |
||||
return "OK" |
Loading…
Reference in new issue