summaryrefslogtreecommitdiffstats
path: root/tools/basebuilder.py
blob: a9ab6b288d2419257a4bd5dca7ad5a75609ec55e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/usr/bin/env python

from sys import argv
from elementtree.ElementTree import Element, SubElement, tostring

if __name__ == '__main__':
    dir = argv[1]
    imagename = dir.split('/')[-1]
    e = Element("Image", name=imagename)
    for line in open("%s/base.ConfigFile" % (dir)).readlines():
        SubElement(e, "ConfigFile", name=line.strip())
    for line in open("%s/base.Package" % (dir)).readlines():
        SubElement(e, "Package", name=line.strip())
    for line in open("%s/base.Service" % (dir)).readlines():
        SubElement(e, "Service", name=line.strip().split()[0])

    print(tostring(e))