diff options
| author | Rajarshi Das <drajarshi@in.ibm.com> | 2016-09-21 21:55:39 +0530 |
|---|---|---|
| committer | Santosh Sivaraj <santosiv@in.ibm.com> | 2016-12-09 10:48:27 +0530 |
| commit | 33a362c8afa5e72df379e441563bde389bb017f4 (patch) | |
| tree | 8a294e9c6cedf56564d908522f7858a24fe478de /catalog/catalog.py | |
| parent | bec99529562b22d8355f18c3c38a478f64eebb37 (diff) | |
| download | ima-catalog-33a362c8afa5e72df379e441563bde389bb017f4.tar.gz ima-catalog-33a362c8afa5e72df379e441563bde389bb017f4.zip | |
Add support to generate DTS file from catalog lid
Also include a readme.
Signed-off-by: Rajarshi Das <drajarshi@in.ibm.com>
Signed-off-by: Santosh Sivaraj <santosh@santosiv@in.ibm.com>
Diffstat (limited to 'catalog/catalog.py')
| -rw-r--r-- | catalog/catalog.py | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/catalog/catalog.py b/catalog/catalog.py index cb5e9aa..f1bf056 100644 --- a/catalog/catalog.py +++ b/catalog/catalog.py @@ -1,3 +1,14 @@ +#!/usr/bin/python +# +# Copyright (C) 2016 Santosh Sivaraj <santosiv@in.ibm.com> +# Copyright (C) 2016 Rajarshi Das <drajarshi@in.ibm.com> +# Copyright (C) 2016 IBM Corporation +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version +# 2 of the License, or (at your option) any later version. + import struct import time import sys @@ -6,6 +17,7 @@ from common import * from events import pack_events from groups import pack_groups from formulae import pack_formulae +from generate_dts import gen_dts def dump_schema(cat_file): f = open(cat_file) @@ -52,14 +64,21 @@ def create_catalog(version, old_lid): if __name__ == "__main__": if len(sys.argv) <= 3: print "Usage: ./%s version old_lid out_file" % (sys.argv[0]) + print "\nThe new LID and DTS files will be named as <out_file>.lid and <out_file>.dts" exit(1) + lid_filename = str(sys.argv[3]) + '.lid' + dts_filename = str(sys.argv[3]) + '.dts' + # get the version for the new build, and older catalog file to extract the # schema data c = create_catalog(int(sys.argv[1]), sys.argv[2]) padlen = 64 - len(c) / PAGE_SIZE c += struct.pack('%dx' % (padlen * PAGE_SIZE)) - f = open(sys.argv[3], 'wt') + f = open(lid_filename, 'wt') f.write(c) f.close() + + # Specify input filename (new lid), verbose flag, and dts output filename + gen_dts(lid_filename, False, dts_filename) |

