pkgtools

morpheus pkg tools
git clone git://git.2f30.org/pkgtools
Log | Files | Refs | README | LICENSE

searchpkg (503B)


      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 release=0.0
      7 arch=x86_64
      8 mirror="http://morpheus.2f30.org/$release/packages/$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