Files
new_install/main/setup
fling b26bdb3c9b modified: setup
ghu add "twm &"
2010-10-20 11:31:29 +08:00

90 lines
2.4 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/interface'
exec_file='xinitrc_setup'
work_write_dir='/var/install'
#===================================================================================
#Performance function
#===================================================================================
usage(){
echo "usage: $0 [-s|--style style] [-l|--language language][-n|--noXserver][-h|--help]"
echo "style [text|graph]"
echo "language [english|chinese]"
echo "default Xserver start"
}
config_execfile(){
echo "#!/bin/bash" > ${work_write_dir}/${exec_file}
echo "twm &"
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 $1" >> ${work_write_dir}/${exec_file}
}
main(){
local style='graph'
local language='english'
local xstart='yes'
tmp=$(getopt -o s:l:nh --long style:,language:,noXserver,help -- "$@")
eval set -- "$tmp"
mkdir -p $work_write_dir
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
done
if [ $style = 'graph' ]; then
config_execfile "$language"
else
:
# text install
fi
if [ $xstart = 'yes' ]; then
X -configure
startx ${work_write_dir}/${exec_file} -- -config ~/xorg.conf.new
else
bash ${work_write_dir}/${exec_file}
fi
}
#===================================================================================
#Execution
#===================================================================================
main "$@"