diff --git a/interface/ri_oper.py b/interface/ri_oper.py index 6be6e05..7784abc 100644 --- a/interface/ri_oper.py +++ b/interface/ri_oper.py @@ -20,6 +20,9 @@ import ri_data import os import subprocess +if os.path.isfile("../xml/install.xml"): + ri_data.init_from_xml() + display_operation = None display_sub_operation = None display_scale = None @@ -277,8 +280,8 @@ class BootLoader(Operation): def __init__(self,scr): Operation.__init__(self,"Install bootloader",u"安装引导程序","install_bootloader.sh",scr) self.return_value[2]=("Bootloader type hasn't been specified",u"没有指定引导程序的类型") - self.return_value[3]=("Bootloader hasn't been implemented",u"没有执行bootloader") - self.return_value[127]=("Bootloader utils not found",u"没发现bootloader的utils") + self.return_value[3]=("Bootloader hasn't been implemented",u"没有实现bootloader") + self.return_value[127]=("No tool to bootloader. E.g grub",u"没有安装引导程序的工具。如grub等") def get_arguments(self): # only grub? @@ -289,20 +292,35 @@ class ConfigureBootloader(Operation): def __init__(self,scr): Operation.__init__(self,"Configure bootloader",u"配置bootloader","configure_bootloader_cnf.sh",scr) self.return_value[2]=("Bootloader type hasn't specified",u"没有指定引导程序的类型") - self.return_value[3]=("Bootloader hasn't been implemented",u"") + self.return_value[3]=("Bootloader hasn't been implemented",u"没有实现bootloader") self.return_value[4]=("Bootloader configuration file doesn't exist",u"引导程序配置文件不存在") def get_arguments(self): - bootloader=[] + list=[] + tp="grub" + isboot=False + isroot=False # FIXME if tag file format is error? if os.path.isfile("/tag"): fd = open("/tag","r") string = fd.read() list = string.split('-') - for instance in ri_data.MountPoint.list: - if instance.directory == '/': - # only grub? - bootloader=['-t','grub','-r',instance.device,'-k',ri_data.SerialNumber.value,'-o',list[0][5:].split('.')[0]+'.'+list[0][5:].split('.')[1]] - break - fd.close() + fd.close() + + bootloader=['-t',tp,'-o',list[0][5:].split('.')[0]+'.'+list[0][5:].split('.')[1]] + + for instance in ri_data.MountPoint.list: + if instance.directory == '/' and not isroot: + bootloader+=['-r',instance.device] + print "root" + isroot=True + continue + if isroot and instance.directory == '/boot' and not isboot : + bootloader+=['-b',instance.device] + print "boot" + isboot=True + continue + + if ri_data.SerialNumber.value: + bootloader+=['-k',"linx_serial=%s" %ri_data.SerialNumber.value] return bootloader