28 lines
672 B
Python
28 lines
672 B
Python
"""Simple test for pycdlib
|
|
|
|
Extract the volid from the iso and compare it to the one passed on the cmdline
|
|
"""
|
|
import os
|
|
import sys
|
|
import pycdlib
|
|
from pycdlib.pycdlibexception import PyCdlibException
|
|
|
|
if len(sys.argv) != 3:
|
|
print("usage: %s file.iso volid" % (sys.argv[0]))
|
|
sys.exit(1)
|
|
|
|
try:
|
|
iso = pycdlib.PyCdlib()
|
|
iso.open(sys.argv[1])
|
|
volid = iso.pvd.volume_identifier.decode("UTF-8").strip()
|
|
except PyCdlibException as e:
|
|
print("ERROR: Problem reading label from %s: %s" % (self.iso_path, e))
|
|
sys.exit(1)
|
|
|
|
print("VOLID: %s" % volid)
|
|
if volid != sys.argv[2]:
|
|
print("ERROR: %s != %s" % (volid, sys.argv[2]))
|
|
sys.exit(1)
|
|
|
|
sys.exit(0)
|