summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaghavendra Bhat <raghavendrabhat@gluster.com>2011-10-13 15:02:24 +0530
committerRaghavendra Bhat <raghavendrabhat@gluster.com>2011-10-13 15:02:24 +0530
commitd5457aa0ba65d2a54ef310f1dd9e8adddb0fd465 (patch)
tree58749b23f6a6393daeba4f130d30756fc27835f9
parentb535262e2e4105e67df260465851c8a9bc6ed5ae (diff)
helper_scripts/install_glusterfs_rpm: script to install glusterfs rpm parallely on multiple machines
installs the glusterfs rpm of specified version (can upgrade too depending upon the arguments), on multiple machines parallely. And also some changes to the rpm installing script helper_scripts/rpm_download_install.
-rw-r--r--helper_scrips/INFO2
-rwxr-xr-xhelper_scrips/install_glusterfs_rpm.sh75
-rwxr-xr-xhelper_scrips/rpm_download_install.sh33
3 files changed, 98 insertions, 12 deletions
diff --git a/helper_scrips/INFO b/helper_scrips/INFO
index ad0d600..d030697 100644
--- a/helper_scrips/INFO
+++ b/helper_scrips/INFO
@@ -19,3 +19,5 @@ helper_scripts/install_parallel_glusterfs.sh --------> executes the download_and
=============================================================================================================================================
helper_scrips/glusterfs_uninstall.sh ------> uninstalls the specified glusterfs version if it finds the source directory.
herper_scripts/multi_uninstall.sh -------> uninstalls the specified glusterfs from multiple machines, by executing glusterfs_uninstall.sh script.
+
+helper_scrips/install_glusterfs_rpm.sh -----> installs the specified glusterfs rpms on the machines whose list is provided in /root/machines,parallely \ No newline at end of file
diff --git a/helper_scrips/install_glusterfs_rpm.sh b/helper_scrips/install_glusterfs_rpm.sh
new file mode 100755
index 0000000..4e82b58
--- /dev/null
+++ b/helper_scrips/install_glusterfs_rpm.sh
@@ -0,0 +1,75 @@
+#!/bin/bash
+
+function _init ()
+{
+ set -u;
+ VERSION=$1;
+ if [ $# -lt 2 ]; then
+ upgrade="no";
+ else
+ if [ $2 == "yes" ]; then
+ upgrade="yes";
+ else
+ upgrade="no";
+ fi
+ fi
+}
+
+function install_glusterfs ()
+{
+ local remote_server=;
+
+ if [ $# -eq 1 ]; then
+ remote_server=$1;
+ fi
+
+ if [ $remote_server ]; then
+ ssh $remote_server cp -f /root/scripts/rpm_download_install.sh /root/;
+ ssh $remote_server /root/rpm_download_install.sh $VERSION $upgrade;
+ return 0;
+ fi
+
+ j=0;
+ for i in $(cat /root/machines)
+ do
+ j=$(($j+1));
+ (install_glusterfs $i)&
+ done
+
+}
+
+function install_my_glusterfs ()
+{
+ old_PWD=$PWD;
+
+ cd /root;
+ cp /root/scripts/rpm_download_install.sh /root/;
+ /root/rpm_download_install.sh $VERSION $upgrade;
+
+ cd $old_PWD;
+ return 0;
+}
+
+function main ()
+{
+ stat --printf=%i /root/machines 2>/dev/null 1>/dev/null;
+ if [ $? -ne 0 ]; then
+ echo "servers file is not present /root. Cannot execute further.";
+
+ exit 1;
+ fi
+
+ install_glusterfs;
+ for i in $(1 $j)
+ do
+ wait %$j;
+ done
+
+ install_my_glusterfs;
+
+ return 0;
+}
+
+_init "$@" && main "$@"
+
+
diff --git a/helper_scrips/rpm_download_install.sh b/helper_scrips/rpm_download_install.sh
index 4bbbea5..f1a071a 100755
--- a/helper_scrips/rpm_download_install.sh
+++ b/helper_scrips/rpm_download_install.sh
@@ -31,24 +31,24 @@ function _init ()
echo $version | grep "3.2" 2>/dev/null 1>/dev/null;
if [ $? -eq 0 ]; then
version_number=$(echo $version | cut -f 2 -d "-");
- download_address="http://download.gluster.com/pub/gluster/glusterfs/3.2/$version_number/CentOS/";
+ download_address="http://download.gluster.com/pub/gluster/glusterfs/3.2/$version_number/RHEL/";
else
grep "3.1" $version 2>/dev/null 1>/dev/null;
echo "haha yes"
if [ $? -eq 0 ]; then
version_number=$(echo $version | cut -f 2 -d "-");
- download_address="http://download.gluster.com/pub/gluster/glusterfs/3.1/$version_number/CentOS/";
+ download_address="http://download.gluster.com/pub/gluster/glusterfs/3.1/$version_number/RHEL/";
else
grep "3.0" $version 2>/dev/null 1>/dev/null;
if [ $? -eq 0 ]; then
version_number=$(cut -f 2 -d "-" $version);
- download_address="http://download.gluster.com/pub/gluster/glusterfs/3.0/$version_number/CentOS/";
+ download_address="http://download.gluster.com/pub/gluster/glusterfs/3.0/$version_number/RHEL/";
fi
fi
fi
fi
- echo "KK: $download_address"
+ echo "Download address: $download_address" && sleep 2;
# ls -l "$version".tar.gz 2>/dev/null 1>/dev/null
# if [ $? -ne 0 ]; then
}
@@ -68,7 +68,12 @@ function download_rpms ()
address=$1;
local ret;
- mkdir $PWD/rpms/$version_number;
+ if [ ! -d $PWD/rpms ] || [ ! -d $PWD/rpms/$version_number ]; then
+ mkdir $PWD/rpms/$version_number -p;
+ else
+ echo "the directory for the mentioned versrion $version_number is present";
+ return;
+ fi
cd $PWD/rpms/$version_number;
@@ -82,7 +87,7 @@ function download_rpms ()
check_if_qa_release $version;
ret=$?
- if [$ret -eq 0 ]; then
+ if [ $ret -eq 0 ]; then
wget $address/$version_number/x86_64/glusterfs-core-$version_number-1.x86_64.rpm;
wget $address/$version_number/x86_64/glusterfs-debuginfo-$version_number-1.x86_64.rpm;
wget $address/$version_number/x86_64/glusterfs-fuse-$version_number-1.x86_64.rpm;
@@ -91,11 +96,11 @@ function download_rpms ()
echo "3.2 version";
fi
else
- wget $address/glusterfs-core-$version_number-1.x86_64.rpm;
- wget $address/glusterfs-debuginfo-$version_number-1.x86_64.rpm;
- wget $address/glusterfs-fuse-$version_number-1.x86_64.rpm;
+ wget $address/glusterfs-core-$version_number-1.el6.x86_64.rpm;
+ wget $address/glusterfs-debuginfo-$version_number-1.el6.x86_64.rpm;
+ wget $address/glusterfs-fuse-$version_number-1.el6.x86_64.rpm;
if [ $is_32 -eq 0 ]; then
- wget $address/glusterfs-geo-replication-$version_number-1.x86_64.rpm;
+ wget $address/glusterfs-geo-replication-$version_number-1.el6.x86_64.rpm;
echo "3.2 version";
fi
fi
@@ -104,7 +109,11 @@ function download_rpms ()
function install_or_upgrade ()
{
- cd /root/rpms/$version_number;
+ local old_PWD;
+
+ old_PWD=$PWD;
+
+ cd $PWD/rpms/$version_number;
if [ $upgrade != "yes" ]; then
for i in $(ls)
do
@@ -118,7 +127,7 @@ function install_or_upgrade ()
fi
ret=$?;
- cd /root;
+ cd $old_PWD;
ldconfig;
return $ret;