mkMiniXML.py revision c68f68e340b20c00117a171804c9ed93c6306ac9
################################################################################
# Creates MiniMods xml descriptions for HetsLiveCD.
# MiniMods are used to extend a MainMod. In this case they are used to map
# complete directories to the root filesystem.
#
# Author: Thiemo Wiedemeyer
# E-Mail: raider@informatik.uni-bremen.de
################################################################################
##
# creates a MiniMod xml description with the givin name. All files and
# directories from source are mapped through the base directory dest on the
# LiveCD.
# @param name Name of the MiniMod.
# @param source Source directory that should be mapped.
# @param dest Base directory on the LiveCD where the source directory should
# appear.
printStart("Creating mini mod xml file...")
printInfo("writing head to file...")
printInfo("writing tail to file...")
printInfo("closing file...")
return
##
# Adds all content from source directory to the dest directory on the LiveCD.
# @param xml Opened fileobject of the xml file.
# @param source Source directory that should be mapped.
# @param dest Base directory on the LiveCD where the source directory should
# appear.
##
# Return the xml string for a file mapping from source to dest.
# @param source Source path of a file that should be mapped.
# @param dest Destination path of the mapping.
# @return The xml string for the mapping.
return \
" <local>\n" +\
" </local>\n"
##
# Return the head of the MiniMod xml file.
# @param name Name of the MiniMod.
# @return A xml string containing the header.
def createHead(name):
return \
"<comps>\n" +\
" <group>\n" +\
" <minimod>\n" +\
" <version>0.0.1</version>\n" +\
" <description>Created for HetsLiveCD</description>\n" +\
" <minitag>%s</minitag>\n" % (name) +\
" <maintag>ALL</maintag>\n" +\
" <bootoption>ALL</bootoption>\n" +\
" <root>\n" +\
" <files>\n"
##
# Return the tail of the MiniMod xml file.
# @return A xml string containing the footer.
def createTail():
return \
" </files>\n" +\
" </root>\n" +\
" </minimod>\n" +\
" </group>\n" +\
"</comps>\n"
##
# Converts some character to the xml representation.
# @param str Sting to convert.
# @return Converted string.
def convertStr(str):
return str
##
# Prints a usage message to the console.
#
def usage():
print "Usage:"
print "Options: Description:"
print " name name of the mini mod."
print " source directory containing the files that should be stored in the mini mod."
print " dest destination on the live cd filesystem, where the files should appear."
return
if __name__ == "__main__":
# Check argument count
print "Wrong parameter count."
usage()
# Check if second argument is a valid directory
print "Parameter is no existing directory."
usage()
# Start xml creation