99 lines
3.0 KiB
Bash
Executable File
99 lines
3.0 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="$(pwd)/../interface"
|
|
exec_file='xinitrc_setup'
|
|
work_write_dir='/var/install'
|
|
configfile="../xml/config.xml"
|
|
#===================================================================================
|
|
#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(){
|
|
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='graph'
|
|
local language='chinese'
|
|
local xstart='yes'
|
|
local dialog=''
|
|
|
|
tmp=$(getopt -o c:dsl:nh --long style:,configfile:,language:,noXserver,help -- "$@")
|
|
eval set -- "$tmp"
|
|
|
|
mkdir -p $work_write_dir
|
|
|
|
while true;do
|
|
case "$1" in
|
|
'-c'|'--configfile') configfile="$2" ; shift 2;;
|
|
'-s'|'--style') xstart='no';style="dialog" ;workdir="$(pwd)/../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
|
|
else
|
|
bash ${work_write_dir}/${exec_file}
|
|
fi
|
|
}
|
|
|
|
#===================================================================================
|
|
#Execution
|
|
#===================================================================================
|
|
main "$@"
|
|
|