[Groonga-commit] droonga/droonga-http-server at 593f896 [master] Declare local variables as "local"

Back to archive index

YUKI Hiroshi null+****@clear*****
Fri Sep 26 15:58:10 JST 2014


YUKI Hiroshi	2014-09-26 15:58:10 +0900 (Fri, 26 Sep 2014)

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

  Message:
    Declare local variables as "local"

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

  Modified: install.sh (+12 -12)
===================================================================
--- install.sh    2014-09-26 15:53:46 +0900 (c2f9daf)
+++ install.sh    2014-09-26 15:58:10 +0900 (593da85)
@@ -107,14 +107,14 @@ setup_configuration_directory() {
   [ ! -e $DROONGA_BASE_DIR ] &&
     mkdir $DROONGA_BASE_DIR
 
-  config_file="$DROONGA_BASE_DIR/$NAME.yaml"
+  local config_file="$DROONGA_BASE_DIR/$NAME.yaml"
   if [ ! -e $config_file ]; then
-    should_reconfigure_engine_host="false"
-    should_reconfigure_host="false"
+    local should_reconfigure_engine_host="false"
+    local should_reconfigure_host="false"
 
     if [ "$ENGINE_HOST" = "Auto Detect" ]; then
       ENGINE_HOST=""
-      engine_config="/home/droonga-engine/droonga/droonga-engine.yaml"
+      local engine_config="/home/droonga-engine/droonga/droonga-engine.yaml"
       if [ -e $engine_config ]; then
         ENGINE_HOST=$(cat $engine_config | grep -E "^ *host *:" | \
                       cut -d ":" -f 2 | $sed -e "s/^ +| +\$//g")
@@ -172,8 +172,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
@@ -184,17 +184,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

  Modified: install/centos/functions.sh (+4 -4)
===================================================================
--- install/centos/functions.sh    2014-09-26 15:53:46 +0900 (60b7b2f)
+++ install/centos/functions.sh    2014-09-26 15:58:10 +0900 (2c39532)
@@ -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:53:46 +0900 (922434d)
+++ install/debian/functions.sh    2014-09-26 15:58:10 +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
Back to archive index