Example #1
0
	def lightsOut(self):
		import rocks.installcgi
		import rocks.roll
		
		installcgi = rocks.installcgi.InstallCGI()
		generator = rocks.roll.Generator()

		generator.parse('/tmp/rolls.xml')
		rollList = generator.rolls

		os.environ['PYTHONPATH'] = '/tmp/updates/usr/share/createrepo'
		for roll in rollList:
			installcgi.getKickstartFiles(roll)

		installcgi.rebuildDistro(rollList)

		return
Example #2
0
    def lightsOut(self):
        import rocks.installcgi
        import rocks.roll

        installcgi = rocks.installcgi.InstallCGI()
        generator = rocks.roll.Generator()

        generator.parse('/tmp/rolls.xml')
        rollList = generator.rolls

        os.environ['PYTHONPATH'] = '/tmp/updates/usr/share/createrepo'
        for roll in rollList:
            installcgi.getKickstartFiles(roll)

        installcgi.rebuildDistro(rollList)

        return
Example #3
0
def RocksGetRolls(anaconda):
    #
    # download the selected rolls
    #

    #
    # if there isn't a /tmp/rolls.xml file or if this is a client install,
    # then there is are no rolls to fetch -- so return
    #
    media = rocks.media.Media()

    if not os.path.exists('/tmp/rolls.xml'):
        if media.mounted():
            media.ejectCD()
        return

    #
    # in a default installation, make sure /export points to a partition
    # *not* on the '/' partition
    #
    cwd = os.getcwd()
    os.chdir('/mnt/sysimage')

    if not os.path.exists('state'):
        os.mkdir('state')
    if not os.path.exists('state/partition1'):
        os.mkdir('state/partition1')

    try:
        os.symlink('state/partition1', 'export')
    except:
        pass
    os.chdir(cwd)

    #
    # get the roll list by parsing /tmp/rolls.xml
    #
    generator = rocks.roll.Generator()
    generator.parse('/tmp/rolls.xml')

    cwd = os.getcwd()

    #
    # get all the CD-based rolls first
    #
    diskids = []
    for roll in generator.rolls:
        (name, version, arch, url, diskid) = roll

        if diskid != '' and diskid not in diskids:
            diskids.append(diskid)

    diskids.sort()
    for d in diskids:
        #
        # ask the user to put the right media in the bay
        #
        checkCD(anaconda, media, d)

        #
        # then, for each selected roll on this disk, copy it
        #
        for roll in generator.rolls:
            (name, version, arch, url, diskid) = roll
            if diskid == d:
                downloadRoll(anaconda, roll)

    if media.mounted():
        media.ejectCD()

    #
    # now get all the network rolls
    #
    for roll in generator.rolls:
        (rollname, rollversion, rollarch, rollurl, diskid) = roll

        if diskid != '':
            continue

        downloadRoll(anaconda, roll)

    os.chdir(cwd)

    #
    # rebuild the distro
    #
    w = anaconda.intf.waitWindow(_("Rocks-Dist"),
                                 _("Rebuilding the Distribution..."))

    cmd = '/opt/rocks/bin/rocks report distro'
    for line in os.popen(cmd).readlines():
        distrodir = line[:-1]

    rootdir = '/mnt/sysimage/%s' % (distrodir)

    path = ''
    try:
        path = os.environ['PATH']
    except:
        pass

    #
    # need this path so rocks-dist uses the 'rpm' binary from the rocks
    # path and not the 'busybox' rpm
    #
    os.environ['PATH'] = '/mnt/runtime/rocks/bin:' + path

    installcgi = rocks.installcgi.InstallCGI(rootdir)
    installcgi.createPopt()
    installcgi.rebuildDistro(generator.rolls)

    #
    # make sure the link to the repository is correct for the package
    # installation portion of the install
    #
    arch = os.uname()[4]
    if arch in ['i386', 'i486', 'i586', 'i686']:
        arch = 'i386'

    subprocess.call('umount /mnt/cdrom', shell=True)
    subprocess.call('rm -rf /mnt/cdrom', shell=True)
    dir = '/mnt/sysimage/%s/rocks-dist/%s/' % (distrodir, arch)
    subprocess.call('ln -s %s /mnt/cdrom' % (dir), shell=True)

    w.pop()

    return
