58 lines
1.8 KiB
Bash
Executable File
58 lines
1.8 KiB
Bash
Executable File
#!/bin/bash
|
|
# Persistent repository fix that runs continuously
|
|
|
|
echo "Setting up persistent repository fix..."
|
|
|
|
# Create a script that will fix repos whenever they're created
|
|
cat > /usr/local/bin/fix-openshift-repos-monitor.sh << 'MONITOR_EOF'
|
|
#!/bin/bash
|
|
while true; do
|
|
if [ -f /etc/yum.repos.d/CentOS-OpenShift-Origin311.repo ]; then
|
|
if grep -q "mirror.centos.org" /etc/yum.repos.d/CentOS-OpenShift-Origin311.repo; then
|
|
echo "$(date): Fixing OpenShift Origin repository URLs..."
|
|
|
|
cat > /etc/yum.repos.d/CentOS-OpenShift-Origin311.repo << 'REPO_EOF'
|
|
[centos-openshift-origin311]
|
|
name=CentOS OpenShift Origin
|
|
baseurl=http://vault.centos.org/centos/7/paas/x86_64/openshift-origin311/
|
|
enabled=1
|
|
gpgcheck=1
|
|
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-PaaS
|
|
|
|
[centos-openshift-origin311-testing]
|
|
name=CentOS OpenShift Origin Testing
|
|
baseurl=http://vault.centos.org/centos/7/paas/x86_64/openshift-origin311/
|
|
enabled=0
|
|
gpgcheck=0
|
|
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-PaaS
|
|
|
|
[centos-openshift-origin311-debuginfo]
|
|
name=CentOS OpenShift Origin DebugInfo
|
|
baseurl=http://vault.centos.org/centos/7/paas/x86_64/
|
|
enabled=0
|
|
gpgcheck=1
|
|
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-PaaS
|
|
|
|
[centos-openshift-origin311-source]
|
|
name=CentOS OpenShift Origin Source
|
|
baseurl=http://vault.centos.org/centos/7/paas/Source/openshift-origin311/
|
|
enabled=0
|
|
gpgcheck=1
|
|
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-PaaS
|
|
REPO_EOF
|
|
|
|
yum clean all
|
|
echo "$(date): Repository URLs fixed to use vault.centos.org"
|
|
fi
|
|
fi
|
|
sleep 5
|
|
done
|
|
MONITOR_EOF
|
|
|
|
chmod +x /usr/local/bin/fix-openshift-repos-monitor.sh
|
|
|
|
# Start the monitor in background
|
|
nohup /usr/local/bin/fix-openshift-repos-monitor.sh > /var/log/repo-fix.log 2>&1 &
|
|
|
|
echo "Persistent repository fix started"
|