import os
import sys
import shellcolor
import setup
import install
import upgrade
import remove
import datetime
if  os.geteuid()==0:
    if len(sys.argv) == 2:
        if 'install' == sys.argv[1]:
            if os.path.exists('/etc/cpnginx/version'):
                upgrade.start()
            else:
                install.start()
        elif 'remove' == sys.argv[1]:
            remove.start()
        else:
            sys.stdout.write("Unknown command\n")
            sys.exit(2)
            sys.exit(0)
    else:
        now = datetime.datetime.now()
        sys.stdout.write("Copyright (C) 2009-"+str(now.year)+", Syslint Technologies India(P) LTD.")
        sys.stdout.write("""
                            _                                       
  ___  _ __   _ __    __ _ (_) _ __  __  __    ___  ___   _ __ ___  
 / __|| '_ \ | '_ \  / _` || || '_ \ \ \/ /   / __|/ _ \ | '_ ` _ \ 
| (__ | |_) || | | || (_| || || | | | >  <  _| (__| (_) || | | | | |
 \___|| .__/ |_| |_| \__, ||_||_| |_|/_/\_\(_)\___|\___/ |_| |_| |_|
      |_|            |___/                                          
        
        """)

        sys.stdout.write("\nCpnginx auto installer and uninstaller script")
        sys.stdout.write("\nVisit : https://cpnginx.com ")
        sys.stdout.write("\nUsage: %s install | remove \n" % sys.argv[0])
        sys.exit(2)
else:
    sys.stdout.write("Cpnginx auto installer\n")
    sys.exit(2)

