SCIENTIFIC-LINUX-USERS Archives

October 2014

SCIENTIFIC-LINUX-USERS@LISTSERV.FNAL.GOV

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Steven Haigh <[log in to unmask]>
Reply To:
Steven Haigh <[log in to unmask]>
Date:
Sun, 26 Oct 2014 16:39:18 +1100
Content-Type:
multipart/signed
Parts/Attachments:
text/plain (1412 bytes) , signature.asc (849 bytes)
On 25/10/2014 10:28 PM, Shane Voss wrote:
> On 25/10/14 05:06, Steven Haigh wrote:> I also want to go and put a
> custom URL in the sl6x.repo to go to my
>> local repository that I mirror.
>>
>> That means I'd want to turn this:
> [snip]
> 
>> to this:
> The only change I can see was inserting your server in the baseurl.
> Perhaps this is only needed in the  sl6x  section.
> 
> This bit of sed should do it:
> 
> sed -i '/\[sl6x\]/,/\[/ { /baseurl/ {
>  h ; s!http:.*scientific/!https://my.internal.server/sl! ; p ;
>  g ; s/baseurl=/                / } }' /etc/yum.repos.d/sl6x.repo
> 
> It is "parsing" the URL in as much as you seem to need to replicate the
> bit of the existing one after  'scientific/'.
> 
> Hope that helps.

Help? That is near magic!

I did a bit of tweaking and ended up with this:
sed -i '/\[sl6x.*\]/,/\n\n/ { /baseurl/ {
 h ; s!http:.*scientific/!https://my.server/path/to/sl! ; p ;
 g ; s/baseurl=/                / } }' /etc/yum.repos.d/sl6x.repo

This uses the \n\n as the end of field marker - it seemed that using [
would cause it to not match the middle repo - as its next evaluation was
against sl6x-security].

That will now loop through all the repos defined in sl6x.repo and add a
local mirror to them all.

Thanks for this pointer - I certainly wouldn't have come up with this
one by myself....

-- 
Steven Haigh

Email: [log in to unmask]
Web: http://www.crc.id.au
Phone: (03) 9001 6090 - 0412 935 897



ATOM RSS1 RSS2