[Groonga-commit] droonga/droonga-engine at c5b3f5d [master] Unify install scripts for release and master

Back to archive index

YUKI Hiroshi null+****@clear*****
Fri Sep 12 19:45:24 JST 2014


YUKI Hiroshi	2014-09-12 19:45:24 +0900 (Fri, 12 Sep 2014)

  New Revision: c5b3f5d00d333d54455c7d421c4a6947a1682d7a
  https://github.com/droonga/droonga-engine/commit/c5b3f5d00d333d54455c7d421c4a6947a1682d7a

  Message:
    Unify install scripts for release and master

  Removed files:
    install-master.sh
  Modified files:
    install.sh

  Deleted: install-master.sh (+0 -150) 100644
===================================================================
--- install-master.sh    2014-09-12 19:38:40 +0900 (62815c4)
+++ /dev/null
@@ -1,150 +0,0 @@
-# Copyright (C) 2014 Droonga Project
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License version 2.1 as published by the Free Software Foundation.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
-
-# Usage:
-#   Install a release version:
-#     curl https://raw.githubusercontent.com/droonga/droonga-engine/master/install.sh | sudo bash
-#   Install the latest revision from the repository:
-#     curl https://raw.githubusercontent.com/droonga/droonga-engine/master/install.sh | INSTALL_VERSION=master sudo bash
-
-NAME=droonga-engine
-SCRIPT_URL=https://raw.githubusercontent.com/droonga/$NAME/master/install
-REPOSITORY_URL=https://github.com/droonga/$NAME.git
-USER=$NAME
-DROONGA_BASE_DIR=/home/$USER/droonga
-
-if [ "$INSTALL_VERSION" = "" ]; then
-  export INSTALL_VERSION=release
-fi
-
-exist_command() {
-  type "$1" > /dev/null 2>&1
-}
-
-exist_user() {
-  id "$1" > /dev/null 2>&1
-}
-
-prepare_user() {
-  if ! exist_user $USER; then
-    useradd -m $USER
-  fi
-}
-
-setup_configuration_directory() {
-  PLATFORM=$1
-
-  [ ! -e $DROONGA_BASE_DIR ] &&
-    mkdir $DROONGA_BASE_DIR
-  [ ! -e $DROONGA_BASE_DIR/catalog.json ] &&
-    droonga-engine-catalog-generate --output=$DROONGA_BASE_DIR/catalog.json
-  [ ! -e $DROONGA_BASE_DIR/$NAME.yaml ] &&
-    curl -o $DROONGA_BASE_DIR/$NAME.yaml $SCRIPT_URL/$PLATFORM/$NAME.yaml
-  chown -R $USER.$USER $DROONGA_BASE_DIR
-}
-
-install_rroonga() {
-  # Install Rroonga globally from a public gem, because custom build
-  # doesn't work as we expect for Droonga...
-  if exist_command grndump; then
-    current_version=$(grndump -v | cut -d " " -f 2)
-    version_matcher=$(cat droonga-engine.gemspec | \
-                      grep rroonga | \
-                      cut -d "," -f 2 | \
-                      cut -d '"' -f 2)
-    compared_version=$(echo "$version_matcher" | \
-                       cut -d " " -f 2)
-    operator=$(echo "$version_matcher" | cut -d " " -f 1)
-    compare_result=$(ruby -e "puts('$current_version' $operator '$compared_version')")
-    if [ $compare_result = "true" ]; then return 0; fi
-  fi
-  gem install rroonga --no-ri --no-rdoc
-}
-
-install_master() {
-  gem install bundler --no-ri --no-rdoc
-
-  if [ -d $NAME ]
-  then
-    cd $NAME
-    install_rroonga
-    git stash save
-    git pull --rebase
-    git stash pop
-    bundle update
-  else
-    git clone $REPOSITORY_URL
-    cd $NAME
-    install_rroonga
-    bundle install
-  fi
-  bundle exec rake build
-  gem install "pkg/*.gem" --no-ri --no-rdoc
-}
-
-install_service_script() {
-  INSTALL_LOCATION=$1
-  PLATFORM=$2
-  DOWNLOAD_URL=$SCRIPT_URL/$PLATFORM/$NAME
-  if [ ! -e $INSTALL_LOCATION ]
-  then
-    curl -o $INSTALL_LOCATION $DOWNLOAD_URL
-    chmod +x $INSTALL_LOCATION
-  fi
-}
-
-install_in_debian() {
-  apt-get update
-  apt-get -y upgrade
-  apt-get install -y ruby ruby-dev build-essential
-  if [ "$INSTALL_VERSION" = "master" ]; then
-    apt-get install -y git
-    install_master
-  else
-    gem install droonga-engine --no-rdoc --no-ri
-  fi
-
-  prepare_user
-
-  setup_configuration_directory debian
-
-  # register droogna-engine as a service
-  install_service_script /etc/init.d/$NAME debian
-  update-rc.d $NAME defaults
-}
-
-install_in_centos() {
-  yum update
-  yum -y groupinstall development
-  yum -y install ruby-devel git
-  install_master
-
-  prepare_user
-
-  setup_configuration_directory centos
-
-  # register droogna-engine as a service
-  install_service_script /etc/rc.d/init.d/$NAME centos
-  /sbin/chkconfig --add $NAME
-}
-
-if [ -e /etc/debian_version ] || [ -e /etc/debian_release ]; then
-  install_in_debian
-elif [ -e /etc/centos-release ]; then
-  install_in_centos
-else
-  echo "Not supported platform. This script works only for Debian or CentOS."
-  return 255
-fi

  Modified: install.sh (+64 -3)
