#!/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/lib/install' #=================================================================================== #Performance function #=================================================================================== usage(){ echo "usage: $0 [-s|--style style] [-l|--language language][-x|--Xserver select][-h|--help]" echo "style [text|graph]" echo "language [english|chinese]" echo "select [yes|no]" exit 0 } config_execfile(){ echo "#!/bin/bash" > ${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 test.py -l $1" >> ${work_write_dir}/${exec_file} } main(){ local style='graph' local language='english' local Xserver='yes' 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 ;; esac shift done if [ $style = 'graph' ]; then config_execfile "$language" else : # text install fi if [ $Xserver = 'yes' ]; then X -configure startx ${work_write_dir}/${exec_file} -- -config ~/xorg.conf.new else bash ${work_write_dir}/${exec_file} fi } #=================================================================================== #Execution #=================================================================================== main "$@"