[Groonga-commit] droonga/droonga-engine at 2933c95 [master] Declare local variables as "local"

Zurück zum Archiv-Index

YUKI Hiroshi null+****@clear*****
Fri Sep 26 16:01:17 JST 2014


YUKI Hiroshi	2014-09-26 16:01:17 +0900 (Fri, 26 Sep 2014)

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

  Message:
    Declare local variables as "local"

  Modified files:
    install.sh
    install/centos/functions.sh
    install/debian/functions.sh

  Modified: install.sh (+17 -17)
===================================================================
--- install.sh    2014-09-26 15:52:39 +0900 (848ec45)
+++ install.sh    2014-09-26 16:01:17 +0900 (aa29371)
@@ -129,8 +129,8 @@ setup_configuration_directory() {
 
 guess_global_hostname() {
   if hostname -d > /dev/null 2>&1; then
-    domain=$(hostname -d)
-    hostname=$(hostname -s)
+    local domain=$(hostname -d)
+    local hostname=$(hostname -s)
     if [ "$domain" != "" ]; then
       echo "$hostname.$domain"
       return 0
@@ -141,17 +141,17 @@ guess_global_hostname() {
 }
 
 determine_hostname() {
-  global_hostname=$(guess_global_hostname)
+  local global_hostname=$(guess_global_hostname)
   if [ "$global_hostname" != "" ]; then
     echo "$global_hostname"
     return 0
   fi
 
-  address=$(hostname -i | \
-            $sed -e "s/127\.[0-9]+\.[0-9]+\.[0-9]+//g" \
-                 -e "s/  +/ /g" \
-                 -e "s/^ +| +\$//g" |\
-            cut -d " " -f 1)
+  local address=$(hostname -i | \
+                  $sed -e "s/127\.[0-9]+\.[0-9]+\.[0-9]+//g" \
+                       -e "s/  +/ /g" \
+                       -e "s/^ +| +\$//g" |\
+                  cut -d " " -f 1)
   if [ "$address" != "" ]; then
     echo "$address"
     return 0
@@ -178,15 +178,15 @@ 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 $NAME.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')")
+    local current_version=$(grndump -v | cut -d " " -f 2)
+    local version_matcher=$(cat $NAME.gemspec | \
+                            grep rroonga | \
+                            cut -d "," -f 2 | \
+                            cut -d '"' -f 2)
+    local compared_version=$(echo "$version_matcher" | \
+                             cut -d " " -f 2)
+    local operator=$(echo "$version_matcher" | cut -d " " -f 1)
+    local 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

  Modified: install/centos/functions.sh (+4 -4)
===================================================================
--- install/centos/functions.sh    2014-09-26 15:52:39 +0900 (d73de01)
+++ install/centos/functions.sh    2014-09-26 16:01:17 +0900 (56ae03e)
@@ -14,13 +14,13 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 
 register_service() {
-  NAME=$1
-  USER=$2
-  GROUP=$3
+  local NAME=$1
+  local USER=$2
+  local GROUP=$3
 
   #TODO: we should migrate to systemd in near future...
 
-  pid_dir=/run/$NAME
+  local pid_dir=/run/$NAME
   mkdir -p $pid_dir
   chown -R $USER:$GROUP $pid_dir
 

  Modified: install/debian/functions.sh (+4 -4)
===================================================================
--- install/debian/functions.sh    2014-09-26 15:52:39 +0900 (922434d)
+++ install/debian/functions.sh    2014-09-26 16:01:17 +0900 (ba1b36c)
@@ -14,11 +14,11 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 
 register_service() {
-  NAME=$1
-  USER=$2
-  GROUP=$3
+  local NAME=$1
+  local USER=$2
+  local GROUP=$3
 
-  pid_dir=/var/run/$NAME
+  local pid_dir=/var/run/$NAME
   mkdir -p $pid_dir
   chown -R $USER:$GROUP $pid_dir
 
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Zurück zum Archiv-Index