I have a ks script to install Centos6.5.
Inside my local network I have a snapshot of the base package mirror.
I want to used as possible as I can my local package site over extranet like http://mirrors.kernel.org/centos/6.5/os/x86_64/.
However, the ks script should work outside the local network so I need to define some fallback/mirror url.
In fedora environment there is an option for url
directive http://fedoraproject.org/wiki/Anaconda/Kickstart#url --mirrorlist
but its option does not exists for Centos6.5.
There is any way other solution to manage my problem?
I thought about %pre
bash script but without any package it will be hard to test which url I have to choose.
Best Answer
I would create a %pre Python script and use
urllib2.urlopen()
to check whether your local repository is available. If not, it would use one of the mirrors online.See example usage here: https://stackoverflow.com/questions/16778435/python-check-if-website-exists
So, for example: