summaryrefslogtreecommitdiffstats
path: root/CentOS/gluster-setup.sh
diff options
context:
space:
mode:
authorhchiramm <hchiramm@redhat.com>2016-06-07 13:11:53 +0530
committerhchiramm <hchiramm@redhat.com>2016-06-07 13:14:08 +0530
commita37aa2f59a01c62111d3689f2695c607dee332af (patch)
treeb8769c8e4a65bb9d7ac7ae89a2dd980054651720 /CentOS/gluster-setup.sh
parent37aea94c8d4cb24ef71f4098cf1c5ab2656b9be3 (diff)
downloadgluster-a37aa2f59a01c62111d3689f2695c607dee332af.tar.gz
gluster-a37aa2f59a01c62111d3689f2695c607dee332af.tar.bz2
gluster-a37aa2f59a01c62111d3689f2695c607dee332af.tar.xz
gluster-a37aa2f59a01c62111d3689f2695c607dee332af.zip
Updating Dockerfile with setup scripts
Signed-off-by: hchiramm <hchiramm@redhat.com>
Diffstat (limited to 'CentOS/gluster-setup.sh')
-rw-r--r--CentOS/gluster-setup.sh69
1 files changed, 69 insertions, 0 deletions
diff --git a/CentOS/gluster-setup.sh b/CentOS/gluster-setup.sh
new file mode 100644
index 0000000..98570f5
--- /dev/null
+++ b/CentOS/gluster-setup.sh
@@ -0,0 +1,69 @@
+#!/bin/bash
+
+###
+# Description: Script to move the glusterfs initial setup to bind mounted directories of Atomic Host.
+# Copyright (c) 2016 Red Hat, Inc. <http://www.redhat.com>
+#
+# This file is part of GlusterFS.
+#
+# This file is licensed to you under your choice of the GNU Lesser
+# General Public License, version 3 or any later version (LGPLv3 or
+# later), or the GNU General Public License, version 2 (GPLv2), in all
+# cases as published by the Free Software Foundation.
+###
+
+main () {
+ if test "$(ls /var/lib/heketi/fstab)"
+ then
+ mount -a --fstab /var/lib/heketi/fstab
+ if [ $? -eq 1 ]
+ then
+ echo "mount failed"
+ exit 1
+ fi
+ echo "Mount Successful"
+ else
+ echo "heketi-fstab not found"
+ fi
+ DIR_1="/etc/glusterfs"
+ DIR_2="/var/log/glusterfs"
+ DIR_3="/var/lib/glusterd"
+ var=0
+ for i in $DIR_1 $DIR_2 $DIR_3
+ do
+ if test "$(ls $i)"
+ then
+ echo "$i is not empty"
+ var=$((var+1))
+ fi
+ done
+
+ if [ $var -eq 3 ]
+ then
+ exit 1
+ fi
+
+ cp -r /etc/glusterfs_bkp/* /etc/glusterfs
+ if [ $? -eq 1 ]
+ then
+ echo "Failed to copy $DIR_1"
+ exit 1
+ fi
+
+ cp -r /var/log/glusterfs_bkp/* /var/log/glusterfs
+ if [ $? -eq 1 ]
+ then
+ echo "Failed to copy $DIR_2"
+ exit 1
+ fi
+
+ cp -r /var/lib/glusterd_bkp/* /var/lib/glusterd
+ if [ $? -eq 1 ]
+ then
+ echo "Failed to copy $DIR_3"
+ exit 1
+ fi
+
+ echo "Script Ran Successfully"
+}
+main