-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdeploy_gerrit.sh
63 lines (54 loc) · 1.69 KB
/
deploy_gerrit.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
#!/bin/bash
#===============================================================================
#
# FILE: deploy_gerrit.sh
#
# USAGE: ./deploy_gerrit.sh
#
# DESCRIPTION: Install and configure Gerrit on CentOS 6
#
# OPTIONS: ---
# REQUIREMENTS: ---
# BUGS: ---
# NOTES: ---
# AUTHOR: Matt Coffey (),
# COMPANY:
# VERSION: 1.0
# CREATED: 05/09/14 13:23:13 GMT
# REVISION: ---
#===============================================================================
if [[ -f /etc/provisioned ]];
then
echo "Provisioned before on:"
echo "$(cat /etc/provisioned)"
echo "Skipping deploy_gerrit.sh..."
exit 0
fi
timestamp="(date + "%T")"
echo "Provisioned on $timestamp" > /etc/provisioned
while getopts i:h: option
do
case "${option}"
in
i) IP=$OPTARG;;
h) HOST=$OPTARG;;
esac
done
# Add this hostname to /etc/hosts
echo "127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4\n" > /etc/hosts
echo "::1 localhost localhost.localdomain localhost6 localhost6.localdomain6\n" >> /etc/hosts
echo "$IP $HOST $HOST" >> /etc/hosts
# Drop firewall TODO configure firewall instead
service iptables stop
# Install Java
rpm -ivh http://javadl.sun.com/webapps/download/AutoDL?BundleId=80804
# Install Git
yum -y install git
# Create gerrit2 user
sudo adduser gerrit2
# Download Gerrit
wget --quiet --no-check-certificate https://gerrit-releases.storage.googleapis.com/gerrit-2.8.5.war -O - >> /tmp/gerrit.war
chmod 555 /tmp/gerrit.war
# Initialise and start Gerrit
su - gerrit2 -c "java -jar /tmp/gerrit.war init --batch -d ~/gerrit"
exit 0