For the recored,the error correction

This commit is contained in:
hugang
2010-10-15 16:06:50 +08:00
parent dfd55b58e9
commit 4db9f7c1dd
7 changed files with 81 additions and 57 deletions

View File

@@ -9,7 +9,7 @@ import sys
import subprocess
import getopt
ins_xml = './install.xml'
ins_xml = '/var/install/install.xml'
lang = 'english'
message = {}
message['english'] = 'The system detects the presence of the last\n \
@@ -21,10 +21,10 @@ def print_usages():
print 'language [english|chinese]'
print 'default language is english'
def ok():
def yes():
root.destroy()
def cancel():
def no():
''' remove system left install.xml file'''
cmd='rm -rf ' + ins_xml
subprocess.Popen(cmd,shell=True)
@@ -34,15 +34,13 @@ def init(language):
''' implement Widget'''
global root
root = Tkinter.Tk()
root.geometry("%sx%s+%d+%d" % (root.winfo_screenwidth()/2,\
root.winfo_screenheight()/2,\
root.winfo_screenwidth()/4,
root.winfo_screenheight()/4))
root.geometry("%sx%s+0+0" % (root.winfo_screenwidth(),
root.winfo_screenheight()))
txt = message[language]
lab = Tkinter.Label(root,text=txt)
lab.grid(row=1,column=1)
btn1 = Tkinter.Button(root,text='OK',command=sys.modules[__name__].ok)
btn2 = Tkinter.Button(root,text='Cancle',command=sys.modules[__name__].cancel)
btn1 = Tkinter.Button(root,text='Yes',command=sys.modules[__name__].yes)
btn2 = Tkinter.Button(root,text='No',command=sys.modules[__name__].no)
btn1.grid(row=2,column=0,padx=40,pady=100,ipadx=20)
btn2.grid(row=2,column=2,padx=20,pady=100,ipadx=15)
root.rowconfigure(1,weight=2)
@@ -51,18 +49,21 @@ def init(language):
root.mainloop()
try:
opts,args = getopt.getopt(sys.argv[1:],"l:",["language="])
opts,args = getopt.getopt(sys.argv[1:],"l:",["language="])
except getopt.GetoptError:
print_usages()
sys.exit(1)
print_usages()
sys.exit(1)
for opt,arg in opts:
if opt in ('-l','--language'):
lang = arg
if opt in ('-h','--help'):
print_usages()
sys.exit(0)
if lang in ('english','chinese'):
init(lang)
init(lang)
else:
print_usages()
sys.exit(1)
print_usages()
sys.exit(1)

View File

