[Groonga-commit] droonga/droonga-http-server at a6327e5 [master] Skip installation of platform packages if not needed

Back to archive index

SHIMODA Piro Hiroshi null+****@clear*****
Thu Sep 25 02:17:32 JST 2014


SHIMODA "Piro" Hiroshi	2014-09-25 02:17:32 +0900 (Thu, 25 Sep 2014)

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

  Message:
    Skip installation of platform packages if not needed

  Modified files:
    install.sh

  Modified: install.sh (+24 -2)
===================================================================
--- install.sh    2014-09-25 01:58:57 +0900 (4691fbc)
+++ install.sh    2014-09-25 02:17:32 +0900 (ad782ef)
@@ -45,6 +45,10 @@ EXPRESS_DROONGA_REPOSITORY_URL=git://github.com/droonga/express-droonga.git#mast
 : ${HOST:=Auto Detect}
 : ${ENGINE_HOST:=Auto Detect}
 
+REQUIRED_COMMANDS=npm
+[ "$VERSION" = "master" ] &&
+  REQUIRED_COMMANDS="$REQUIRED_COMMANDS git"
+
 case $(uname) in
   Darwin|*BSD|CYGWIN*) sed="sed -E" ;;
   *)                   sed="sed -r" ;;
@@ -54,6 +58,15 @@ exist_command() {
   type "$1" > /dev/null 2>&1
 }
 
+exist_all_commands() {
+  for command in $@; do
+    if ! exist_command $command; then
+      return 1
+    fi
+  done
+  return 0
+}
+
 exist_yum_repository() {
   yum repolist | grep --quiet "$1"
 }
@@ -62,6 +75,16 @@ exist_user() {
   id "$1" > /dev/null 2>&1
 }
 
+prepare_environment() {
+  if exist_all_commands $REQUIRED_COMMANDS; then
+    return 0
+  fi
+
+  echo "Preparing the environment..."
+  prepare_environment_in_$PLATFORM
+  return 0
+}
+
 prepare_user() {
   if ! exist_user $USER; then
     echo ""
@@ -266,8 +289,7 @@ register_service_in_centos() {
 
 
 install() {
-  echo "Preparing environment..."
-  prepare_environment_in_$PLATFORM
+  prepare_environment
 
   echo ""
   if [ "$VERSION" = "master" ]; then
-------------- next part --------------
HTML����������������������������...
Download 



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