You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
2.3 KiB
53 lines
2.3 KiB
# -*- 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" |