diff --git a/setup.py b/setup.py index cc252f9..df0a820 100644 --- a/setup.py +++ b/setup.py @@ -89,11 +89,10 @@ def install(): copytree2(src=r'distribution', dst=makepath(programfiles, "Mozilla Thunderbird", "distribution")) # Disable Thunderbird Update - print("Disable Thunderbird Update") + print("Disable Thunderbird and Telemetry") key=reg_openkey_noredir(HKEY_LOCAL_MACHINE,r'SOFTWARE\Policies\Mozilla\Thunderbird',sam=KEY_WRITE, create_if_missing=True) - reg_setvalue(key,'DisableAppUpdate', 1, REG_DWORD) - reg_setvalue(key,'DisableTelemetry', 1, REG_DWORD) - + for value in ['DisableAppUpdate','DisableTelemetry']: + reg_setvalue(key,value, 1, REG_DWORD) else: error('This package is not compatible with your WAPT version. Please upgrade to WAPT 1.5 or more.') @@ -134,28 +133,30 @@ def update_package(): print('No update available') -if __name__ == '__main__': - update_package() - - def uninstall(): - print('uninstalling %s' % control.asrequirement()) + print('Uninstalling %s' % control.asrequirement()) for thunderbird in installed_softwares('Mozilla Thunderbird'): print('Uninstalling %s' % thunderbird['version']) run(uninstall_cmd(thunderbird['key'])) print('Removing registry entries') - registry_delete(HKEY_LOCAL_MACHINE, r'SOFTWARE\Policies\Mozilla\Thunderbird', 'DisableAppUpdate') - registry_delete(HKEY_LOCAL_MACHINE, r'SOFTWARE\Policies\Mozilla\Thunderbird', 'DisableTelemetry') + for value in ['DisableAppUpdate','DisableTelemetry']: + registry_delete(HKEY_LOCAL_MACHINE, r'SOFTWARE\Policies\Mozilla\Thunderbird', value) def audit(): for reg in ['DisableAppUpdate','DisableTelemetry']: - if not registry_readstring(HKEY_LOCAL_MACHINE, r'SOFTWARE\Policies\Mozilla\Thunderbird\%s' % reg): - print(r'Warning : SOFTWARE\Policies\Mozilla\Thunderbird\%s is missing !' % reg) - return "WARNING" - value = registry_readstring(HKEY_LOCAL_MACHINE, r'SOFTWARE\Policies\Mozilla\Thunderbird\%s' % reg) - if value != "1" : - print("Warning : Thunderbird update is not disable !") - return "WARNING" \ No newline at end of file + print('Checking %s' % reg) + value = registry_readstring(HKEY_LOCAL_MACHINE, r'SOFTWARE\Policies\Mozilla\Thunderbird', reg) + if not value: + print(r'Warning : SOFTWARE\Policies\Mozilla\Thunderbird\%s is missing' % reg) + return "ERROR" + elif value != 1: + print(r'Warning : SOFTWARE\Policies\Mozilla\Thunderbird\%s is %s instead of 1' % (reg,value)) + return "ERROR" + + return "OK" + +if __name__ == '__main__': + update_package() \ No newline at end of file