Support new ESR install dir

master
Daniel Berteaud 4 years ago
parent 5a723db283
commit 303e7a3b15
  1. 23
      WAPT/control
  2. 34
      setup.py

@ -1,8 +1,10 @@
package : fws-firefox-config package : fws-firefox-config
version : 5 version : 7
architecture : all architecture : all
section : base section : base
priority : optional priority : optional
name :
categories :
maintainer : Daniel Berteaud maintainer : Daniel Berteaud
description : Configuration management for Firefox description : Configuration management for Firefox
depends : fws-firefox-esr depends : fws-firefox-esr
@ -20,13 +22,22 @@ description_fr : Gestion de configuration pour Firefox
description_pl : description_pl :
description_de : description_de :
description_es : description_es :
description_pt :
description_it :
description_nl :
description_ru :
audit_schedule : 2d audit_schedule : 2d
editor : editor :
keywords : keywords :
licence : MIT licence : MIT
homepage : https://www.firewall-services.com/ homepage : https://www.firewall-services.com/
package_uuid : package_uuid : fee7efec-d482-4299-aeee-1aa35e7f3d3d
signer : valid_from :
signer_fingerprint: valid_until :
signature_date : forced_install_on :
signed_attributes : changelog :
signer : Daniel Berteaud
signer_fingerprint: 3c9415559e2dedbc4390e3faa2c28d3b67265baa5b35902d2764d9e41c3b3f0a
signature : q1R2Da2W0Fq87PeVSNAwwrl+6CzPDytgOwTR39tZAghIbtBOLcbcz84HKPOzSIfewGBViFhC3LDSxlMmeeGWzFhWRieCBMFVcGWhCNTPcELBsgBzm4gNpvlpWRcPXA0v1biTtT3fJBjQSgJveoNriT/sOZy9bjtJWQXYQkjrSSfbyyalGMM/1ckpvYX7QRwrt8pqWGpqoKWsAHdqFVtDc2npBSyhRkMojVD0ZsxR3Y552DUWuO57DRF3PuDETRq3oXZr1kvgr5gj/G3Y/ngJJjLCwFRvbMVjSp4Tau/MNjqOqOoV4zCKFPJEJ9TDsH0dSoNRGdtce5dua3p8dfjIlQ==
signature_date : 2020-08-27T18:19:20.042000
signed_attributes : package,version,architecture,section,priority,name,categories,maintainer,description,depends,conflicts,maturity,locale,target_os,min_os_version,max_os_version,min_wapt_version,sources,installed_size,impacted_process,description_fr,description_pl,description_de,description_es,description_pt,description_it,description_nl,description_ru,audit_schedule,editor,keywords,licence,homepage,package_uuid,valid_from,valid_until,forced_install_on,changelog,signer,signer_fingerprint,signature_date,signed_attributes

@ -18,13 +18,20 @@ if isfile(makepath(programfiles32,'wapt','private','symetric.txt')) and isfile(m
variables.update(yaml.safe_load(f.decrypt(open(makepath(programfiles32,'wapt','private','variables.txt'),'r').read()))) variables.update(yaml.safe_load(f.decrypt(open(makepath(programfiles32,'wapt','private','variables.txt'),'r').read())))
def install(): def install():
filecopyto('autoconf.js',makepath(programfiles,'Mozilla Firefox','defaults','pref')) if isdir(makepath(programfiles,'Mozilla Firefox ESR')):
filecopyto('override.ini',makepath(programfiles,'Mozilla Firefox')) dest=makepath(programfiles,'Mozilla Firefox ESR')
elif isdir(makepath(programfiles,'Mozilla Firefox')):
dest=makepath(programfiles,'Mozilla Firefox')
else:
error('Firefox installation dir not found')
filecopyto('autoconf.js',makepath(dest,'defaults','pref'))
filecopyto('override.ini',dest)
jinja2 = Environment( jinja2 = Environment(
loader=FileSystemLoader(os.getcwd()), loader=FileSystemLoader(os.getcwd()),
trim_blocks=True trim_blocks=True
) )
open(makepath(programfiles,'Mozilla Firefox','firefox.cfg'),'w').write( open(makepath(dest,'firefox.cfg'),'w').write(
jinja2.get_template('firefox.cfg.j2').render( jinja2.get_template('firefox.cfg.j2').render(
firefox_config_url = variables['firefox_config_url'], firefox_config_url = variables['firefox_config_url'],
firefox_config_append_domain = variables['firefox_config_append_domain'] firefox_config_append_domain = variables['firefox_config_append_domain']
@ -32,15 +39,24 @@ def install():
) )
def uninstall(): def uninstall():
remove_file(makepath(programfiles,'Mozilla Firefox','defaults','pref','autoconf.js')) for dir in ['Mozilla Firefox', 'Mozilla Firefox ESR']:
remove_file(makepath(programfiles,'Mozilla Firefox','override.ini')) remove_file(makepath(programfiles,dir,'defaults','pref','autoconf.js'))
remove_file(makepath(programfiles,'Mozilla Firefox','firefox.cfg')) remove_file(makepath(programfiles,dir,'override.ini'))
remove_file(makepath(programfiles,dir,'firefox.cfg'))
def audit(): def audit():
if isdir(makepath(programfiles,'Mozilla Firefox ESR')):
dest=makepath(programfiles,'Mozilla Firefox ESR')
elif isdir(makepath(programfiles,'Mozilla Firefox')):
dest=makepath(programfiles,'Mozilla Firefox')
else:
print('Firefox installation dir not found')
return "ERROR"
if ( if (
not isfile(makepath(programfiles,'Mozilla Firefox','defaults','pref','autoconf.js')) or not isfile(makepath(dest,'defaults','pref','autoconf.js')) or
not isfile(makepath(programfiles,'Mozilla Firefox','override.ini')) or not isfile(makepath(dest,'override.ini')) or
not isfile(makepath(programfiles,'Mozilla Firefox','firefox.cfg')) not isfile(makepath(dest,'firefox.cfg'))
): ):
print('At least one config file is missing') print('At least one config file is missing')
return "ERROR" return "ERROR"

Loading…
Cancel
Save