SHIMODA Piro Hiroshi
null+****@clear*****
Thu Sep 25 02:00:48 JST 2014
SHIMODA "Piro" Hiroshi 2014-09-25 02:00:48 +0900 (Thu, 25 Sep 2014) New Revision: e96988cfdb8c29b19a8f367a772bdc0fe0b37b7a https://github.com/droonga/droonga-engine/commit/e96988cfdb8c29b19a8f367a772bdc0fe0b37b7a Message: Restructure installation script for various platforms Modified files: install.sh Modified: install.sh (+41 -27) =================================================================== --- install.sh 2014-09-25 01:41:50 +0900 (11c1c41) +++ install.sh 2014-09-25 02:00:48 +0900 (69cfa48) @@ -64,8 +64,6 @@ prepare_user() { } setup_configuration_directory() { - PLATFORM=$1 - echo "" echo "Setting up the configuration directory..." @@ -179,48 +177,62 @@ install_master() { install_service_script() { INSTALL_LOCATION=$1 - PLATFORM=$2 DOWNLOAD_URL=$SCRIPT_URL/$PLATFORM/$NAME curl -o $INSTALL_LOCATION $DOWNLOAD_URL chmod +x $INSTALL_LOCATION } -install_in_debian() { + + +# ====================== for Debian/Ubuntu ========================== + +prepare_environment_in_debian() { apt-get update apt-get -y upgrade apt-get install -y ruby ruby-dev build-essential - echo "" - if [ "$VERSION" = "master" ]; then - echo "Installing $NAME from the git repository..." apt-get install -y git - install_master - else - echo "Installing $NAME from RubyGems..." - gem install droonga-engine --no-rdoc --no-ri fi +} - prepare_user - - setup_configuration_directory debian - - echo "" - echo "Registering $NAME as a service..." +register_service_in_debian() { install_service_script /etc/init.d/$NAME debian update-rc.d $NAME defaults } -install_in_centos() { +# ====================== /for Debian/Ubuntu ========================= + + + +# ========================= for CentOS 7 ============================ + +prepare_environment_in_centos() { yum update yum -y groupinstall development yum -y install ruby-devel - echo "" + if [ "$VERSION" = "master" ]; then + yum -y install git + fi +} + +register_service_in_centos() { + install_service_script /etc/rc.d/init.d/$NAME centos + /sbin/chkconfig --add $NAME +} + +# ========================= /for CentOS 7 =========================== + + +install() { + echo "Preparing the environment..." + prepare_environment_in_$PLATFORM + + echo "" if [ "$VERSION" = "master" ]; then echo "Installing $NAME from the git repository..." - yum -y install git install_master else echo "Installing $NAME from RubyGems..." @@ -229,26 +241,28 @@ install_in_centos() { prepare_user - setup_configuration_directory centos + setup_configuration_directory echo "" echo "Registering $NAME as a service..." - install_service_script /etc/rc.d/init.d/$NAME centos - /sbin/chkconfig --add $NAME + register_service_in_$PLATFORM + + echo "" + echo "Successfully installed $NAME." } if [ "$EUID" != "0" ]; then echo "You must run this script as the root." exit 1 elif [ -e /etc/debian_version ] || [ -e /etc/debian_release ]; then - install_in_debian + PLATFORM=debian elif [ -e /etc/centos-release ]; then - install_in_centos + PLATFORM=centos else echo "Not supported platform. This script works only for Debian or CentOS." exit 255 fi -echo "" -echo "Successfully installed $NAME." +install + exit 0 -------------- next part -------------- HTML����������������������������...Download