forked from dpmatthews/metomi-vms
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·89 lines (78 loc) · 2.62 KB
/
install.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#!/bin/bash
STARTDATE=$(date +"%Y-%m-%dT%H%M")
{
set -x
dist=$1
release=$2
collections="base ${@:3}"
if [[ $collections =~ desktop ]]; then
# Disable logins during installation
echo "Installation in progress, please wait" > /etc/nologin
fi
if [[ $dist == ubuntu ]]; then
# Address issues some hosts experience with networking (specifically, DNS latency)
# See https://github.com/mitchellh/vagrant/issues/1172
if [ ! $(grep single-request-reopen /etc/resolvconf/resolv.conf.d/base) ]; then
echo "options single-request-reopen" >> /etc/resolvconf/resolv.conf.d/base && resolvconf -u
fi
fi
if [[ $dist == redhat && $release == centos* ]]; then
# Add the EPEL repository
yum install -y epel-release
fi
# Use the WANdisco subversion packages
if [[ $dist == ubuntu && $release == 1404 ]]; then
add-apt-repository 'deb http://opensource.wandisco.com/ubuntu trusty svn18'
wget -q http://opensource.wandisco.com/wandisco-debian.gpg -O- | sudo apt-key add -
elif [[ $dist == redhat && $release == centos6 ]]; then
cat > /etc/yum.repos.d/WANdisco-svn.repo <<EOF
[WANdisco-svn]
name=WANdisco SVN Repo
enabled=1
baseurl=http://opensource.wandisco.com/centos/6/svn-1.8/RPMS/\$basearch/
gpgcheck=1
gpgkey=http://opensource.wandisco.com/RPM-GPG-KEY-WANdisco
EOF
elif [[ $dist == redhat && $release == centos7 ]]; then
cat > /etc/yum.repos.d/WANdisco-svn.repo <<EOF
[WANdisco-svn]
name=WANdisco SVN Repo
enabled=1
baseurl=http://opensource.wandisco.com/centos/7/svn-1.8/RPMS/\$basearch/
gpgcheck=1
gpgkey=http://opensource.wandisco.com/RPM-GPG-KEY-WANdisco
EOF
fi
# Get the latest package info and install any updates
if [[ $dist == ubuntu ]]; then
export DEBIAN_FRONTEND=noninteractive # Disable user interaction
apt-get update -q -y
apt-get upgrade -q -y
elif [[ $dist == redhat ]]; then
# NB: Disabled since /vagrant fails to mount after this is run
: #yum update -y
fi
# Use dos2unix in case any files have Windows EOL characters
if [[ $dist == ubuntu ]]; then
apt-get install -q -y dos2unix
elif [[ $dist == redhat ]]; then
yum install -y dos2unix
fi
for collection in $collections; do
echo $(date +"%Y-%m-%dT%H%M") - Installing $collection collection ...
dos2unix -n /vagrant/install-$collection.sh /tmp/install-$collection.sh
. /tmp/install-$collection.sh
rm /tmp/install-$collection.sh
done
set +x
echo Finished provisioning at $(date +"%Y-%m-%dT%H%M") \(started at $STARTDATE\)
echo
if [[ $collections =~ desktop ]]; then
echo Shutting down the system.
echo Please run vagrant up to restart it.
rm /etc/nologin
sudo shutdown -h now
else
echo Please run vagrant ssh to connect.
fi
} |& tee -a /var/log/install.log