apk (3518B)
1 #!/bin/sh 2 # wtfpl (c) parazyd 3 _arch="x86_64";_query="$@" 4 test -n "$_query" || exit 1 5 _url="http://pkgs.alpinel" 6 _url="${_url}inux.org" # | 7 _url="${_url}/packages?" # 8 _page="$(elinks -dump \ 9 "${_url}name=${_query}&arch=${_arch}")" 10 pkgtable="$(printf "%s\\n" "$_page"| sed 34q | 11 grep $_query | grep '^\[')"; # xxx| 12 test -n "$pkgtable" || { 13 printf "(*) no packages found\\n"; exit 1 14 }; pkgurl="$(printf "%s\\n" "$_page" | grep http | 15 grep '/package/'\ 16 | sed 1q | tr -d '\t')" ; 17 eval "printf '%s\\n' $pkgurl | 18 grep main >/dev/null"\ 19 && pkgname=main ; eval \ 20 "printf '%s\\n' $pkgurl | grep community >/dev/null"\ 21 && pkgname=community;eval \ 22 "printf '%s\\n' $pkgurl | grep testing >/dev/null" \ 23 && pkgname=testing # random 24 pkgver="$(printf "%s\\n" "$pkgtable"| \ 25 awk -F']' '{print $3}' | \ 26 awk -F'[' '{print $1}' | \ 27 tr '\n' ' ')" 28 home="$( printf "%s\\n" "$_page" | 29 grep http | awk '/18/ {print $2}')" 30 desc="$( printf "%s\\n" "$_page" | 31 awk '/16\./ { for (i=2; i<=NF; i++) print $i}' | 32 tr '\n' ' ')" ; pkgname="$pkgname/$(\ 33 printf "%s\\n" $pkgtable | awk -F']' '{print $2}' | 34 awk -F'[' '{print $1}')"; printf "[0;32m*[0;0m %s\\n" "$pkgname" 35 printf "\t[1;32mavailable versions: [0;32m%s\\n" "$pkgver"; printf "\t[1;32mhomepage: [0;0m%s\\n" "$home" 36 printf "\t[1;32mdescription: [0;0m%s\\n" "$desc"; printf "\t[1;32mpackage url: [0;0m%s\\n" "$pkgurl"