Files
new_install/main/setup
Peng Zhihui 04be655e08 Running 'setup' will text install defaultly
Fix problem of setting swap

	modified:   dialog/di_newt.py
	modified:   interface/ri_inst_cli.py
	modified:   main/setup
2014-01-17 10:56:12 +08:00

107 lines
3.3 KiB
Bash
Executable File

#!/bin/bash -
#
#===================================================================================
#
# Copyright Beijing Linx Technology Co., Ltd. 2010年09月13日
#
# Filename: setup
#
# USAGE: ./setup
#
# Description: Setup startup script
#
# Version: 0.1
# Created: 2010年09月13日
#
# Author: Hu Gang
#
# ChangeLog: 1. 2010年09月13日 Create.
#
#===================================================================================
#
#===================================================================================
#Set variables
#===================================================================================
workdir="/usr/lib/new_install/dialog"
exec_file='xinitrc_setup'
work_write_dir='/var/install'
configfile="../xml/config.xml"
#===================================================================================
#Performance function
#===================================================================================
usage(){
echo "usage: $0 [-s|--style style][-g|--graph][-l|--language language][-n|--noXserver][-h|--help]"
echo "style [text|graph]"
echo "language [english|chinese]"
echo "default text install"
}
config_execfile(){
if test "$1" == "dialog"
then
echo "#!/bin/bash" > ${work_write_dir}/${exec_file}
echo "cd ${workdir}" >> ${work_write_dir}/${exec_file}
echo "python di_main.py" >> ${work_write_dir}/${exec_file}
else
echo "#!/bin/bash" > ${work_write_dir}/${exec_file}
echo "twm &" >> ${work_write_dir}/${exec_file}
echo "cd ${workdir}" >> ${work_write_dir}/${exec_file}
if [ -f ${work_write_dir}/install.xml ]; then
echo "python check_oldconf.py -l $1 " >> ${work_write_dir}/${exec_file}
fi
echo "python ri_main.py -l $2 -c $configfile" >> ${work_write_dir}/${exec_file}
fi
}
main(){
local style='dialog'
local language='chinese'
local xstart='no'
local dialog=''
#tmp=$(getopt -o c:dsl:nh --long style:,configfile:,language:,noXserver,help -- "$@")
tmp=$(getopt -o c:sgl:nh --long configfile:,style,graph,language:,noXserver,help -- "$@")
eval set -- "$tmp"
mkdir -p $work_write_dir
while true;do
case "$1" in
'-c'|'--configfile') configfile="$2" ; shift 2;;
'-g'|'--graph') xstart='yes';style="graph" ;workdir="/usr/lib/new_install/interface";shift ;;
'-s'|'--style') xstart='no';style="dialog" ;workdir="/usr/lib/new_install/dialog";shift ;;
'-l'|'--language') language="$2" ;shift 2;;
'-n'|'--noXserver') xstart='no' ;shift ;;
'-h'|'--help') usage ; exit 0 ;;
'--') shift; break ;;
*) usage ; exit 1 ;;
esac
done
if [ $style = 'graph' ]; then
config_execfile "$style" "$language"
else
config_execfile "$style"
fi
if [ $xstart = 'yes' ]; then
X -configure
startx ${work_write_dir}/${exec_file} -- -config ~/xorg.conf.new
ret=$?
if [ $ret -ne 0 ];then
xstart='no';style="dialog" ;workdir="/usr/lib/new_install/dialog";
config_execfile "$style"
bash ${work_write_dir}/${exec_file}
fi
else
bash ${work_write_dir}/${exec_file}
fi
}
#===================================================================================
#Execution
#===================================================================================
main "$@"