Example #1
0
def get_mirrors():
    print_console("Fetching list of cygwin mirrors")
    mirrors = urllib2.urlopen(CYGWIN_MIRRORS_URL)

    mirrorlist = list()

    for line in mirrors:
        toke = line.split(";")
        url = toke[0]
        name = toke[1]
        country = toke[2]
        state = toke[3]
        mirror = (url, name, country, state)
        mirrorlist.append(mirror)

    return mirrorlist
Example #2
0
def get_mirrors():
	print_console("Fetching list of cygwin mirrors")
	mirrors=urllib2.urlopen(CYGWIN_MIRRORS_URL) 
	
	mirrorlist=list()

	for line in mirrors:
		toke=line.split(";")
		url=toke[0]
		name=toke[1]
		country=toke[2]
		state=toke[3]
		mirror=(url,name,country,state)
		mirrorlist.append(mirror)

	return mirrorlist	
Example #3
0
def cygwin_untar(windows_path,
                 filename,
                 directory="/home/BIRCH",
                 noroot=False):
    global member_total
    global member_count

    tarball = tarfile.open(windows_path)

    print_console("Calculating tar info, this may take some time")
    info = tarball.getmembers()
    tarball.close()

    member_total = len(info)
    member_count = 0
    print_console("There are " + str(member_total) + " members in " + filename)
    CONSOLE.setProgress(0)
    print_console("Beginning the extraction process")

    cmd = "cd " + directory + " && tar -xvpf " + filename

    cygwin_exec(cmd, callbackfunc=untar_callback, verbosity=False)

    print_console("Extracted " + str(member_count) + " members from archive.")
    if (noroot == True):
        if (info[0].name.find("pax_global_header") >= 0):
            print_console("Trimming global header")
            info.pop(0)
        rootpath = info.pop(0)
        print_console("Using " + rootpath.name + " as root tar dir.")

        contents = os.listdir(rootpath.name)
        for each in contents:
            print_console("Moving " + each + " to rebased root path.")
            shutil.move(rootpath.name + "/" + each, os.getcwd() + "/" + each)

        shutil.rmtree(rootpath.name)

    member_count = 0
    member_total = 0

    CONSOLE.setProgress(0)
    CONSOLE.hideProgress()
Example #4
0
def install_cygwin():
    cwd = os.getcwd()
    os.chdir(ARGS.install_dir)

    COMMAND = quote_dos_path(
        ARGS.install_dir
    ) + "/setup.exe" + " " + DEFAULT_OPTIONS + " -l " + quote_dos_path(
        ARGS.CYGPAK_DIR) + " -R " + quote_dos_path(
            ARGS.CYGWIN_DIR) + " -P subversion,wget,tcsh,python "
    print_console("Using command: " + COMMAND)

    while (not os.path.lexists(
            ARGS.CYGWIN_DIR)):  #this is for windows 7, keep nagging for auth
        output = stream_exec(COMMAND, verbose=False)

    print_console("Linking BIRCH into home directory")
    cygwin_exec("cd /home && ln -s " + quote_dos_path(ARGS.install_dir) +
                " /home/BIRCH")
    cygwin_exec("cd && ln -s /home/BIRCH ")

    if (os.path.lexists(ARGS.install_dir + "/cyghead")):
        print_console("Setting up cygwin to work with windows java")
        print_console("Installing easy_install and cygwinreg")
        cygwin_exec("cd /home/BIRCH/cyghead && sh " + EGGFILE)
        cygwin_exec("easy_install cygwinreg")

        cygwin_exec("mv /home/BIRCH/cyghead/java_bridge /bin/java")
        cygwin_exec("mv /home/BIRCH/cyghead/browser_bridge /bin/browser")
        cygwin_exec("mv /home/BIRCH/cyghead/apt-get /bin/apt-get")

        cygwin_exec("chmod +x /bin/java")
        cygwin_exec("chmod +x /bin/browser")
        cygwin_exec("chmod +x /bin/apt-cyg")
        print_console("Finished installing cygwin java compatability layer")
    else:
        print_console("Error! cyghead not found")
        raise Exception
    os.chdir(cwd)
Example #5
0
def cygwin_untar(windows_path,filename, directory ="/home/BIRCH",noroot=False):
	global member_total
	global member_count

	tarball = tarfile.open(windows_path)

	print_console("Calculating tar info, this may take some time")
	info=tarball.getmembers()
	tarball.close()

	member_total=len(info)
	member_count=0
	print_console("There are "+str(member_total)+ " members in "+filename)
	CONSOLE.setProgress(0)
	print_console("Beginning the extraction process")
			
	cmd = "cd "+directory+" && tar -xvpf "+filename
	
	cygwin_exec(cmd,callbackfunc=untar_callback,verbosity=False)

	print_console("Extracted "+str(member_count)+ " members from archive.")
	if (noroot==True):
		if (info[0].name.find("pax_global_header")>=0):
			print_console("Trimming global header")
			info.pop(0)
		rootpath=info.pop(0)
		print_console("Using "+rootpath.name+" as root tar dir.")

		contents=os.listdir(rootpath.name)
		for each in contents:
			print_console("Moving "+each+" to rebased root path.")
			shutil.move(rootpath.name+"/"+each,os.getcwd()+"/"+each)

		shutil.rmtree(rootpath.name)

	member_count=0
	member_total=0

	CONSOLE.setProgress(0)
	CONSOLE.hideProgress()
Example #6
0
def install_cygwin():
	cwd=os.getcwd()
	os.chdir(ARGS.install_dir)

	COMMAND=quote_dos_path(ARGS.install_dir)+"/setup.exe"+" "+DEFAULT_OPTIONS+" -l " + quote_dos_path(ARGS.CYGPAK_DIR) + " -R " + quote_dos_path(ARGS.CYGWIN_DIR)+" -P subversion,wget,tcsh,python "
	print_console("Using command: "+COMMAND)

	while (not os.path.lexists(ARGS.CYGWIN_DIR)):#this is for windows 7, keep nagging for auth
		output=stream_exec(COMMAND,verbose=False)



	print_console("Linking BIRCH into home directory")
	cygwin_exec("cd /home && ln -s "+quote_dos_path(ARGS.install_dir)+" /home/BIRCH")
	cygwin_exec("cd && ln -s /home/BIRCH ")

	if (os.path.lexists(ARGS.install_dir+"/cyghead") ):	
		print_console("Setting up cygwin to work with windows java")
		print_console("Installing easy_install and cygwinreg")
		cygwin_exec("cd /home/BIRCH/cyghead && sh "+EGGFILE)
		cygwin_exec("easy_install cygwinreg")

		cygwin_exec("mv /home/BIRCH/cyghead/java_bridge /bin/java")
		cygwin_exec("mv /home/BIRCH/cyghead/browser_bridge /bin/browser")
		cygwin_exec("mv /home/BIRCH/cyghead/apt-get /bin/apt-get")

		cygwin_exec("chmod +x /bin/java")
		cygwin_exec("chmod +x /bin/browser")
		cygwin_exec("chmod +x /bin/apt-cyg")
		print_console("Finished installing cygwin java compatability layer")
	else:
		print_console("Error! cyghead not found")
		raise Exception
	os.chdir(cwd)