-
Notifications
You must be signed in to change notification settings - Fork 0
/
rpminstall.sh
executable file
·71 lines (57 loc) · 1.23 KB
/
rpminstall.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/bash
# Wget the RPMs and install
#
RpmGetInstall()
{
echo "Installing RPMs"
#get the rpm from repo
wget http://bits.gluster.com/pub/gluster/glusterfs/$VERSION/x86_64/glusterfs-core-$VERSION-1.x86_64.rpm
ret=$?
if [ $ret -eq 0 ]; then
echo "wget on core rpm succeeded"
else
echo "wget on core rpm failed"
exit 1
fi
wget http://bits.gluster.com/pub/gluster/glusterfs/$VERSION/x86_64/glusterfs-fuse-$VERSION-1.x86_64.rpm
ret=$?
if [ $ret -eq 0 ]; then
echo "wget on fuse rpm succeeded"
else
echo "wget on fuse rpm failed"
exit 1
fi
#install the RPMS
rpm -ivh glusterfs-*-$VERSION-1.x86_64.rpm --nodeps
ret=$?
if [ $ret -eq 0 ]; then
echo "RPM install succeede"
else
echo "RPM install failed"
exit 1
fi
}
#
#Main starts here
#
if [ $# -ne 1 ]; then
echo "Usage: ./rpminstall \$VERSION"
exit 1
fi
VERSION=$1
rpm -qa | grep glusterfs
ret=$?
if [ $ret -eq 0 ]; then
echo "RPM is present need to be removed"
rpm -e `rpm -qa | grep glusterfs`
ret=$?
if [ $ret -eq 0 ]; then
echo "RPM removed successfully"
RpmGetInstall
else
echo "Failed to remove RPM"
exit 1
fi
else
RpmGetInstall
fi