tadd apk - scripts - random scripts HTML git clone git://parazyd.org/scripts.git DIR Log DIR Files DIR Refs --- DIR commit 8e23dcd8d4689cc1faeb478da8e4bfa52f863560 DIR parent af0cba2eea03d9778f7f9b7b369b526835196150 HTML Author: parazyd <parazyd@dyne.org> Date: Sun, 6 Nov 2016 00:25:42 +0100 add apk Diffstat: A apk | 35 +++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+), 0 deletions(-) --- DIR diff --git a/apk b/apk t@@ -0,0 +1,35 @@ +#!/bin/sh + # wtfpl (c) parazyd + _arch="x86_64";_query="$@" + _url="http://pkgs.alpinel" + _url="${_url}inux.org" #dog + _url="${_url}/packages?" # + _page="$(elinks -dump \ + "${_url}name=${_query}&arch=${_arch}")" + pkgtable="$(echo "$_page"|sed 34q | + grep $_query | grep '^\[')"; # wut| + test -n "$pkgtable" || { + echo "(*) no packages found"; exit 1 + }; pkgurl="$(echo "$_page" | grep http | + grep '/package/'\ + | sed 1q | tr -d '\t')" ; + eval "echo $pkgurl | + grep main >/dev/null"\ + && pkgname=main ; eval \ + "echo $pkgurl | grep community >/dev/null"\ + && pkgname=community;eval \ + "echo $pkgurl | grep testing >/dev/null" \ + && pkgname=testing # biatch + pkgver="$(echo "$pkgtable"| + awk -F']' '{print $3}' | + awk -F'[' '{print $1}' | + tr '\n' ' ')" + home="$( echo "$_page" | + grep http | awk '/18/ {print $2}')" + desc="$( echo "$_page" | + awk '/16\./ { for (i=2; i<=NF; i++) print $i}' | + tr '\n' ' ')" ; pkgname="$pkgname/$(\ + echo $pkgtable | awk -F']' '{print $2}' | + awk -F'[' '{print $1}')"; echo -e "[0;32m*[0;0m $pkgname" + echo -e "\t[1;32mavailable versions: [0;32m$pkgver"; echo -e "\t[1;32mhomepage: [0;0m$home" + echo -e "\t[1;32mdescription: [0;0m$desc"; echo -e "\t[1;32mpackage url: [0;0m$pkgurl"