Skip to content

Commit

Permalink
Updated the CentOS 6 scripts/config to use Vault repos.
Browse files Browse the repository at this point in the history
  • Loading branch information
ladar committed Dec 2, 2020
1 parent 5fcda9e commit cb7a7f0
Show file tree
Hide file tree
Showing 19 changed files with 75 additions and 16 deletions.
1 change: 1 addition & 0 deletions developer-hyperv.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
{
"type": "shell",
"scripts": [
"scripts/centos6/yum.sh",
"scripts/centos6/base.sh",
"scripts/centos6/network.sh"
],
Expand Down
1 change: 1 addition & 0 deletions developer-libvirt.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
{
"type": "shell",
"scripts": [
"scripts/centos6/yum.sh",
"scripts/centos6/base.sh",
"scripts/centos6/network.sh"
],
Expand Down
1 change: 1 addition & 0 deletions developer-ova.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
{
"type": "shell",
"scripts": [
"scripts/centos6/yum.sh",
"scripts/centos6/base.sh",
"scripts/centos6/network.sh"
],
Expand Down
1 change: 1 addition & 0 deletions developer-virtualbox.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
{
"type": "shell",
"scripts": [
"scripts/centos6/yum.sh",
"scripts/centos6/base.sh",
"scripts/centos6/network.sh"
],
Expand Down
1 change: 1 addition & 0 deletions developer-vmware.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
{
"type": "shell",
"scripts": [
"scripts/centos6/yum.sh",
"scripts/centos6/base.sh",
"scripts/centos6/network.sh"
],
Expand Down
1 change: 1 addition & 0 deletions generic-docker.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
{
"type": "shell",
"scripts": [
"scripts/centos6/yum.sh",
"scripts/centos6/base.sh",
"scripts/centos6/network.sh",
"scripts/centos6/vga.sh"
Expand Down
1 change: 1 addition & 0 deletions generic-hyperv.json
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@
{
"type": "shell",
"scripts": [
"scripts/centos6/yum.sh",
"scripts/centos6/base.sh",
"scripts/centos6/network.sh"
],
Expand Down
1 change: 1 addition & 0 deletions generic-libvirt.json
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@
{
"type": "shell",
"scripts": [
"scripts/centos6/yum.sh",
"scripts/centos6/base.sh",
"scripts/centos6/network.sh"
],
Expand Down
1 change: 1 addition & 0 deletions generic-parallels.json
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@
{
"type": "shell",
"scripts": [
"scripts/centos6/yum.sh",
"scripts/centos6/base.sh",
"scripts/centos6/network.sh"
],
Expand Down
1 change: 1 addition & 0 deletions generic-virtualbox.json
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@
{
"type": "shell",
"scripts": [
"scripts/centos6/yum.sh",
"scripts/centos6/base.sh",
"scripts/centos6/network.sh"
],
Expand Down
1 change: 1 addition & 0 deletions generic-vmware.json
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@
{
"type": "shell",
"scripts": [
"scripts/centos6/yum.sh",
"scripts/centos6/base.sh",
"scripts/centos6/network.sh"
],
Expand Down
2 changes: 1 addition & 1 deletion http/magma.centos6.developer.ks
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
install
url --url=https://mirrors.kernel.org/centos/6/os/x86_64/
url --url=https://vault.centos.org/6.10/os/x86_64/
repo --name=debug --baseurl=http://debuginfo.centos.org/6/x86_64/
repo --name=extras --baseurl=https://vault.centos.org/6.10/extras/x86_64/
repo --name=updates --baseurl=https://vault.centos.org/6.10/updates/x86_64/
Expand Down
1 change: 1 addition & 0 deletions magma-docker.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
{
"type": "shell",
"scripts": [
"scripts/centos6/yum.sh",
"scripts/centos6/base.sh",
"scripts/centos6/network.sh"
],
Expand Down
1 change: 1 addition & 0 deletions magma-hyperv.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
{
"type": "shell",
"scripts": [
"scripts/centos6/yum.sh",
"scripts/centos6/base.sh",
"scripts/centos6/network.sh"
],
Expand Down
1 change: 1 addition & 0 deletions magma-libvirt.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
{
"type": "shell",
"scripts": [
"scripts/centos6/yum.sh",
"scripts/centos6/base.sh",
"scripts/centos6/network.sh"
],
Expand Down
1 change: 1 addition & 0 deletions magma-virtualbox.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
{
"type": "shell",
"scripts": [
"scripts/centos6/yum.sh",
"scripts/centos6/base.sh",
"scripts/centos6/network.sh"
],
Expand Down
1 change: 1 addition & 0 deletions magma-vmware.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
{
"type": "shell",
"scripts": [
"scripts/centos6/yum.sh",
"scripts/centos6/base.sh",
"scripts/centos6/network.sh"
],
Expand Down
15 changes: 0 additions & 15 deletions scripts/centos6/base.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,24 +37,9 @@ error() {
# sure there are good ones available for the package installlation tasks below.
printf "nameserver 4.2.2.1\nnameserver 4.2.2.2\nnameserver 208.67.220.220\n" > /etc/resolv.conf

# Tell yum to retry 128 times before failing, so unattended installs don't skip packages when errors occur.
printf "\nretries=128\nmetadata_expire=0\nmirrorlist_expire=0\n" >> /etc/yum.conf

# Disable the broken repositories.
truncate --size=0 /etc/yum.repos.d/CentOS-Media.repo /etc/yum.repos.d/CentOS-Vault.repo

# Import the update key.
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6; error

# Update the base install first.
retry yum --assumeyes update; error

# We'll want the EPEL repo installed.
retry yum --assumeyes --enablerepo=extras install deltarpm epel-release; error

# Import the EPEL key.
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6; error

# Install the basic packages we'd expect to find.
retry yum --assumeyes install deltarpm net-tools sudo dmidecode yum-utils man bash-completion man-pages vim-common vim-enhanced sysstat bind-utils jwhois wget dos2unix unix2dos lsof telnet net-tools coreutils grep gawk sed curl patch sysstat make cmake libarchive texinfo autoconf automake libtool gcc-c++ libstdc++-devel gcc cpp ncurses-devel glibc-devel glibc-headers kernel-headers psmisc; error

Expand Down
58 changes: 58 additions & 0 deletions scripts/centos6/yum.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#!/bin/bash

retry() {
local COUNT=1
local RESULT=0
while [[ "${COUNT}" -le 10 ]]; do
[[ "${RESULT}" -ne 0 ]] && {
[ "`which tput 2> /dev/null`" != "" ] && tput setaf 1
echo -e "\n${*} failed... retrying ${COUNT} of 10.\n" >&2
[ "`which tput 2> /dev/null`" != "" ] && tput sgr0
}
"${@}" && { RESULT=0 && break; } || RESULT="${?}"
COUNT="$((COUNT + 1))"

# Increase the delay with each iteration.
DELAY="$((DELAY + 10))"
sleep $DELAY
done

[[ "${COUNT}" -gt 10 ]] && {
[ "`which tput 2> /dev/null`" != "" ] && tput setaf 1
echo -e "\nThe command failed 10 times.\n" >&2
[ "`which tput 2> /dev/null`" != "" ] && tput sgr0
}

return "${RESULT}"
}

error() {
if [ $? -ne 0 ]; then
printf "\n\nbase configuration script failure...\n\n";
exit 1
fi
}

# Tell yum to retry 128 times before failing, so unattended installs don't skip packages when errors occur.
printf "\nretries=128\nmetadata_expire=0\nmirrorlist_expire=0\n" >> /etc/yum.conf

# CentOS Repo Setup
sed -i -e "s/^mirrorlist/#mirrorlist/g" /etc/yum.repos.d/CentOS-Base.repo
sed -i -e "s/^#baseurl=http:\/\/mirror.centos.org\/centos\//baseurl=https:\/\/vault.centos.org\/centos\//g" /etc/yum.repos.d/CentOS-Base.repo

# Disable the physical media repos, along with fasttrack repos.
sed --in-place "s/^/# /g" /etc/yum.repos.d/CentOS-Media.repo
sed --in-place "s/# #/##/g" /etc/yum.repos.d/CentOS-Media.repo
sed --in-place "s/^/# /g" /etc/yum.repos.d/CentOS-Vault.repo
sed --in-place "s/# #/##/g" /etc/yum.repos.d/CentOS-Vault.repo
sed --in-place "s/^/# /g" /etc/yum.repos.d/CentOS-fasttrack.repo
sed --in-place "s/# #/##/g" /etc/yum.repos.d/CentOS-fasttrack.repo

# Import the update key.
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6; error

# We'll want the EPEL repo installed.
retry yum --assumeyes --enablerepo=extras install deltarpm epel-release; error

# Import the EPEL key.
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6; error

0 comments on commit cb7a7f0

Please sign in to comment.