Listmates,
One thing that was frustrating ( not maddening, just inefficient ) about
webpin was that it returned the URL for the repository where the rpm is located
as something like:
BS::home:/Lazy_Kent
(example from "webpin monica" search)
The problem is that I can't do anything directly with "BS::home:/Lazy_Kent".
It can't be directly added as a repository without manually changing BS:: to
the actual URL. To automate getting around this problem, I wrote a simple
script to get the actual url from the BS::home:/Lazy_Kent text. I call it bsurl
and I put it in /usr/local/bin (or you can just put it in ~/bin). Just copy the
BS::home:/Lazy_Kent text and paste it as the argument to bsurl. Example:
17:59 alchemy:~> bsurl BS::home:/Lazy_Kent
The URL is:
http://download.opensuse.org/repositories/home:/Lazy_Kent/openSUSE_11.0
To add the repository use:
zypper ar -K
http://download.opensuse.org/repositories/home:/Lazy_Kent/openSUSE_11.0
Notes: (1) this works for the build service repositories, not oss, etc.. You
can easily add that capability if you wish. Use it if you can make use of it.
(2) You can omit the -k option if you don't want to cache rpms for that repository.
--
David C. Rankin, J.D.,P.E.
Rankin Law Firm, PLLC
510 Ochiltree Street
Nacogdoches, Texas 75961
Telephone: (936) 715-9333
Facsimile: (936) 715-9339
www.rankinlawfirm.com
#!/bin/bash --norc
##
## Title: bsurl (build service url)
## Version: 0.0.1
## Date: 03/05/2009, 11:51:33 PM
## Author: David C. Rankin, J.D.,P.E
## Summary: Returns 'zypper ar' URL from url info supplied from webpin
##
## Run as: normal user
## Requires: nothing you don't already have
##
##
#
usage()
{
echo -e "\n\t${0##*/} generates a URI to be used with 'zypper ar' from the output of the"
echo -e "\trepository information returned by webpin (i.e. BS::server:/monitoring)"
echo -e "\tIt simply uses that information combined with your OS and hardware"
echo -e "\tinformation to produce the complete URI, example:\n"
echo -e "http://download.opensuse.org/repositories/server:/monitoring/openSUSE_11.0\n"
echo -e "\tUsage:\t ${0##*/} \n"
exit 1
}
getosver() {
if [[ -r /etc/SuSE-release ]]; then
echo "$(sed -e 's/^.*=[ ]//' -e '1d' < /etc/SuSE-release)"
else
echo "$(sed -e 's/^.*=[ ]//' -e '1d' < /etc/*-release)"
fi
}
[[ -z $1 ]] && usage
OSVER=$(getosver)
BDSVCOS=openSUSE_${OSVER}
if [[ ${1} =~ 'BS::' ]]; then
BDSVCDIR=${1##*BS::}
else
BDSVCDIR=$1
fi
BDSVCSVR=download.opensuse.org/repositories
BDSVCURL=http://${BDSVCSVR}/${BDSVCDIR}/${BDSVCOS}
[[ ${OSVER%.*} -gt 10 ]] && ZYPPOPTS='-K '
echo -e "\n\tThe URL is: $BDSVCURL\n"
echo -e "\tTo add the repository use:\n"
echo -e "zypper ar ${ZYPPOPTS}${BDSVCURL} \n"
exit 0