pkgtools

binary package manager for zandra
git clone git://zandra.org/pkgtools
Log | Files | Refs | README | LICENSE

searchpkg (534B)


      1 #!/bin/sh
      2 #
      3 # To list all packages in the mirror try searchpkg "\.tgz$"
      4 # To download packages try searchpkg pkg... | fetchpkg
      5 
      6 [ -z "$release" ] && release='0.0'
      7 [ -z "$arch" ] && arch='x86_64'
      8 mirror="http://zandra.org/pkg/$release/$arch"
      9 
     10 usage() {
     11 	echo "usage: $(basename $0) pkg..." 1>&2
     12 	exit 1
     13 }
     14 
     15 if test -z "$1"; then
     16 	usage
     17 fi
     18 
     19 curl -s "$mirror/PACKAGES" | while read -r pkg; do
     20 	for i in "$@"; do
     21 		echo "$pkg" | grep -q "$i"
     22 		if test "$?" -eq 0; then
     23 			echo "$mirror/$pkg" | sed 's/#/%23/'
     24 		fi
     25 	done
     26 done | sort | uniq