summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Albert <albertj@us.ibm.com>2015-03-06 22:25:37 -0600
committerJason Albert <albertj@us.ibm.com>2015-03-06 22:25:37 -0600
commitef5b8a921a30859af9fce913ef5733cad20cdb73 (patch)
tree60bce5ac372e4631f6fd0c7a9dc3ac90ba400119
parent6bc1fc8dbc24b630515f67b2dbdb2f0553d8935c (diff)
downloadvpdtools-ef5b8a921a30859af9fce913ef5733cad20cdb73.tar.gz
vpdtools-ef5b8a921a30859af9fce913ef5733cad20cdb73.zip
Added writing of binary files for each record
-rwxr-xr-xcreateVpd.py18
1 files changed, 14 insertions, 4 deletions
diff --git a/createVpd.py b/createVpd.py
index cfdd5cd..92d29d3 100755
--- a/createVpd.py
+++ b/createVpd.py
@@ -207,9 +207,6 @@ if (cmdline.parseOption("-h","--help")):
help()
exit(0)
-# Debug printing
-clDebug = cmdline.parseOption("-d", "--debug")
-
# We could possibly run in two different modes
# 1) manifest mode - the user passes in one xml file that gives all the required input args
# 2) cmdline mode - the user passes in multiple command line args that recreate what would be in the manifest
@@ -240,9 +237,15 @@ else:
# Error check the command line
if (clErrors):
- out.error("Missing/incorrect cmdline args! Please review the output above to determine which ones!")
+ out.error("Missing/incorrect required cmdline args! Please review the output above to determine which ones!")
exit(clErrors)
+# Debug printing
+clDebug = cmdline.parseOption("-d", "--debug")
+
+# Create separate binary files for each record
+clBinaryRecords = cmdline.parseOption("-b", "--binary-records")
+
# All cmdline args should be processed, so if any left throw an error
if (len(sys.argv) != 1):
out.error("Extra cmdline args detected - %s" % (sys.argv[1:])) # [1:] don't inclue script name in the list
@@ -675,6 +678,13 @@ writeDataToVPD(vpdFile, recordInfo["VTOC"].record)
for record in manifest.iter("record"):
recordName = record.attrib.get("name")
writeDataToVPD(vpdFile, recordInfo[recordName].record)
+ # If the user wanted discrete binary files for each record writen out, we'll do it here
+ if (clBinaryRecords):
+ rvpdFileName = clOutputPath + "/" + vpdName + "-" + recordName + ".vpd"
+ out.msg("Wrote record vpd file: %s" % rvpdFileName)
+ rvpdFile = open(rvpdFileName, "wb")
+ rvpdFile.write(recordInfo[recordName].record)
+ rvpdFile.close()
# Write the VTOC ECC
writeDataToVPD(vpdFile, recordInfo["VTOC"].ecc)
OpenPOWER on IntegriCloud