Example #4
0
def RocksGetRolls():
	#
	# download the selected rolls
	#

	#
	# if there isn't a /tmp/rolls.xml file or if this is a client install,
	# then there is are no rolls to fetch -- so return
	#
	media = rocks.media.Media()

	if not os.path.exists('/tmp/rolls.xml'):
		if media.mounted():
			media.ejectCD()
		return

	#
	# in a default installation, make sure /export points to a partition
	# *not* on the '/' partition
	#
	cwd = os.getcwd()
	os.chdir(iutil.getSysroot())

	if not os.path.exists('state'):
		os.mkdir('state')
	if not os.path.exists('state/partition1'):
		os.mkdir('state/partition1')

	try:
		os.symlink('state/partition1', 'export')
	except:
		pass
	os.chdir(cwd)

	#
	# get the roll list by parsing /tmp/rolls.xml
	#
	generator = rocks.roll.Generator()
	generator.parse('/tmp/rolls.xml')

	cwd = os.getcwd()

	#
	# get all the CD-based rolls first
	#
	diskids = []
	for roll in generator.rolls:
		(name, version, arch, url, diskid) = roll

		if diskid != ''  and diskid != 'None' and diskid not in diskids:
			diskids.append(diskid)

	diskids.sort()
	for d in diskids:
		#
		# ask the user to put the right media in the bay
		#
		checkCD(media, d)

		#
		# then, for each selected roll on this disk, copy it
		#
		for roll in generator.rolls:
			(name, version, arch, url, diskid) = roll
			if diskid == d:
				downloadRoll(anaconda, roll)

	if media.mounted():
		media.ejectCD()

	#
	# now get all the network rolls
	#
	for roll in generator.rolls:
		(rollname, rollversion, rollarch, rollurl, diskid) = roll

		if diskid != 'None':
			continue

		downloadRoll(roll)

	os.chdir(cwd)

	#
	# rebuild the distro
	#
	progress_message(_("Rebuilding the Rocks Distribution..."))

	cmd = '/opt/rocks/bin/rocks report distro'
	for line in os.popen(cmd).readlines():
		distrodir = line[:-1]

	rootdir = '%s/%s' % (iutil.getSysroot(),distrodir)
	
	path = ''
	try:
		path = os.environ['PATH']
	except:
		pass

	#
	# need this path so rocks-dist uses the 'rpm' binary from the rocks
	# path and not the 'busybox' rpm
	#
	os.environ['PATH'] = '/mnt/runtime/rocks/bin:' + path

	installcgi = rocks.installcgi.InstallCGI(rootdir)
	installcgi.createPopt()
	installcgi.rebuildDistro(generator.rolls)

	#
	# make sure the link to the repository is correct for the package
	# installation portion of the install
	#
	arch = os.uname()[4]
	if arch in ['i386', 'i486', 'i586', 'i686']:
		arch = 'i386'

	subprocess.call('umount /mnt/cdrom', shell=True)
	subprocess.call('rm -rf /mnt/cdrom', shell=True)
	dir = '/mnt/sysimage/%s/rocks-dist/%s/' % (distrodir, arch)
	subprocess.call('ln -s %s /mnt/cdrom' % (dir), shell=True)

	return
Example #5
0
def RocksGetRolls(anaconda):
    #
    # download the selected rolls
    #

    #
    # if there isn't a /tmp/rolls.xml file or if this is a client install,
    # then there is are no rolls to fetch -- so return
    #
    media = rocks.media.Media()

    if not os.path.exists("/tmp/rolls.xml"):
        if media.mounted():
            media.ejectCD()
        return

        #
        # in a default installation, make sure /export points to a partition
        # *not* on the '/' partition
        #
    cwd = os.getcwd()
    os.chdir("/mnt/sysimage")

    if not os.path.exists("state"):
        os.mkdir("state")
    if not os.path.exists("state/partition1"):
        os.mkdir("state/partition1")

    try:
        os.symlink("state/partition1", "export")
    except:
        pass
    os.chdir(cwd)

    #
    # get the roll list by parsing /tmp/rolls.xml
    #
    generator = rocks.roll.Generator()
    generator.parse("/tmp/rolls.xml")

    cwd = os.getcwd()

    #
    # get all the CD-based rolls first
    #
    diskids = []
    for roll in generator.rolls:
        (name, version, arch, url, diskid) = roll

        if diskid != "" and diskid not in diskids:
            diskids.append(diskid)

    diskids.sort()
    for d in diskids:
        #
        # ask the user to put the right media in the bay
        #
        checkCD(anaconda, media, d)

        #
        # then, for each selected roll on this disk, copy it
        #
        for roll in generator.rolls:
            (name, version, arch, url, diskid) = roll
            if diskid == d:
                downloadRoll(anaconda, roll)

    if media.mounted():
        media.ejectCD()

        #
        # now get all the network rolls
        #
    for roll in generator.rolls:
        (rollname, rollversion, rollarch, rollurl, diskid) = roll

        if diskid != "":
            continue

        downloadRoll(anaconda, roll)

    os.chdir(cwd)

    #
    # rebuild the distro
    #
    w = anaconda.intf.waitWindow(_("Rocks-Dist"), _("Rebuilding the Distribution..."))

    cmd = "/opt/rocks/bin/rocks report distro"
    for line in os.popen(cmd).readlines():
        distrodir = line[:-1]

    rootdir = "/mnt/sysimage/%s" % (distrodir)

    path = ""
    try:
        path = os.environ["PATH"]
    except:
        pass

        #
        # need this path so rocks-dist uses the 'rpm' binary from the rocks
        # path and not the 'busybox' rpm
        #
    os.environ["PATH"] = "/mnt/runtime/rocks/bin:" + path

    installcgi = rocks.installcgi.InstallCGI(rootdir)
    installcgi.createPopt()
    installcgi.rebuildDistro(generator.rolls)

    #
    # make sure the link to the repository is correct for the package
    # installation portion of the install
    #
    arch = os.uname()[4]
    if arch in ["i386", "i486", "i586", "i686"]:
        arch = "i386"

    subprocess.call("umount /mnt/cdrom", shell=True)
    subprocess.call("rm -rf /mnt/cdrom", shell=True)
    dir = "/mnt/sysimage/%s/rocks-dist/%s/" % (distrodir, arch)
    subprocess.call("ln -s %s /mnt/cdrom" % (dir), shell=True)

    w.pop()

    return