===================================================================
--- install.sh    2014-09-12 19:38:40 +0900 (e4bf307)
+++ install.sh    2014-09-12 19:45:24 +0900 (994d32f)
@@ -13,11 +13,26 @@
 # License along with this library; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 
+# Usage:
+#   Install a release version:
+#     curl https://raw.githubusercontent.com/droonga/droonga-engine/master/install.sh | sudo bash
+#   Install the latest revision from the repository:
+#     curl https://raw.githubusercontent.com/droonga/droonga-engine/master/install.sh | INSTALL_VERSION=master sudo bash
+
 NAME=droonga-engine
 SCRIPT_URL=https://raw.githubusercontent.com/droonga/$NAME/master/install
+REPOSITORY_URL=https://github.com/droonga/$NAME.git
 USER=$NAME
 DROONGA_BASE_DIR=/home/$USER/droonga
 
+if [ "$INSTALL_VERSION" = "" ]; then
+  export INSTALL_VERSION=release
+fi
+
+exist_command() {
+  type "$1" > /dev/null 2>&1
+}
+
 exist_user() {
   id "$1" > /dev/null 2>&1
 }
@@ -40,6 +55,45 @@ setup_configuration_directory() {
   chown -R $USER.$USER $DROONGA_BASE_DIR
 }
 
+install_rroonga() {
+  # Install Rroonga globally from a public gem, because custom build
+  # doesn't work as we expect for Droonga...
+  if exist_command grndump; then
+    current_version=$(grndump -v | cut -d " " -f 2)
+    version_matcher=$(cat droonga-engine.gemspec | \
+                      grep rroonga | \
+                      cut -d "," -f 2 | \
+                      cut -d '"' -f 2)
+    compared_version=$(echo "$version_matcher" | \
+                       cut -d " " -f 2)
+    operator=$(echo "$version_matcher" | cut -d " " -f 1)
+    compare_result=$(ruby -e "puts('$current_version' $operator '$compared_version')")
+    if [ $compare_result = "true" ]; then return 0; fi
+  fi
+  gem install rroonga --no-ri --no-rdoc
+}
+
+install_master() {
+  gem install bundler --no-ri --no-rdoc
+
+  if [ -d $NAME ]
+  then
+    cd $NAME
+    install_rroonga
+    git stash save
+    git pull --rebase
+    git stash pop
+    bundle update
+  else
+    git clone $REPOSITORY_URL
+    cd $NAME
+    install_rroonga
+    bundle install
+  fi
+  bundle exec rake build
+  gem install "pkg/*.gem" --no-ri --no-rdoc
+}
+
 install_service_script() {
   INSTALL_LOCATION=$1
   PLATFORM=$2
@@ -55,7 +109,14 @@ install_in_debian() {
   apt-get update
   apt-get -y upgrade
   apt-get install -y ruby ruby-dev build-essential
-  gem install droonga-engine --no-rdoc --no-ri
+  if [ "$INSTALL_VERSION" = "master" ]; then
+    echo "Installing droonga-engine from the git repository..."
+    apt-get install -y git
+    install_master
+  else
+    echo "Installing droonga-engine from RubyGems..."
+    gem install droonga-engine --no-rdoc --no-ri
+  fi
 
   prepare_user
 
@@ -69,8 +130,8 @@ install_in_debian() {
 install_in_centos() {
   yum update
   yum -y groupinstall development
-  yum -y install ruby-devel
-  gem install droonga-engine --no-rdoc --no-ri
+  yum -y install ruby-devel git
+  install_master
 
   prepare_user
 
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index