modified: interface/ri_data.py
remove MountPoint use new datastructure for instead
modified: interface/ri_install.py
add MakePartitions for partition
modified: interface/ri_oper.py
1.add MakePartitions class
2.modify Format, Mount, ConfigureFstab class
modified: new_partition/partition_data.py
1.add disk_from_os attribute to Partition class for disk
2.add process linux-swap(v1) in Partition class
3.force convert num and sn to int, beacause when read from install.xml
sn and num is still string.
modified: operation/format_partition.sh
1.add timeout beacause use MakePartitions, need time to generate
device file
2.add linux-swap for swap
modified: operation/functions
1.add % support, beacause of partition may use 1% to partition
disks.
new file: operation/partition_disks.sh
1.use partition_disks as parted stdin wrapper.
Signed-off-by: Qin Bo <bqin@linx-info.com>
88 lines
2.6 KiB
Python
88 lines
2.6 KiB
Python
#!/usr/bin/python
|
|
# coding: utf-8
|
|
#
|
|
# DESCRIPTION: install for OS
|
|
#
|
|
# SCRIPT NAME: ri_install.py
|
|
#
|
|
# Input:
|
|
# [-d|--display display-mode ] install display (tk or cli)
|
|
# [-l|--language language] insatll display language (chinese or english)
|
|
#
|
|
# MENTOR: Li Zhi
|
|
#
|
|
# AUTHOR: Ling Fen
|
|
#
|
|
# EMAIL: fling@linx-info.com
|
|
#
|
|
# DATE: 2010-09-20
|
|
import sys
|
|
import getopt
|
|
import ri_oper
|
|
import os
|
|
import os.path
|
|
import ri_data
|
|
sys.path.append('../new_partition/')
|
|
import partition_data as p_d
|
|
|
|
def install_over(ret):
|
|
if ri_oper.Rate.value == 100 and ret == 0:
|
|
if display.set_task_over():
|
|
print "reboot ..."
|
|
os.system("reboot")
|
|
else:
|
|
display.root_destroy()
|
|
|
|
def main():
|
|
global has_run
|
|
if has_run: return
|
|
has_run = True
|
|
for instance in oper_list:
|
|
ret = instance.install()
|
|
if ret:
|
|
display.error(instance, ret)
|
|
break
|
|
else:
|
|
ri_oper.display_sub_operation((ri_oper.language=='chinese' \
|
|
and instance.chinese_name or instance.english_name)+\
|
|
(ri_oper.language=='chinese' and u' 成功\n' or ' success\n'))
|
|
install_over(ret)
|
|
|
|
has_run = False
|
|
|
|
def print_usages():
|
|
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="])
|
|
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:
|
|
if opt in ("-l","--language"):
|
|
ri_oper.language=arg.lower()
|
|
elif opt in ("-d", "--display"):
|
|
disp = 'ri_inst_%s' %arg.lower()
|
|
exec 'import %s as display' %disp
|
|
|
|
ri_oper.display_operation = display.set_task
|
|
ri_oper.display_sub_operation = display.set_sub_task
|
|
ri_oper.display_scale = display.set_task_scale
|
|
|
|
oper_list = [ri_oper.MakePartitions(5),ri_oper.MakeRaid(3),ri_oper.Format(7),ri_oper.Mount(3),ri_oper.InstallPkg(49),ri_oper.MakeRaidConfigure(2),ri_oper.ConfigureFstab(5),ri_oper.GenerateIssue(3),ri_oper.ConfigureNetwork(2),ri_oper.MakeServiceAutoBoot(5),ri_oper.CopyKernel(7),ri_oper.ConfigureBootloader(5),ri_oper.BootLoader(2),ri_oper.ExecFinishInstall(2)]
|
|
|
|
display.start(main)
|