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

import shutil
import parted
import subprocess
import optparse
import tempfile


def main():
    def parse():
        pass

    def usage():
        pass

    def cleanup():
        pass


    def mount(src, dst):
        if os.path.exists(src):
            if not os.path.exists(dst):
                os.makedir(dst)
            args = ("/bin/mount", src, dst)
            rc = subprocess.call(args)
            return rc
        return


    def umount(src):
        if os.path.exists(src):
                args = ("/bin/umount", src)
                rc = subprocess.call(args)
                return rc
        return


    def copy(src, dst):
        if os.path.exists(src):
            shutil.copy(src, dst)


    def move(src, dst):
        if os.path.exists(src):
            shutil.mopve(src, dst)

    
    def losetup(src, dst, offset=None):
        if os.path.exists(src):
            if os.path.exists(dst):
                if offset is None:
                    args = ("/sbin/losetup", src, dst)
                else:
                    args = ("/sbin/losetup", "-o", offset, src, dst)
                rc = subprocess.call(args)
        return rc
    

    def mkimage(bs, count):
        tmp = tempfile.mkstemp()
        image = tmp[1]
        args = ("/bin/dd", "if=/dev/zero", 
                 "of=%s", "bs=%s", "count=%s" %image, bs, count)
        rc = subprocess.call(args)
        return image

    
    
     
    parse(sys.argv[1], sys.argv[2], sys.argv[3])

    def setup():
        pass

if __name__ == "__main__":
    sys.exit(main())
