Saturday, June 26, 2010

» Even shorter openSUSE repository URLs

Shorter URLs to repositories

As I wrote not too long ago, I hacked a very small and simple but still useful trick to simplify and shorten URLs to openSUSE Build Service repositories. e.g.:
http://s.opensu.se/r?network:utilities
instead of
http://download.opensuse.org/repositories/network:/utilities.

Even shorter

There is now an even shorter variant, using
http://r.opensu.se/...
instead of
http://s.opensu.se/r?
e.g.: http://r.opensus.se/network:utilities
(instead of the full fledged URL as above). Trivial? yes. Useful? I think so :) (e.g. to give links on IRC, or on identi.ca/twitter) For some examples, see http://r.opensu.se

Beyond the short URLs

Note that you may also expand beyond that URL to reach files/directories below those, e.g.:
http://r.opensu.se/network:utilities/11.2/network:utilities.repo

11.2 is openSUSE_11.2

As you surely have noted, 11.2 isn't the correct subdirectory there (it's actually openSUSE_11.2). Well, I also added the expansion of 11.0, 11.1, 11.2, 11.3, etc... at that position in the URL to openSUSE_11.0, etc... respectively (well, actually it's a regex ;)).

f is openSUSE_Factory

To redirect to openSUSE_Factory instead, just use f, e.g.:
http://r.opensu.se/network:utilities/f

Short URLs to .repo files

And here I'm so lazy it's getting creepy. What we usually want to link to (typically to give people a repository to add) is the .repo file.
Well,
http://r.opensu.se/network:utilities/11.2/r
redirects to
http://downloads.opensuse.org/repositories/network:/utilities/openSUSE_11.2/network:utilities.repo Same for Factory, of course, e.g.
http://r.opensu.se/server:monitoring/f/r

Add zypper to the mix

Now, given all that, if you want to tell someone to add e.g. the server:monitoring repository, just tell her to do this:
zypper ar -r http://r.opensu.se/server:monitoring/11.2/r

The impossible

What would be even nicer is to avoid having to put the openSUSE version in the URL, but unfortunately zypper doesn't the version of the openSUSE it's running on in the HTTP request headers, which means I simply cannot automagically redirect to the right subdirectory based on that, as I don't have any way to know which openSUSE version the client has.

Labels:

1 Comments:

Blogger Unknown said...

how about a one-click add repo button?

02:59  

Post a Comment

<< Home