This repository has been archived by the owner on Feb 8, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathcommon-repo.sh
83 lines (74 loc) · 2.56 KB
/
common-repo.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
#!/bin/bash
# Setup yum repos for broker
# setup variables
source ./oo-install.conf
# Setup the release variable
if [ "$DISTRO" == "fedora18" ] ; then
RELEASE="fedora-18"
elif [ "$DISTRO" == "fedora19" ] ; then
RELEASE="fedora-19"
elif [ "$DISTRO" == "fedora20" ] ; then
RELEASE="fedora-20"
elif [ "$DISTRO" == "rhel6" ] ; then
RELEASE="rhel-6"
rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
else
echo "Your distro is not supported. Exiting ..."
exit 1
fi
# Setup the main and dependancy repo URLS
if [ "$OPENSHIFT_SOURCE" == "nightly" ] ; then
MAINURL="https://mirror.openshift.com/pub/openshift-origin/nightly/$RELEASE/packages/latest/$ARCH/"
DEPURL="https://mirror.openshift.com/pub/openshift-origin/nightly/$RELEASE/dependencies/$ARCH/"
elif [ "$OPENSHIFT_SOURCE" == "v1" ] ; then
if [ "$ARCH" == "x86_64" ] ; then
if [ "$DISTRO" == "rhel6" ] || [ "$DISTRO" == "fedora18" ] ; then
MAINURL="https://mirror.openshift.com/pub/openshift-origin/release/1/$RELEASE/packages/$ARCH/"
DEPURL="https://mirror.openshift.com/pub/openshift-origin/release/1/$RELEASE/dependancies/$ARCH/"
else
echo "Release v1 only supports rhel6 and fedora18, not $DISTRO. Exiting ..."
exit 2
fi
else
echo "Release v1 only supports x86_64, not $ARCH. Exiting ..."
exit 3
fi
elif [ "$OPENSHIFT_SOURCE" == "v2" ] ; then
if [ "$ARCH" == "x86_64" ] ; then
if [ "$DISTRO" == "rhel6" ] || [ "$DISTRO" == "fedora19" ] ; then
MAINURL="https://mirror.openshift.com/pub/openshift-origin/release/1/$RELEASE/packages/$ARCH/"
DEPURL="https://mirror.openshift.com/pub/openshift-origin/release/1/$RELEASE/dependancies/$ARCH/"
else
echo "Release v2 only supports rhel6 and fedora19, not $DISTRO. Exiting ..."
exit 2
fi
else
echo "Release v2 only supports x86_64, not $ARCH. Exiting ..."
exit 3
fi
elif [ "$OPENSHIFT_SOURCE" == "distro" ] ; then
echo "There is no need to setup the yum repo if your souce is distro. Exiting ..."
exit 4
else
echo "Your yum source is not supported. Exiting ..."
exit 5
fi
# Move old repo out of the way if it's there
if [ -f /etc/yum.repos.d/openshift-origin.repo ] ; then
mv -f /etc/yum.repos.d/openshift-origin.repo /etc/yum.repos.d/openshift-origin.repo.save
fi
# Create our new repo file
cat <<EOF > /etc/yum.repos.d/openshift-origin.repo
[openshift-origin]
name=OpenShift Origin $OPENSHIFT_SOURCE $ARCH
baseurl=$MAINURL
enabled=1
metadata_expire=1d
gpgcheck=0
[openshift-origin-deps]
name=OpenShift Origin Dependancies $OPENSHIFT_SOURCE $ARCH
baseurl=$DEPURL
enabled=1
metadata_expire=1d
gpgcheck=0
EOF