scripts

random scripts
git clone git://parazyd.org/scripts.git
Log | Files | Refs

commit 8e23dcd8d4689cc1faeb478da8e4bfa52f863560
parent af0cba2eea03d9778f7f9b7b369b526835196150
Author: parazyd <parazyd@dyne.org>
Date:   Sun,  6 Nov 2016 00:25:42 +0100

add apk

Diffstat:
Aapk | 35+++++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+), 0 deletions(-)

diff --git a/apk b/apk @@ -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 "* $pkgname" + echo -e "\tavailable versions: $pkgver"; echo -e "\thomepage: $home" + echo -e "\tdescription: $desc"; echo -e "\tpackage url: $pkgurl"