zypper + bash script = simple repo management

view full story

http://feedproxy.google.com – I had a smooth, easy experience with a fresh install of openSUSE 11.2 on my desktop this weekend. Man, that was nice. With the excellent openSUSE Build Service available, I find myself there often. Many times I am looking for more recent versions of packages than what are available from the repositories I have loaded into my machine. Once the packages are found, I usually just grab the repository that they are in and load that into YAST. For example, let’s say we’re looking for pidgin. Using YaST or zypper, we do a search, and find that we have version 2.6.2 available to us. However, with the openSUSE Build Service, we see that 2.6.3 is available. We’ll just grab the repo for it, which is located directly above the 1-click install button. Right-click on it, select “Copy Link Location.” You have the repo in your clipboard. Then, we can use zypper to load our repository into YaST, set it to autorefresh, and then refresh it. Then, when we search for pidgin again, 2.6.3 shows up rather than 2.6.2. It’s a quick, easy way to collect and save reliable repositories that have newer packages in them. To add a repo, then set it to autorefresh, then refresh it takes three, semi-lengthy commands, for example: [1049][root@laptop:~]$ zypper addrepo "http://download.opensuse.org/repositories/GNOME:/Apps/openSUSE_11.2" "Gnome Apps"   Then: [1049][root@laptop:~]$ zypper modifyrepo -r "Gnome Apps"   Then: [1049][root@laptop:~]$ zypper refresh "Gnome Apps"   Rather than type all that out every time, I threw a quick script together that I call ‘repoadd’ (don’t forget to run chmod +x on it to make it executable) to save me all the agony: #!/bin/sh # $1 is the repo, i.e. http://download.opensuse.org/repositories/GNOME:/Apps/openSUSE_11.2 # $2 is the name you wish to give it, i.e. "Gnome Apps" zypper addrepo "$1" "$2" zypper modifyrepo -r "$2" zypper refresh "$2"   Now, instead of having to type that all out every time, you can just run: [1049][root@laptop:~]$ repoadd "http://download.opensuse.org/repositories/GNOME:/Apps/openSUSE_11.2" "Gnome Apps"   Of course, 1-Click Install does essentially the same thing. I just thought I’d explore and share this different way of going through that process. You never know when those alternative ways of doing things can save your hide. (Distributions)