summaryrefslogtreecommitdiff
path: root/onlineupdate
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2017-07-24 23:15:33 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2017-08-01 00:01:09 +0200
commitc210d7cc092616ecdd1072f1238ec3b619f7387b (patch)
treed41384089a608d65be27cedbb2dfc21b609a5697 /onlineupdate
parent6de75d132fe44a6f3e6160fec0c2e5e32ed023d3 (diff)
make it easier to debug the generation of certificate data
Change-Id: I86e3c3254cef297c46a8ca377b5ceb36b348e2b3 Reviewed-on: https://gerrit.libreoffice.org/40607 Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com> Tested-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Diffstat (limited to 'onlineupdate')
-rwxr-xr-xonlineupdate/source/update/updater/gen_cert_header.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/onlineupdate/source/update/updater/gen_cert_header.py b/onlineupdate/source/update/updater/gen_cert_header.py
index a75af1e295fb..3f3798cfb425 100755
--- a/onlineupdate/source/update/updater/gen_cert_header.py
+++ b/onlineupdate/source/update/updater/gen_cert_header.py
@@ -1,5 +1,7 @@
#!/usr/bin/env python
+from __future__ import print_function
+import os
import sys
import binascii
@@ -13,6 +15,9 @@ def file_byte_generator(filename):
block = f.read()
return block
+def eprint(*args, **kwargs):
+ print(*args, file=sys.stderr, **kwargs)
+
def create_header(array_name, in_filename):
if sys.version_info >= (3,0):
hexified = ["0x" + binascii.hexlify(bytes([inp])).decode('ascii') for inp in file_byte_generator(in_filename)]
@@ -25,8 +30,13 @@ def create_header(array_name, in_filename):
if __name__ == '__main__':
if len(sys.argv) < 3:
- print('ERROR: usage: gen_cert_header.py array_name update_config_file')
- sys.exit(1);
+ eprint('ERROR: usage: gen_cert_header.py array_name update_config_file')
+ sys.exit(1)
+
+ if not os.path.exists(sys.argv[2]):
+ eprint('The config file %s does not exist'%(sys.argv[2]))
+ sys.exit(1)
+
config = ConfigParser()
config.read(sys.argv[2])
sys.exit(create_header(sys.argv[1], config.get('Updater', 'certificate-der')))