Use YAML formatted variable file
This commit is contained in:
parent
8fb293d0a5
commit
1cd6b61c3d
|
@ -1,5 +1,5 @@
|
||||||
package : fws-firefox-config
|
package : fws-firefox-config
|
||||||
version : 4
|
version : 5
|
||||||
architecture : all
|
architecture : all
|
||||||
section : base
|
section : base
|
||||||
priority : optional
|
priority : optional
|
||||||
|
|
14
setup.py
14
setup.py
|
@ -1,7 +1,5 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from setuphelpers import *
|
from setuphelpers import *
|
||||||
import json
|
|
||||||
from cryptography.fernet import Fernet
|
|
||||||
import os
|
import os
|
||||||
from jinja2 import Environment, FileSystemLoader
|
from jinja2 import Environment, FileSystemLoader
|
||||||
|
|
||||||
|
@ -14,14 +12,16 @@ variables = {
|
||||||
# Read local variables file if available
|
# Read local variables file if available
|
||||||
if isfile(makepath(programfiles32,'wapt','private','symetric.txt')) and isfile(makepath(programfiles32,'wapt','private','variables.txt')):
|
if isfile(makepath(programfiles32,'wapt','private','symetric.txt')) and isfile(makepath(programfiles32,'wapt','private','variables.txt')):
|
||||||
print('Reading local encrypted variables file')
|
print('Reading local encrypted variables file')
|
||||||
|
from cryptography.fernet import Fernet
|
||||||
|
import yaml
|
||||||
f = Fernet(open(makepath(programfiles32,'wapt','private','symetric.txt'),'r').read())
|
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())))
|
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'))
|
filecopyto('autoconf.js',makepath(programfiles,'Mozilla Firefox','defaults','pref'))
|
||||||
filecopyto('override.ini',makepath(programfiles,'Mozilla Firefox'))
|
filecopyto('override.ini',makepath(programfiles,'Mozilla Firefox'))
|
||||||
jinja2 = Environment(
|
jinja2 = Environment(
|
||||||
loader=FileSystemLoader(os.path.dirname(os.path.abspath(__file__))),
|
loader=FileSystemLoader(os.getcwd()),
|
||||||
trim_blocks=True
|
trim_blocks=True
|
||||||
)
|
)
|
||||||
open(makepath(programfiles,'Mozilla Firefox','firefox.cfg'),'w').write(
|
open(makepath(programfiles,'Mozilla Firefox','firefox.cfg'),'w').write(
|
||||||
|
@ -32,9 +32,9 @@ def install():
|
||||||
)
|
)
|
||||||
|
|
||||||
def uninstall():
|
def uninstall():
|
||||||
os.unlink(makepath(programfiles,'Mozilla Firefox','defaults','pref','autoconf.js'))
|
remove_file(makepath(programfiles,'Mozilla Firefox','defaults','pref','autoconf.js'))
|
||||||
os.unlink(makepath(programfiles,'Mozilla Firefox','override.ini'))
|
remove_file(makepath(programfiles,'Mozilla Firefox','override.ini'))
|
||||||
os.unlink(makepath(programfiles,'Mozilla Firefox','firefox.cfg'))
|
remove_file(makepath(programfiles,'Mozilla Firefox','firefox.cfg'))
|
||||||
|
|
||||||
def audit():
|
def audit():
|
||||||
if (
|
if (
|
||||||
|
|
Loading…
Reference in New Issue