Skip to content

Instantly share code, notes, and snippets.

@jimjin
Forked from tom2cjp/install_ror
Created August 16, 2011 06:56
Show Gist options
  • Save jimjin/1148573 to your computer and use it in GitHub Desktop.
Save jimjin/1148573 to your computer and use it in GitHub Desktop.
#!/bin/bash
sudo apt-get -y install dialog
DIALOG=${DIALOG=dialog}
tempfile=`tempfile 2>/dev/null` || tempfile=/tmp/test$$
trap "rm -f $tempfile" 0 1 2 5 15
$DIALOG --backtitle "请选择您要安装的选项" \
--title "专业系统安装" --clear \
--checklist "请选择您要安装的选项" 20 61 8 \
1 "升级系统 apt-get update" on \
2 "更改系统时区" off \
3 "安装Ruby Enterprise Edition 1.8.7" on \
4 "安装Passenger-nginx-module" on \
5 "安装git-core" ON \
6 "安装mysql-server和libmysqlclient15-dev" ON \
7 "建立sudo gem软链接" ON \
8 "Install sqlite3 and ruby-sqlite3(y/n)?" ON \
2> $tempfile
choice=`cat $tempfile`
install_ree_ref_libs() {
sudo apt-get -y install build-essential patch zlib1g-dev libssl-dev libreadline5-dev
}
add_ruby_bin_to_path() {
sudo chmod 777 /etc/environment && echo PATH=\"$PATH:/opt/ruby-enterprise-1.8.7-2011.03/bin\" > /etc/environment && sudo chmod 644 /etc/environment
}
install_ree() {
wget http://rubyforge.org/frs/download.php/71096/ruby-enterprise-1.8.7-2011.03.tar.gz && tar xzvf ruby-enterprise-1.8.7-2011.03.tar.gz && sudo ./ruby-enterprise-1.8.7-2011.03/installer -a /opt/ruby-enterprise-1.8.7-2011.03
}
if [ "$choice" != '' ]; then
for line in $choice; do
echo "执行命令 $line ..."
case "$line" in
"\"1\"") sudo apt-get -y update && sudo apt-get -y upgrade;;
"\"2\"") sudo dpkg-reconfigure tzdata;;
"\"3\"") install_ree_ref_libs && cd /tmp && install_ree && add_ruby_bin_to_path;;
"\"4\"") sudo apt-get -y install libcurl4-gnutls-dev && sudo /opt/ruby-enterprise-1.8.7-2011.03/bin/passenger-install-nginx-module --auto --auto-download --prefix=/opt/nginx;;
"\"5\"") sudo apt-get -y install git-core;;
"\"6\"") sudo apt-get -y install mysql-server libmysqlclient15-dev;;
"\"7\"") sudo ln -s /opt/ruby-enterprise-1.8.7-2011.03/bin/gem /usr/bin/gem;;
"\"8\"") sudo apt-get -y install sqlite3 swig libsqlite3-ruby libsqlite3-dev && sudo gem install sqlite3-ruby;;
esac
done
echo "请手动运行命令 source /etc/environment 来完成环境变量更新."
echo "谢谢使用."
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment