Restarting anaconda... how?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi All,

[short version]
In my %pre, I modify /tmp/ks.cfg (explanation below, if you're wondering
why!). Does anyone know of a way to restart anaconda (in %pre, using
python as the interpreter) so that I can read in the new configuration?

Thanks!
Erik.

[pedantic alert - long version, read if you dare]

I've (re)written a little addition to anaconda which partitions the hard
disk by percentages, as opposed to set values - very handy as we have a
million differing machine setups here.  It is run in the %pre section,
where it partitions the disk, and then modifies /tmp/ks.cfg.

(right now I'm wondering why I have the script do the actual
partitioning and not anaconda... hmmm)

regardless, it requires me to restart anaconda, so that the new ks.cfg
can be read with the new values.  With redhat 7.1, I modified
kickstart.py to do the following:

os.execv('/usr/bin/python1.5', ['', '/usr/bin/anaconda', '-m', \
'http://forge/redhat/i386', '--kickstart', '/tmp/ks-modified.cfg'])

If /tmp/ks-modified.cfg existed.

But, I'd really like to avoid hacking the installer apart.I'm wondering 
is if I can do this in my %pre section, which currently looks like this:

<snip>

%pre --interpreter /usr/bin/python
import urllib, os, string
partition_script="/tmp/partition.py"

if not os.path.exists(partition_script):
	url="http://forge/partition.py";
	urllib.urlretrieve(url, partition_script)
	os.system('chmod 755 ' + partition_script)
	os.system(partition_script + " -t workstation")
	os.system("sh /tmp/fdisk.sh")

	config = open('/tmp/ks.cfg').readlines()
	partinfo = open('/tmp/include.ks').readlines()

	i = config.index('# Partition Information Goes Here\012') + 1
	for line in partinfo:
		config.insert(i, line)
		i = i + 1

	outfile = open('/tmp/ks-modified.cfg', 'w+')
	for line in config:
		outfile.write(line)

	outfile.close()

	os.execv('/usr/bin/python1.5', ['', '/usr/bin/anaconda', '-m',\
'http://forge/redhat/i386', '--kickstart', '/tmp/ks-modified.cfg'])

</snip>

Alas, the os.execv doesn't 'work' because %pre is run as a separate
process from anaconda, so I'm not really replacing the installer, but
the sub-process.

If anyone has an idea, I'm all ears!  
Thanks - 
Erik.

-- 
e r i k   w i l l i a m s o n                     erik@xxxxxxxxxxxxxxxx
 system admin . department of computer science . university of calgary






[Index of Archives]     [Red Hat General]     [CentOS Users]     [Fedora Users]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux