-
Notifications
You must be signed in to change notification settings - Fork 11
/
bootstrap-osg-test
executable file
·121 lines (107 loc) · 3.2 KB
/
bootstrap-osg-test
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#!/bin/bash
UPSTREAM=https://github.com/opensciencegrid
on_error_die()
{
if [ $? -ne 0 ]; then
echo 'FAILED!'
echo $1
exit 1
else
echo 'done'
fi
}
if [ $# -ne 1 ]; then
echo "Requires the major version number, i.e. 3.2 for 3.2.0"
echo "usage: $0 <major version>"
exit 1
fi
if [[ $1 =~ ^[0-9]+\.[0-9]+$ ]]; then
version=$1
else
echo "Major version should be in the form of '<number>.<number>, i.e. 3.2"
echo "usage: $0 <major version>"
exit 1
fi
# Determine platform-specific details
release=`cat /etc/redhat-release`
case $release in
*6.* )
rpm_name='epel-release-latest-6.noarch.rpm'
osg_name="osg-$version-el6-release-latest.rpm"
;;
*7.* )
rpm_name='epel-release-latest-7.noarch.rpm'
osg_name="osg-$version-el7-release-latest.rpm"
;;
*8.* )
rpm_name='epel-release-latest-8.noarch.rpm'
osg_name="osg-$version-el8-release-latest.rpm"
;;
* )
echo 'Could not determine OS release'
exit 1
;;
esac
rpm_path="https://dl.fedoraproject.org/pub/epel/$rpm_name"
epel_rpm=`rpm -q epel-release 2>/dev/null`
if [ $? -eq 1 ]; then
echo -n "Downloading $rpm_name... "
if [ ! -f $rpm_name ]; then
curl --fail --location --output $rpm_name --retry 10 --silent $rpm_path
on_error_die "Could not download $rpm_name"
else
echo 'already downloaded'
fi
echo -n 'Installing epel-release... '
rpm --install --nosignature $rpm_name
on_error_die "Could not install $rpm_name"
else
echo 'Already installed: epel-release'
fi
echo -n "Ensuring epel is enabled... "
sed -i '/\[epel\]/, /\[.*\]/ s/enabled=0/enabled=1/' /etc/yum.repos.d/epel.repo
on_error_die "Could not enable epel"
osg_rpm=`rpm -q osg-release 2>/dev/null`
if [ $? -eq 1 ]; then
echo -n "Downloading $osg_name... "
curl --fail --location --output $osg_name --retry 10 --silent \
https://repo.opensciencegrid.org/osg/$version/$osg_name
on_error_die "Could not download $osg_name"
echo -n 'Installing osg-release... '
rpm --install --nosignature $osg_name
on_error_die "Could not install $osg_name"
else
echo 'Already installed: osg-release'
fi
echo -n "Installing python3 if needed... "
yum -y --quiet install python3
on_error_die "Could not install python3"
echo -n 'Updating osg-release... '
yum -y --quiet update osg-release
on_error_die 'Could not update osg-release'
case $release in
*[67].* )
echo -n "Install yum-plugin-priorities... (For EL6, EL7 only)"
yum -y --quiet install yum-plugin-priorities
on_error_die "Could not install yum-plugin-priorities"
echo -n 'Verify yum-plugin-priorities... '
rpm --verify yum-plugin-priorities
on_error_die "Could not verify yum-plugin-priorities"
;;
*8.* )
echo -n "Not installing plugin priorities in EL8"
;;
* )
echo 'Could not determine OS release'
exit 1
;;
esac
cd /tmp
for repo in osg-test osg-ca-generator; do
git clone --depth 1 $UPSTREAM/$repo
on_error_die "Failed to clone $UPSTREAM/$repo"
pushd $repo
make install
on_error_die "Failed to install $repo"
popd
done