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

def main():
    os.system("chmod +x ./install_files/*.py")
    os.chdir("./install_files")
    cmd=""
    dcmd=""
    if(len(sys.argv)==3):
        if(sys.version_info[0] == 2):
            cmd="python install_2x.py"+" "+sys.argv[1] +" "+sys.argv[2]
        if(sys.version_info[0] == 3):
            cmd="python install_3x.py"+" "+sys.argv[1] +" "+sys.argv[2]
        os.system(cmd)
    elif(len(sys.argv)==2) and (sys.argv[1]!="-silent"):
        if(sys.version_info[0] == 2):
            cmd="python install_2x.py"+" "+sys.argv[1]
        if(sys.version_info[0] == 3):
            cmd="python install_3x.py"+" "+sys.argv[1]
        os.system(cmd)
    else:
        if(sys.version_info[0] == 2):
            dcmd="python install_2x.py -s -a -n"
        if(sys.version_info[0] == 3):
            dcmd="python install_3x.py -s -a -n"
        if (len(sys.argv)==2) and (sys.argv[1]=="-silent"):
            dcmd+=" -silent"
        os.system(dcmd)

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