forked from metomi/metomi-vms
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
executable file
·91 lines (80 loc) · 2.85 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
90
91
#!/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 && $release != 1804 ]]; 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 svn19'
wget -q http://opensource.wandisco.com/wandisco-debian.gpg -O- | sudo apt-key add -
elif [[ $dist == ubuntu && $release == 1604 ]]; then
add-apt-repository 'deb http://opensource.wandisco.com/ubuntu xenial svn19'
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.9/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.9/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 -yq update
apt-get -yq -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" upgrade
elif [[ $dist == redhat ]]; then
yum update -y
fi
# Use dos2unix in case any files have Windows EOL characters
if [[ $dist == ubuntu ]]; then
apt-get -yq install 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