1. unify install.xml location
2. in ri_data.py, fix an error on Raid instance construction 3. in ri_func_dep.py, use common function ri_data.Group.get_install_pkgs() 4. in ri_install.py, add logic to config install.xml location 5. rename test.py to ri_main.py 6. in ri_main.py, add logic to set config.xml location 7. in ri_main.py, modify the way to get parameters.
This commit is contained in:
@@ -6,7 +6,7 @@ from xml.dom import minidom
|
||||
from xml.dom.ext import PrettyPrint
|
||||
|
||||
# xml file names
|
||||
install_xml = '../xml/install.xml'
|
||||
install_xml = '/var/install/install.xml'
|
||||
config_xml = '../xml/config.xml'
|
||||
|
||||
def to_xml_attr(doc, node, cls, name):
|
||||
@@ -218,7 +218,7 @@ class Raid:
|
||||
else:
|
||||
act_cmpts.append(ss[:ss.index('[')])
|
||||
|
||||
Raid(raid_dev, "yes", raid_level, raid_size, act_cmpts, spr_cmpts)
|
||||
Raid(raid_dev, "yes", raid_level, act_cmpts, spr_cmpts)
|
||||
|
||||
@staticmethod
|
||||
def add_component(node, l):
|
||||
|
||||
@@ -7,13 +7,7 @@ class Pkg():
|
||||
|
||||
@staticmethod
|
||||
def set_list ():
|
||||
for i in ri_data.Group.dict.values():
|
||||
if i.install != 'no':
|
||||
Pkg.list += i.mandatory
|
||||
if i.selection == 'all':
|
||||
Pkg.list += [ j[0] for j in i.optional ]
|
||||
else:
|
||||
Pkg.list += [ j[0] for j in i.optional if j[1] == 'yes' ]
|
||||
list = ri_data.Group.get_install_pkgs()
|
||||
|
||||
class FsType():
|
||||
list = []
|
||||
|
||||
@@ -20,6 +20,7 @@ import sys
|
||||
import getopt
|
||||
import ri_oper
|
||||
import os
|
||||
import os.path
|
||||
def install_over(ret):
|
||||
if ri_oper.Rate.value == 100 and ret == 0:
|
||||
if display.set_task_over():
|
||||
@@ -48,7 +49,7 @@ has_run = False
|
||||
oper_list = [ri_oper.MakeRaid(5),ri_oper.Format(5),ri_oper.Mount(5),ri_oper.InstallPkg(40),ri_oper.MakeRaidConfigure(5),ri_oper.ConfigureFstab(5),ri_oper.GenerateIssue(5),ri_oper.ConfigureNetwork(5),ri_oper.MakeServiceAutoBoot(5),ri_oper.CopyKernel(5),ri_oper.ConfigureBootloader(5),ri_oper.BootLoader(5),ri_oper.ExecFinishInstall(5)]
|
||||
|
||||
def print_usages():
|
||||
print 'Usages: %s [-l|--language language] [-d|--display display-mode]' %sys.argv[0]
|
||||
print 'Usages: %s [-l|--language language] [-d|--display display-mode] [install_xml_file]' %sys.argv[0]
|
||||
|
||||
try:
|
||||
opts, args = getopt.getopt(sys.argv[1:], "l:d:", ["language=", "display="])
|
||||
@@ -56,6 +57,16 @@ except getopt.GetoptError:
|
||||
print_usages()
|
||||
sys.exit(1)
|
||||
|
||||
if len(args)>0:
|
||||
ri_data.install_xml = args[0]
|
||||
|
||||
#ri_data.install_xml default value is set in ri_data.py
|
||||
if os.path.isfile(ri_data.install_xml):
|
||||
ri_data.init_from_xml()
|
||||
else:
|
||||
print 'error: install xml(%s) does not exist' %ri_data.install_xml
|
||||
sys.exit(1)
|
||||
|
||||
ri_oper.language='english'
|
||||
disp = 'ri_inst_cli'
|
||||
for opt,arg in opts:
|
||||
|
||||
@@ -10,33 +10,33 @@ from xml.dom import minidom
|
||||
import os.path
|
||||
|
||||
def print_usages():
|
||||
print 'Usages: %s [-b|--begin step_name] [-l|--language language] [interface_xml_file] [install_xml_file]' %sys.argv[0]
|
||||
print 'Usages: %s [-b|--begin step_name] [-l|--language language] [-t|--interface interface_xml_file] [-i|--install install_xml_file] [-c|--config config_xml_file]' %sys.argv[0]
|
||||
|
||||
try:
|
||||
opts, args = getopt.getopt(sys.argv[1:], "b:l:", ["begin=","language="])
|
||||
opts, args = getopt.getopt(sys.argv[1:], "b:l:t:i:c:", ["begin=", "language=", "interface=", "install=", "config="])
|
||||
except getopt.GetoptError:
|
||||
print_usages()
|
||||
sys.exit(1)
|
||||
|
||||
begin_step=None
|
||||
itf_xml = "../xml/interface.xml"
|
||||
for opt, arg in opts:
|
||||
if opt in ('-b', '--begin'):
|
||||
begin_step = arg
|
||||
elif opt in ('-l', '--language'):
|
||||
ri_tk.language = arg.lower()
|
||||
elif opt in ('-t', '--interface'):
|
||||
itf_xml = arg
|
||||
elif opt in ('-i', '--install'):
|
||||
ri_data.install_xml = arg
|
||||
elif opt in ('-c', '--config'):
|
||||
ri_data.config_xml = arg
|
||||
|
||||
if len(args) == 0:
|
||||
itf_xml = "../xml/interface.xml"
|
||||
ins_xml = "/var/install/install.xml"
|
||||
elif len(args) == 1:
|
||||
itf_xml = args[0]
|
||||
ins_xml = "/var/install/install.xml"
|
||||
if os.path.isfile(itf_xml):
|
||||
xmldoc = minidom.parse(itf_xml)
|
||||
else:
|
||||
itf_xml = args[0]
|
||||
ins_xml = args[1]
|
||||
|
||||
xmldoc = minidom.parse(itf_xml)
|
||||
ri_data.install_xml = ins_xml
|
||||
print 'error: interface xml(%s) does not exist' %itf_xml
|
||||
sys.exit(1)
|
||||
|
||||
if os.path.isfile(ins_xml):
|
||||
ri_data.init_from_xml()
|
||||
@@ -21,9 +21,6 @@ import ri_dep
|
||||
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
|
||||
|
||||
@@ -42,7 +42,7 @@ config_execfile(){
|
||||
if [ -f ${work_write_dir}/install.xml ]; then
|
||||
echo "python check_oldconf.py -l $1 " >> ${work_write_dir}/${exec_file}
|
||||
fi
|
||||
echo "python test.py -l $1" >> ${work_write_dir}/${exec_file}
|
||||
echo "python ri_main.py -l $1" >> ${work_write_dir}/${exec_file}
|
||||
}
|
||||
|
||||
main(){
|
||||
|
||||
Reference in New Issue
Block a user