I'm writing a bash script to pull packages from remote repos, using reposync, so I can point my nodes to pull locally. As such I am trying to keep the local repo configs as similar as possible to the usptream repo configs, like this:
# upstream
baseurl=http://mirror.freedomvoice.com/centos/$releasever/os/$basearch/
# local
baseurl=http://user:[email protected]/centos/stable/$releasever/os/$basearch/
Within the bash script, is there a cleaner way to get $releasever and $basearch values? I was thinking of doing the following:
yum_metadata=$(yum version nogroups)
Which returns:
Loaded plugins: versionlock Installed: 6/x86_64 360:6167019baac7e76f94c26320424dc41a7f046a70 version
Then regexing for the 6/x86_64 values. Kind of messy, and looking for a more elegant approach.
$basearch
and$releasever
from the above example?