#!/usr/bin/env python
import os, sys

pad = "0"
rw = ""
ctr = 0
while ctr < len(sys.argv):
    if sys.argv[ctr].lower() == "--rw":
        rw = "rw"
        del(sys.argv[ctr])
    ctr += 1
ctr = 0
while ctr < len(sys.argv):
    if sys.argv[ctr].lower() == "--2k":
        pad = "1"
        del(sys.argv[ctr])
    ctr += 1

if len(sys.argv) < 3:
    print "Usage: " + sys.argv[0] + " [--rw] [--2k] <filename.ISO.C> <mount_point>"
    print "       --rw:    commit writes to ISO.C file, otherwise discarded on unmount."
    print "                If the ISO.C file does not exist, a new one will be created."
    print "       --2k:    Pad ISO.C to multiple of 2048 bytes                         "
    print "                (for VirtualBox or physical disk only)                      "
    sys.exit()

os.system('"' + sys.argv[0][:sys.argv[0].rfind("/")+1] + 'isoc.py" "' + sys.argv[1] + '" "' + sys.argv[2] + '" "' + rw + '" "' + pad + '" &')
