Blame tests/p_yum-plugin-fastestmirror/10-fastestmirror.sh
|
Karanbir Singh |
6f670a |
#!/bin/sh
|
|
Karanbir Singh |
6f670a |
|
|
Karanbir Singh |
6f670a |
# Ensure plugin is enabled :
|
|
Karanbir Singh |
6565bb |
|
|
Karanbir Singh |
6f670a |
t_Log "Running $0 - is y-p-fastestmirror enabled."
|
|
Karanbir Singh |
6f670a |
grep 'enabled=1' /etc/yum/pluginconf.d/fastestmirror.conf > /dev/null
|
|
Karanbir Singh |
6f670a |
t_CheckExitStatus $?
|
|
Karanbir Singh |
6f670a |
|
|
Karanbir Singh |
6f670a |
# timedhosts file ends up in different places on c5 and c6
|
|
Karanbir Singh |
6f670a |
if [ $centos_ver == 5 ]; then
|
|
Karanbir Singh |
6565bb |
BaseDir=/var/cache/yum/
|
|
Karanbir Singh |
6f670a |
else
|
|
Karanbir Singh |
6565bb |
BaseDir=/var/cache/yum/`uname -m`/$centos_ver
|
|
Karanbir Singh |
6f670a |
fi
|
|
Karanbir Singh |
6f670a |
|
|
Karanbir Singh |
6f670a |
t_Log "Running $0 - Ensure we have mirrorlist enabled."
|
|
Karanbir Singh |
6f670a |
egrep '^mirrorlist' /etc/yum.repos.d/*.repo > /dev/null
|
|
Karanbir Singh |
6f670a |
t_CheckExitStatus $?
|
|
Karanbir Singh |
6f670a |
|
|
Karanbir Singh |
3e0128 |
t_Log "Running $0 - is y-p-fastestmirror can get hosts"
|
|
Karanbir Singh |
488421 |
find $BaseDir -type f -name timedhosts.txt -exec rm -f {} \;
|
|
Karanbir Singh |
6f670a |
yum -d0 list kernel > /dev/null
|
|
Karanbir Singh |
ca2d3e |
|
|
Karanbir Singh |
6565bb |
hostsfound=`cat $BaseDir/timedhosts.txt | wc -l` > /dev/null
|
|
Karanbir Singh |
3e0128 |
|
|
Karanbir Singh |
3e0128 |
# we need to make sure the file was recreated
|
|
Karanbir Singh |
6565bb |
if [ -f ${BaseDir}/timedhosts.txt ]; then
|
|
Karanbir Singh |
3e0128 |
if [ $hostsfound -lt 1 ]; then
|
|
Karanbir Singh |
6565bb |
retval=1
|
|
Karanbir Singh |
3e0128 |
else
|
|
Karanbir Singh |
6565bb |
retval=0
|
|
Karanbir Singh |
3e0128 |
fi
|
|
Karanbir Singh |
6565bb |
else
|
|
Karanbir Singh |
6565bb |
retval=1
|
|
Karanbir Singh |
3e0128 |
fi
|
|
Karanbir Singh |
3e0128 |
t_CheckExitStatus $retval
|
|
Karanbir Singh |
3e0128 |
|
|
Karanbir Singh |
3e0128 |
t_Log "Running $0 - is y-p-fastestmirror can get"
|
|
Karanbir Singh |
3e0128 |
|
|
Karanbir Singh |
6f670a |
hostsfound=$( wc -l ${BaseDir}/timedhosts.txt )
|
|
Karanbir Singh |
6f670a |
|