Ubiquity installer issue: inserting values into debconf and writing to a file during installation
Pieter van Zyl
pvzyl at csir.co.za
Thu Apr 24 11:06:48 BST 2008
Good day
I have a problem with inserting values into debconf.
I am busy with creating a page in ubiquity to select packages from a
list to install.
I read in the list of packages from a file and then create the gtk
components and page.
Then when the user selects these options I try to insert the selected
values/packages in either: in a file or in debconf
Using debconf:
----------------------
If I try to insert the selected values into debconf I get the following
error:
exception caught in process_line:
Traceback (most recent call last):
File "/usr/lib/ubiquity/ubiquity/filteredcommand.py", line 112, in
process_line
return self.dbfilter.process_line()
File "/usr/lib/ubiquity/ubiquity/debconffilter.py", line 260, in
process_line
if not input_widgets[0].run(priority, question):
File "/usr/lib/ubiquity/ubiquity/components/scib.py", line 38, in run
self.store_packages_to_install_in_debconf(list)
File "/usr/lib/ubiquity/ubiquity/components/scib.py", line 106, in
store_packages_to_install_in_debconf
self.preseed_bool(name, self.yesInstall)
File "/usr/lib/ubiquity/ubiquity/filteredcommand.py", line 293, in
preseed_bool
self.preseed(name, 'true', seen)
File "/usr/lib/ubiquity/ubiquity/filteredcommand.py", line 284, in
preseed
self.db.register('debian-installer/dummy', name)
File "/usr/lib/python2.5/site-packages/debconf.py", line 60, in
<lambda>
lambda *args, **kw: self.command(command, *args, **kw))
File "/usr/lib/python2.5/site-packages/debconf.py", line 96, in
command
raise DebconfError(status, data)
DebconfError: (20, 'Incorrect number of arguments')
No idea why this happens.
I am iterating through a list and trying to add the package name and the
value true into debconf. Example (packageX,True)
code:
for package in list:
self.yesInstall = True
name = str(package)
name = name.strip(name)
name = unicode(name)
self.preseed_bool(name, self.yesInstall)
I am using the preseed_bool method to insert into debconf
If I create a string value and insert it using preseed_bool it works but
when I iterate using the package names it fails
I suspect it has something to do with the encoding?
Writing the selected values to a file:
-----------------------------------------------
If I iterate through the selected packages and try to write them to a
file I get this error:
self.output_file =
open('/usr/lib/ubiquity/ubiquity/frontend/package_list_to_install.txt',
'w')
IOError [Errno 13] permission denied:
'/usr/lib/ubiquity/ubiquity/frontend/package_list_to_install.txt'
The file I try to create and write to:
self.output_file =
open('/usr/lib/ubiquity/ubiquity/frontend/package_list_to_install.txt',
'w')
Any ideas on how to fix this? I have tried to create the file and have
it on the live cd and I still get that error. Do I need to set
permissions or the mode?
Kindly
Pieter
My script class:
-----------------------
class ScientificPackageInstall(FilteredCommand):
def prepare(self):
print "prepare"
questions = ['^scib/install',
'^scib/xDrawChem','^scib/chemtool']
return (['/usr/share/ubiquity/scib_script'], questions)
def run(self,priority,question):
print "run ScientificPackageInstall"
if question.startswith('scib/install'):
install = self.frontend.pvz_cool()
#self.preseed('scib/install', install)
elif question.startswith('scib/xDrawChem'):
math = self.frontend.get_xDrawChemBtn()
self.preseed_bool('scib/xDrawChem',math)
print "xDrawChem SELECTED fc: ",math
elif question.startswith('scib/chemtool'):
bio = self.frontend.get_chemtoolBtn()
#self.db.input('scib/bioscience','true');
self.preseed_bool('scib/chemtool', bio)
list = []
list = self.frontend.get_packages_to_install()
test_string = 'pvz'
self.yesInstall = True
self.preseed_bool(test_string, self.yesInstall)
# self.store_packages_to_install_in_file(list)
self.store_packages_to_install_in_debconf(list)
print "chemtool SELECTED fc: ",bio
return FilteredCommand.run(self, priority, question)
def ok_handler(self):
print "ok_handler ScientificPackageInstall"
#self.preseed('scib/install',self.frontend.pvz_cool())
FilteredCommand.ok_handler(self)
def store_packages_to_install_in_file(self,list):
# self.chroot_setup()
# self.target = '/target'
self.output_file =
os.path.join('/usr/lib/ubiquity/ubiquity/frontend/','')
st = os.lstat(self.output_file)
mode = stat.S_IMODE(st.st_mode)
print "Mode: ",mode
access = os.access(self.output_file, mode)
print "access: ",access
if not os.path.exists(self.output_file):
print "file does not exists"
self.output_file =
open('/usr/lib/ubiquity/ubiquity/frontend/package_list_to_install.txt',
'w')
for package in list:
print "install: ",package
# self.db.set(package, True)
self.output_file.writelines(package)
self.output_file.close();
# self.chroot_cleanup()
#end store_packages_to_install
def store_packages_to_install_in_debconf(self,list):
self.yesInstall = True
for package in list:
print "install: ",package
#this works
#self.preseed_bool('scib/chemtool', self.yesInstall)
"""
store the package name in debconf using its name:
Note(pvz/april2008):
This does not work. Does not seem happy with the string?
Maybe need to do a conversion
"""
print "str: ",str(package)
test_string = 'pvz'
#name = repr(package)
name = str(package)
name = name.strip(name)
name = unicode(name)
self.preseed_bool(test_string, self.yesInstall)
self.preseed_bool(name, self.yesInstall)
--
This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard.
The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html.
This message has been scanned for viruses and dangerous content by MailScanner,
and is believed to be clean. MailScanner thanks Transtec Computers for their support.
More information about the Ubuntu-installer
mailing list