You are not logged in.

#1 2012-04-23 08:25:10

synthead
Member
Registered: 2006-05-09
Posts: 1,344

Download all your AUR packages with a script

Here's a little quickie that will download all your scripts to the current working directory.  Uses ruby and requires the hpricot gem.  Also requires cower, install it from the AUR.  This is still pretty early, so it isn't very robust, but as long as you provide it with a valid username and the current directory is empty, you're good smile

#!/usr/bin/env ruby

require 'open-uri'
require 'hpricot'

abort "Usage: " + File.basename(__FILE__) + " username\n" if $*.count != 1

sourceHtml = Hpricot(open("http://aur.archlinux.org/packages.php?O=0&K=#{$*[0]}&do_Search=Go&detail=0&C=0&SeB=m&SB=v&SO=d&PP=10000"))
packages = sourceHtml.search("//a[@href^='packages.php?ID=']/span/text()").map { |package| package.to_s.sub(/ .*/, '') }
packages.sort.each { |package| puts `cower -d #{package}` }

Three lines of code for the grunt work.  Amazing, isn't it?

Offline

#2 2012-04-23 10:04:02

xduugu
Member
Registered: 2008-10-16
Posts: 292

Re: Download all your AUR packages with a script

It is much shorter when you use the rpc interface.

username=xduugu; curl -Ss 'https://aur.archlinux.org/rpc.php?type=msearch&arg='"$username" | sed 's/},{/\n/g' | sed -r 's#.*"URLPath":"([^"]+)".*#\1#g;s#\\/#/#g' | wget -B https://aur.archlinux.org/ -i -

Offline

Board footer

Powered by FluxBB