This repository has been archived by the owner on Nov 7, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
enable-ius.sh
80 lines (71 loc) · 1.96 KB
/
enable-ius.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
#!/bin/bash
#
# Script to setup the IUS public repository on your EL server.
# Tested on CentOS/RHEL 5/6/7.
el5_download_install(){
wget -O /tmp/release.rpm ${1}
yum -y localinstall /tmp/release.rpm
rm -f /tmp/release.rpm
}
centos_install_epel(){
# CentOS has epel release in the extras repo
yum -y install epel-release
import_epel_key
}
rhel_install_epel(){
case ${RELEASE} in
5*) el5_download_install https://dl.fedoraproject.org/pub/epel/epel-release-latest-5.noarch.rpm;;
6*) yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm;;
7*) yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm;;
esac
import_epel_key
}
import_epel_key(){
case ${RELEASE} in
5*) rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL;;
6*) rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6;;
7*) rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7;;
esac
}
centos_install_ius(){
case ${RELEASE} in
5*) el5_download_install https://centos5.iuscommunity.org/ius-release.rpm;;
6*) yum -y install https://centos6.iuscommunity.org/ius-release.rpm;;
7*) yum -y install https://centos7.iuscommunity.org/ius-release.rpm;;
esac
import_ius_key
}
rhel_install_ius(){
case ${RELEASE} in
5*) el5_download_install https://rhel5.iuscommunity.org/ius-release.rpm;;
6*) yum -y install https://rhel6.iuscommunity.org/ius-release.rpm;;
7*) yum -y install https://rhel7.iuscommunity.org/ius-release.rpm;;
esac
import_ius_key
}
import_ius_key(){
rpm --import /etc/pki/rpm-gpg/IUS-COMMUNITY-GPG-KEY
}
if [[ -e /etc/redhat-release ]]; then
RELEASE_RPM=$(rpm -qf /etc/redhat-release)
RELEASE=$(rpm -q --qf '%{VERSION}' ${RELEASE_RPM})
case ${RELEASE_RPM} in
centos*)
echo "detected CentOS ${RELEASE}"
centos_install_epel
centos_install_ius
;;
redhat*)
echo "detected RHEL ${RELEASE}"
rhel_install_epel
rhel_install_ius
;;
*)
echo "unknown EL clone"
exit 1
;;
esac
else
echo "not an EL distro"
exit 1
fi