[Groonga-commit] droonga/droonga-http-server at 20b0021 [master] Support installation of "master" from the repository

Back to archive index

YUKI Hiroshi null+****@clear*****
Fri Sep 12 20:27:09 JST 2014


YUKI Hiroshi	2014-09-12 20:27:09 +0900 (Fri, 12 Sep 2014)

  New Revision: 20b0021e6039214d5ebf8cb69d62609f1f86a536
  https://github.com/droonga/droonga-http-server/commit/20b0021e6039214d5ebf8cb69d62609f1f86a536

  Message:
    Support installation of "master" from the repository

  Modified files:
    install.sh

  Modified: install.sh (+58 -2)
===================================================================
--- install.sh    2014-09-12 20:09:54 +0900 (1c30a9e)
+++ install.sh    2014-09-12 20:27:09 +0900 (ce2ddc6)
@@ -13,11 +13,29 @@
 # 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-http-server/master/install.sh | sudo bash
+#   Install the latest revision from the repository:
+#     curl https://raw.githubusercontent.com/droonga/droonga-http-server/master/install.sh | sudo INSTALL_VERSION=master bash
+
 NAME=droonga-http-server
 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
 
+EXPRESS_DROONGA_REPOSITORY_URL=git://github.com/droonga/express-droonga.git#master
+
+if [ "$INSTALL_VERSION" = "" ]; then
+  export INSTALL_VERSION=release
+fi
+
+case $(uname) in
+  Darwin|*BSD|CYGWIN*) sed="sed -E" ;;
+  *)                   sed="sed -r" ;;
+esac
+
 exist_user() {
   id "$1" > /dev/null 2>&1
 }
@@ -38,6 +56,30 @@ setup_configuration_directory() {
   chown -R $USER.$USER $DROONGA_BASE_DIR
 }
 
+use_master_express_droonga() {
+  mv package.json package.json.bak
+  cat package.json.bak | $sed -e "s;(express-droonga.+)\*;\1$EXPRESS_DROONGA_REPOSITORY_URL;" > package.json
+}
+
+install_master() {
+  if [ -d $NAME ]
+  then
+    cd $NAME
+    git stash save
+    git pull --rebase
+    git stash pop
+    use_master_express_droonga
+    npm update
+  else
+    git clone $REPOSITORY_URL
+    cd $NAME
+    use_master_express_droonga
+  fi
+  npm install -g
+  rm package.json
+  mv package.json.bak package.json
+}
+
 install_service_script() {
   INSTALL_LOCATION=$1
   PLATFORM=$2
@@ -54,7 +96,14 @@ install_in_debian() {
   apt-get update
   apt-get -y upgrade
   apt-get install -y nodejs nodejs-legacy npm
-  npm install -g droonga-http-server
+  if [ "$INSTALL_VERSION" = "master" ]; then
+    echo "Installing $NAME from the git repository..."
+    apt-get install -y git
+    install_master
+  else
+    echo "Installing $NAME from npmjs.org..."
+    npm install -g droonga-http-server
+  fi
 
   prepare_user
   
@@ -73,7 +122,14 @@ install_in_centos() {
   yum -y update
   yum -y install epel-release
   yum -y install npm
-  npm install -g droonga-http-server
+  if [ "$INSTALL_VERSION" = "master" ]; then
+    echo "Installing $NAME from the git repository..."
+    yum -y install git
+    install_master
+  else
+    echo "Installing $NAME from npmjs.org..."
+    npm install -g droonga-http-server
+  fi
 
   prepare_user
 
-------------- next part --------------
HTML����������������������������...
Download 



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