Updated Branches:
  refs/heads/master c01173ce3 -> 32499e86b

Changes for stratos installer

Signed-off-by: Manula Thantriwatte <[email protected]>


Project: http://git-wip-us.apache.org/repos/asf/incubator-stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-stratos/commit/32499e86
Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/32499e86
Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/32499e86

Branch: refs/heads/master
Commit: 32499e86bd3cb3c5bc8eaf69ea11d1133b826cf7
Parents: c01173c
Author: Dinesh Bandara <[email protected]>
Authored: Fri Dec 13 18:01:24 2013 +0530
Committer: Manula Thantriwatte <[email protected]>
Committed: Tue Dec 17 11:15:23 2013 +0530

----------------------------------------------------------------------
 tools/stratos-installer/setup.sh | 65 ++++++++++++++++++++++++++++++++---
 1 file changed, 60 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/32499e86/tools/stratos-installer/setup.sh
----------------------------------------------------------------------
diff --git a/tools/stratos-installer/setup.sh b/tools/stratos-installer/setup.sh
index 3d2f261..2e9b3f5 100755
--- a/tools/stratos-installer/setup.sh
+++ b/tools/stratos-installer/setup.sh
@@ -130,7 +130,23 @@ export $enable_internal_git
 export $host_user
 export hostname=`hostname -f`
 
-
+# Check validity of IP
+function valid_ip()
+{
+    local  ip=$1
+    local  stat=1
+
+    if [[ $ip =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
+        OIFS=$IFS
+        IFS='.'
+        ip=($ip)
+        IFS=$OIFS
+        [[ ${ip[0]} -le 255 && ${ip[1]} -le 255 \
+            && ${ip[2]} -le 255 && ${ip[3]} -le 255 ]]
+        stat=$?
+    fi
+    return $stat
+}
 
 function helpsetup {
     echo ""
@@ -149,8 +165,12 @@ function general_conf_validate {
         echo "Please specify the stratos domain"
         exit 1
     fi
-    if [[ (-z $mb_port_offset || -z $mb_ip ) ]]; then
-        echo "Please specify the ip and the port offset of MB"
+    if [[ (-z $mb_port_offset || -z $mb_ip || -z $mb_hostname) ]]; then
+        echo "Please specify the ip, the port offset and the hostname of MB"
+        exit 1
+    fi
+    if !(valid_ip $mb_ip); then 
+        echo "Please provide valid ip for MB's ip"
         exit 1
     fi
 }
@@ -181,6 +201,9 @@ function lb_conf_validate {
     if [[ -z $lb_cep_ip ]]; then
        echo "Please specify the ip of CEP in conf/setup.conf"
        exit 1
+    elif !(valid_ip $lb_cep_ip); then 
+        echo "Please provide valid ip for CEP's ip"
+        exit 1
     fi
 }
 
@@ -230,7 +253,17 @@ function sm_conf_validate {
         echo "Please specify the port offset of CC"
         exit 1
     fi
-
+    if [[ -z $sm_ip || -z $as_ip || -z $cc_ip ]]; then
+       echo "Please specify the ips of SM and/or AS and/or CC"
+       exit 1
+    elif !(valid_ip $sm_ip && valid_ip $cc_ip && valid_ip $as_ip); then 
+        echo "Please provide valid ips for SM and/or AS and/or CC"
+        exit 1
+    fi
+    if [[-z $cc_hostname || -z $as_hostname ]]; then
+       echo "Please specify valid hostname for AS and/or CC"
+       exit 1
+    elif
 }
 
 
@@ -483,7 +516,7 @@ function sm_setup {
     echo "Setup SM" >> $LOG
     echo "Configuring Stratos Manager"
 
-    cp -f ./config/sc/repository/conf/carbon.xml $sm_path/repository/conf/
+    cp -f ./config/sm/repository/conf/carbon.xml $sm_path/repository/conf/
     cp -f ./config/sm/repository/conf/jndi.properties $sm_path/repository/conf/
     cp -f ./config/sm/repository/conf/cartridge-config.properties 
$sm_path/repository/conf/
     cp -f ./config/sm/repository/conf/datasources/master-datasources.xml 
$sm_path/repository/conf/datasources/
@@ -569,6 +602,28 @@ fi
 
 
 # ------------------------------------------------
+# Mapping domain/host names 
+# ------------------------------------------------
+
+cp -f /etc/hosts hosts.tmp
+
+
+echo "$mb_ip $mb_hostname      # message broker hostname"      >> hosts.tmp
+
+if [[ $lb = "true" ]]; then
+    echo "$lb_cep_ip $cep_hostname     # load balancer hostname"       >> 
hosts.tmp
+fi
+
+if [[ $sm = "true" ]]; then
+    echo "$sm_ip $sm_hostname  # stratos domain"       >> hosts.tmp
+    echo "$cc_ip $cc_hostname  # cloud controller hostname"    >> hosts.tmp
+    echo "$as_ip $as_hostname  # auto scalar hostname" >> hosts.tmp
+fi
+
+mv -f ./hosts.tmp /etc/hosts
+
+
+# ------------------------------------------------
 # Starting the servers
 # ------------------------------------------------
 echo "Starting the servers" >> $LOG

Reply via email to