2 '''This script will cleanup resources allocated by unpack_image.py
6 from subprocess import call
10 '''Umount a mount point at path
12 if not os.path.isdir(path) or not os.path.ismount(path):
15 cmd = ['sudo', 'umount', '-l', path]
16 print "Umounting", path, "..."
21 '''Release loop dev at val
23 devloop, filename = val.split(':', 1)
24 print "Releasing %s(%s)" % (devloop, filename), "..."
29 # cleanup mountpoint in reverse order
30 lines = sys.stdin.readlines()
39 key, val = line.strip().split(':', 1)
43 print >> sys.stderr, "Have no idea to release:", line,
46 if __name__ == '__main__':