@@ -629,7 +629,8 @@ p_node - xml node (parent node)'''
srvs.appendChild(srv)
p_node.appendChild(srvs)
def install_information():
def prepar_installation():
'''create file called 'intall.xml',which contains the information about the installation'''
to_xml()
xmldoc = minidom.parse(install_xml)
root = xmldoc.firstChild

View File

@@ -400,9 +400,9 @@ def raid_device_list_detail(*args):
raid_raw_initialized = False
def install_information_init():
def prepar_installation_init():
'''install information initialize'''
ins_info = ri_data.install_information()
t= ri_widget.Widget.dict['install_information.list'].tk_widget
ins_info = ri_data.prepar_installation()
t= ri_widget.Widget.dict['prepar_installation.text'].tk_widget
t.insert(1.0,ins_info)

View File

@@ -27,10 +27,10 @@ for opt, arg in opts:
if len(args) == 0:
itf_xml = "../xml/interface.xml"
ins_xml = "../xml/install.xml"
ins_xml = "/var/install/install.xml"
elif len(args) == 1:
itf_xml = args[0]
ins_xml = "../xml/install.xml"
ins_xml = "/var/install/install.xml"
else:
itf_xml = args[0]
ins_xml = args[1]

View File

@@ -4,9 +4,9 @@
#
# Copyright Beijing Linx Technology Co., Ltd. 2010年09月21日
#
# Filename: conf_sshd.sh
# Filename: conf_sshd
#
# USAGE: ./conf_sshd.sh
# USAGE: conf_sshd [interface]
#
# Description: configure sshd,to achieve remote installation
#
@@ -19,21 +19,35 @@
#
#===================================================================================
#
#===================================================================================
#Set variables
#===================================================================================
interface=
filepath=/etc/sysconfig/network-devices
#===================================================================================
#Performance function
#===================================================================================
usage(){
echo "$0 [interface]"
echo "The name of the interface. This is usually a driver name followed "
echo "by a unit number, for example eth0 for the first Ethernet interface."
echo "default interface is eth0"
}
startnetwork(){
local networkfile='/etc/sysconfig/network-devices/ifcfg-eth0'
cp ${filepath}/{ifcfg.template,ifcfg-${interface}}
echo 'enter your IP:'
read ip
echo 'enter your netmask:'
read netmask
echo 'enter your gateway:'
read gateway
sed -i "s%IPADDR=.*%IPADDR=${ip}%g" $networkfile
sed -i "s%NETMASK=.*%NETMASK=${netmask}%g" $networkfile
sed -i "s%GATEWAY=.*%GATEWAY=${gateway}%g" $networkfile
ifup eth0
sed -i "s%IPADDR=.*%IPADDR=${ip}%g" ${filepath}/ifcfg-${interface}
sed -i "s%NETMASK=.*%NETMASK=${netmask}%g" ${filepath}/ifcfg-${interface}
sed -i "s%GATEWAY=.*%GATEWAY=${gateway}%g" ${filepath}/ifcfg-${interface}
ifup ${interface}
}
startsshd(){
@@ -47,6 +61,16 @@ startsshd(){
#===================================================================================
#Execution
#===================================================================================
# the interface between the eth0 to eth9
if [ $# -eq 0 ]; then
interface=eth0
elif [[ V$1 == Veth[0-9] ]]; then
interface="$1"
else
usage
exit 1
fi
startnetwork
startsshd

View File

@@ -25,16 +25,15 @@
#===================================================================================
workdir='/usr/lib/new_install/interface'
exec_file='xinitrc_setup'
work_write_dir='/var/lib/install'
work_write_dir='/var/install'
#===================================================================================
#Performance function
#===================================================================================
usage(){
echo "usage: $0 [-s|--style style] [-l|--language language][-x|--Xserver select][-h|--help]"
echo "usage: $0 [-s|--style style] [-l|--language language][-n|--noXserver][-h|--help]"
echo "style [text|graph]"
echo "language [english|chinese]"
echo "select [yes|no]"
exit 0
echo "default Xserver start"
}
config_execfile(){
@@ -49,17 +48,22 @@ config_execfile(){
main(){
local style='graph'
local language='english'
local Xserver='yes'
local xstart='yes'
tmp=$(getopt -o s:l:nh --long style:,language:,noXserver,help -- "$@")
eval set -- "$tmp"
mkdir -p $work_write_dir
while [ "$1" ];do
case $1 in
'-s'|'--style') type="$2" ;shift ;;
'-l'|'--language') language="$2" ;shift ;;
'-x'|'--Xserver') Xserver="$2" ;shift ;;
*) usage ;;
while true;do
case "$1" in
'-s'|'--style') type="$2" ;shift 2;;
'-l'|'--language') language="$2" ;shift 2;;
'-n'|'--noXserver') xstart='no' ;shift ;;
'-h'|'--help') usage ; exit 0 ;;
'--') shift; break ;;
*) usage ; exit 1 ;;
esac
shift
done
if [ $style = 'graph' ]; then
@@ -69,7 +73,7 @@ main(){
# text install
fi
if [ $Xserver = 'yes' ]; then
if [ $xstart = 'yes' ]; then
X -configure
startx ${work_write_dir}/${exec_file} -- -config ~/xorg.conf.new
else

View File

@@ -722,7 +722,6 @@ row 4 | |
</widget>
</widget>
<message_box name='check_old_conf' type='askokcancel' title='check old config' message='#check-old-config'/>
<message_box name='next' type='askokcancel' title='install sequence' message='#installation-confirmation'/>
<message_box name='previous' type='showinfo' title='install sequence' message='#first-step'/>
<message_box name='raid_add_warning' type='showwarning' title='raid adding' message='#raid-add-warning'/>
@@ -832,25 +831,25 @@ row 4 | |
-->
<widget type='Frame' name='install_information'>
<widget type='Frame' name='prepar_installation'>
<grid_management rows='2' columns='2'>
<configure row='0' weight='1'/>
<configure column='0' weight='1'/>
</grid_management>
<grid_location row='2' column='1' columnspan='2' sticky='NSWE'/>
<action>
<scroll scrolling='install_information.scroll.v' scrolled='install_information.list'/>
<scroll scrolling='install_information.scroll.h' scrolled='install_information.list'/>
<scroll scrolling='prepar_installation.scroll.v' scrolled='prepar_installation.text'/>
<scroll scrolling='prepar_installation.scroll.h' scrolled='prepar_installation.text'/>
</action>
<widget type='Text' name='install_information.list'>
<widget type='Text' name='prepar_installation.text'>
<grid_location row='0' column='0' padx='30' pady='30' sticky='NSWE'/>
<action init='install_information_init'/>
<action init='prepar_installation_init'/>
</widget>
<widget type='Scrollbar' name='install_information.scroll.v'>
<widget type='Scrollbar' name='prepar_installation.scroll.v'>
<widget_attribute orient='vertical'/>
<grid_location row='0' column='1' pady='30' sticky='NS'/>
</widget>
<widget type='Scrollbar' name='install_information.scroll.h'>
<widget type='Scrollbar' name='prepar_installation.scroll.h'>
<widget_attribute orient='horizontal'/>
<grid_location row='1' column='0' padx='30' sticky='WE'/>
</widget>
@@ -875,7 +874,7 @@ row 4 | |
<Chinese>您已到达第一步。</Chinese>
</text>
<text key='#install_information.help'>
<text key='#prepar_installation.help'>
<English>
Installation information recorded the process which the users choose operations during installation. Including: record the operation of the physical hard disk, choose the software packages which use to install and server to start system.
</English>
@@ -1031,11 +1030,6 @@ row 4 | |
<English>installation Configuration is completed, press the OK button to start the installation</English>
<Chinese>安装配置完成,按确定键开始安装</Chinese>
</text>
<text key='#check-old-config'>
<English>The system detects the presence of the last installation to retain the configuration file, whether to use</English>
<Chinese>系统检测到存在上次安装保留的配置文件,是否使用它</Chinese>
</text>
<text>
<English>Active</English>
@@ -1108,7 +1102,7 @@ row 4 | |
</text>
<text>
<English>install_information</English>
<English>prepar_installation</English>
<Chinese>安装信息</Chinese>
</text>
@@ -1256,6 +1250,6 @@ row 4 | |
<widget name='software group'/>
<widget name='dependency'/>
<widget name='service'/>
<widget name='install_information'/>
<widget name='prepar_installation'/>
</sequence>
</interface>