#!/bin/bash ################ Script Info ################ ## Program: Auto Min Desktop V1.0 ## Author:Chier Xuefei ## Date: 2013-03-03 ## Update:20130307 - zhangyanying - change echo to cat to make the shell read nice ## 20130316 - chier xuefei - add the vncservers config ################ Env Define ################ PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin:~/sbin LANG=C export PATH export LANG ################ Var Setting ################ VNCPass="admin123" InputVar=$* HomeDir="/tmp/automindesk" BasePkg="wget expect xorg-x11-server-Xorg xorg-x11-xinit mesa-dri-drivers xorg-x11-twm xterm tigervnc-server" AppendPkg=" Terminal " ## if [ -z "`echo $InputVar|grep 'without\-fluxbox'`" ]; then AppendPkg=$AppendPkg" fluxbox " fi if [ -z "`echo $InputVar|grep 'without\-firefox'`" ]; then AppendPkg=$AppendPkg" firefox " fi ################ Func Define ################ function _info_msg() { _header echo -e " | |" echo -e " | Thank you for use automindesk! |" echo -e " | |" echo -e " | Version: 1.0.0 |" echo -e " | |" echo -e " | http://www.idcsrv.com |" echo -e " | |" echo -e " | Author:翅儿学飞(chier xuefei) |" echo -e " | Email:myregs@126.com |" echo -e " | QQ:1810836851 |" echo -e " | QQ群:61749648 |" echo -e " | |" echo -e " | |" echo -e " | Usage:--without-firefox disable install firefox |" echo -e " | --without-fluxbox disable install fluxbox DE |" echo -e " | |" echo -e " | Hit [ENTER] to continue or ctrl+c to exit |" echo -e " | |" printf " o----------------------------------------------------------------o\n" read entcs clear } function _end_msg() { echo -e "###################################################################" echo "" echo -e " Your VNC Pass IS: ${VNCPass}" echo "" echo -e " Please reboot and then run 'ibus-setup' in Desktop" echo "" echo -e "###################################################################" echo "" echo "" _header echo -e " | |" echo -e " | Thank you for use automindesk! |" echo -e " | |" echo -e " | The software has been installed! |" echo -e " | |" echo -e " | http://www.idcsrv.com |" echo -e " | |" echo -e " | Author:翅儿学飞(chier xuefei) |" echo -e " | Email:myregs@126.com |" echo -e " | QQ:1810836851 |" echo -e " | QQ群:61749648 |" echo -e " | |" printf " o----------------------------------------------------------------o\n" } function _header() { printf " o----------------------------------------------------------------o\n" printf " | :: AutoMinDesk v1.0.0 (2013/03/03) |\n" printf " o----------------------------------------------------------------o\n" } ##Program Function ################ Main ################ clear _info_msg if [ `id -u` != "0" ]; then echo -e "You need to be be the root user to run this script.\nWe also suggest you use a direct root login, not su -, sudo etc..." exit 1 fi if [ ! -d $HomeDir ]; then mkdir -p $HomeDir fi cd $HomeDir || exit 1 yum -y install $BasePkg wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm rpm -ivh epel-release-6-8.noarch.rpm yum -y install $AppendPkg "@Chinese support" ##defalut install firefox if [ -z "`echo $InputVar|grep 'without\-firefox'`" ]; then #wget http://fpdownload.macromedia.com/get/flashplayer/pdc/11.2.202.273/flash-plugin-11.2.202.273-release.x86_64.rpm wget http://rpmfind.net/linux/dag/redhat/el6/en/x86_64/dag/RPMS/flash-plugin-11.2.202.394-0.1.el6.rf.x86_64.rpm rpm -ivh flash-plugin-11.2.202.394-0.1.el6.rf.x86_64.rpm fi ############ Soft Conf ############ expect << EOF spawn bash -c "vncserver" expect "*Password:" send "${VNCPass}\r" expect "Verify:" send "${VNCPass}\r" expect eof EOF chkconfig --add vncserver chkconfig --level 35 vncserver on cp ~/.vnc/xstartup ~/.vnc/xstartup.bak cat > ~/.vnc/xstartup << \EOF #!/bin/sh #make by chier xuefei [ -r /etc/sysconfig/i18n ] && . /etc/sysconfig/i18n export LANG export SYSFONT vncconfig -iconic & unset SESSION_MANAGER unset DBUS_SESSION_BUS_ADDRESS OS=`uname -s` if [ $OS = 'Linux' ]; then case "$WINDOWMANAGER" in *gnome*) if [ -e /etc/SuSE-release ]; then PATH=$PATH:/opt/gnome/bin export PATH fi ;; esac fi [ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources xsetroot -solid grey xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" & EOF if [ -z "`echo $InputVar|grep 'without\-fluxbox'`" ]; then echo 'fluxbox &' >> ~/.vnc/xstartup else echo 'twm &' >> ~/.vnc/xstartup fi echo 'ibus-daemon &' >> ~/.vnc/xstartup if [ -z "`echo $InputVar|grep 'without\-fluxbox'`" ]; then echo 'fluxbox &' >> ~/.xinitrc else echo 'twm &' >> ~/.xinitrc fi echo "export GTK_IM_MODULE=ibus" >> /etc/bashrc echo "export XMODIFIERS=@im=ibus" >> /etc/bashrc echo "export QT_IM_MODULE=ibus" >> /etc/bashrc echo 'VNCSERVERS="1:root"' >> /etc/sysconfig/vncservers echo 'VNCSERVERARGS[1]="-geometry 800x600"' >> /etc/sysconfig/vncservers _end_msg ############ Clean Cache ############ rm -rf ${HomeDir}