Cleanup and fix audit function

master
Daniel Berteaud 4 years ago
parent 6d9ba1729c
commit 4206f5498d
  1. 37
      setup.py

@ -89,11 +89,10 @@ def install():
copytree2(src=r'distribution', dst=makepath(programfiles, "Mozilla Thunderbird", "distribution")) copytree2(src=r'distribution', dst=makepath(programfiles, "Mozilla Thunderbird", "distribution"))
# Disable Thunderbird Update # 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) 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) for value in ['DisableAppUpdate','DisableTelemetry']:
reg_setvalue(key,'DisableTelemetry', 1, REG_DWORD) reg_setvalue(key,value, 1, REG_DWORD)
else: else:
error('This package is not compatible with your WAPT version. Please upgrade to WAPT 1.5 or more.') 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') print('No update available')
if __name__ == '__main__':
update_package()
def uninstall(): def uninstall():
print('uninstalling %s' % control.asrequirement()) print('Uninstalling %s' % control.asrequirement())
for thunderbird in installed_softwares('Mozilla Thunderbird'): for thunderbird in installed_softwares('Mozilla Thunderbird'):
print('Uninstalling %s' % thunderbird['version']) print('Uninstalling %s' % thunderbird['version'])
run(uninstall_cmd(thunderbird['key'])) run(uninstall_cmd(thunderbird['key']))
print('Removing registry entries') print('Removing registry entries')
registry_delete(HKEY_LOCAL_MACHINE, r'SOFTWARE\Policies\Mozilla\Thunderbird', 'DisableAppUpdate') for value in ['DisableAppUpdate','DisableTelemetry']:
registry_delete(HKEY_LOCAL_MACHINE, r'SOFTWARE\Policies\Mozilla\Thunderbird', 'DisableTelemetry') registry_delete(HKEY_LOCAL_MACHINE, r'SOFTWARE\Policies\Mozilla\Thunderbird', value)
def audit(): def audit():
for reg in ['DisableAppUpdate','DisableTelemetry']: for reg in ['DisableAppUpdate','DisableTelemetry']:
if not registry_readstring(HKEY_LOCAL_MACHINE, r'SOFTWARE\Policies\Mozilla\Thunderbird\%s' % reg): print('Checking %s' % reg)
print(r'Warning : SOFTWARE\Policies\Mozilla\Thunderbird\%s is missing !' % reg) value = registry_readstring(HKEY_LOCAL_MACHINE, r'SOFTWARE\Policies\Mozilla\Thunderbird', reg)
return "WARNING" if not value:
value = registry_readstring(HKEY_LOCAL_MACHINE, r'SOFTWARE\Policies\Mozilla\Thunderbird\%s' % reg) print(r'Warning : SOFTWARE\Policies\Mozilla\Thunderbird\%s is missing' % reg)
if value != "1" : return "ERROR"
print("Warning : Thunderbird update is not disable !") elif value != 1:
return "WARNING" print(r'Warning : SOFTWARE\Policies\Mozilla\Thunderbird\%s is %s instead of 1' % (reg,value))
return "ERROR"
return "OK"
if __name__ == '__main__':
update_package()
Loading…
Cancel
Save