From 303e7a3b15196e52173f18b15ae65ee7ad61ec0d Mon Sep 17 00:00:00 2001 From: Daniel Berteaud Date: Thu, 27 Aug 2020 18:19:49 +0200 Subject: [PATCH] Support new ESR install dir --- WAPT/control | 23 +++++++++++++++++------ setup.py | 34 +++++++++++++++++++++++++--------- 2 files changed, 42 insertions(+), 15 deletions(-) diff --git a/WAPT/control b/WAPT/control index 824df9f..503c3ac 100644 --- a/WAPT/control +++ b/WAPT/control @@ -1,8 +1,10 @@ package : fws-firefox-config -version : 5 +version : 7 architecture : all section : base priority : optional +name : +categories : maintainer : Daniel Berteaud description : Configuration management for Firefox depends : fws-firefox-esr @@ -20,13 +22,22 @@ description_fr : Gestion de configuration pour Firefox description_pl : description_de : description_es : +description_pt : +description_it : +description_nl : +description_ru : audit_schedule : 2d editor : keywords : licence : MIT homepage : https://www.firewall-services.com/ -package_uuid : -signer : -signer_fingerprint: -signature_date : -signed_attributes : \ No newline at end of file +package_uuid : fee7efec-d482-4299-aeee-1aa35e7f3d3d +valid_from : +valid_until : +forced_install_on : +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 \ No newline at end of file diff --git a/setup.py b/setup.py index 9320f63..ffd6466 100644 --- a/setup.py +++ b/setup.py @@ -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()))) def install(): - filecopyto('autoconf.js',makepath(programfiles,'Mozilla Firefox','defaults','pref')) - filecopyto('override.ini',makepath(programfiles,'Mozilla Firefox')) + 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: + error('Firefox installation dir not found') + + filecopyto('autoconf.js',makepath(dest,'defaults','pref')) + filecopyto('override.ini',dest) jinja2 = Environment( loader=FileSystemLoader(os.getcwd()), 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( firefox_config_url = variables['firefox_config_url'], firefox_config_append_domain = variables['firefox_config_append_domain'] @@ -32,15 +39,24 @@ def install(): ) def uninstall(): - remove_file(makepath(programfiles,'Mozilla Firefox','defaults','pref','autoconf.js')) - remove_file(makepath(programfiles,'Mozilla Firefox','override.ini')) - remove_file(makepath(programfiles,'Mozilla Firefox','firefox.cfg')) + for dir in ['Mozilla Firefox', 'Mozilla Firefox ESR']: + remove_file(makepath(programfiles,dir,'defaults','pref','autoconf.js')) + remove_file(makepath(programfiles,dir,'override.ini')) + remove_file(makepath(programfiles,dir,'firefox.cfg')) 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 ( - not isfile(makepath(programfiles,'Mozilla Firefox','defaults','pref','autoconf.js')) or - not isfile(makepath(programfiles,'Mozilla Firefox','override.ini')) or - not isfile(makepath(programfiles,'Mozilla Firefox','firefox.cfg')) + not isfile(makepath(dest,'defaults','pref','autoconf.js')) or + not isfile(makepath(dest,'override.ini')) or + not isfile(makepath(dest,'firefox.cfg')) ): print('At least one config file is missing') return "ERROR"