#!/bin/bash #################################### ####### colors ##################### green="\033[01;32m" red="\033[01;31m" restore="\033[00m" contrast="\033[1m" #################################### echo URL="http://gpo.zugaina.org" #################################### ####### search ##################### search(){ for page in ${PAGES};do OUT="$(curl -s ${URL}/${page})" OVERLAYS="$(grep -o "Overlays/.*\"" <<< "${OUT}" | sed 's|Overlays/||;s|"||' | sort -u)" VERSIONS="$(grep -o "[^ ]*||;s|${PN}-${ver}<\/b>/,/<\/li>/p" <<< "${OUT}" | grep -o "Overlays/.*\"" | sed 's|Overlays/||;s|"||' | sort -u)" FULL+="${CATEGORY}/${PN}-${ver}:"${overlays//$'\n'/ }$'\n' done done } #################################### ####### go ######################### if [[ "${1}" == "-e" ]] && grep -q \/ <<< "${2}";then PAGES="${2}" CATEGORY="$(awk -F '/' '{print $1}' <<< "${2}")" PN="$(awk -F '/' '{print $2}' <<< "${2}")" desc="$(curl -s ${URL}/${2} | grep -o "")" desc="${desc#*>}" desc="${desc%<*}" echo -e "${green}${2}${restore}: ${desc}" search else PAGE="$(curl -s ${URL}/Search?search="${1}")" while read package desc;do [[ -z "${package}" ]] && continue echo -e "${green}${package}${restore}: ${desc}" package="$(qatom ${package})" CATEGORY="$(awk '{print $1}' <<< "${package}")" PN="$(awk '{print $2}' <<< "${package}")" SUB_PAGE="$(curl -s http://gpo.zugaina.org/${CATEGORY}/${PN})" PAGES="$(grep -o "" <<< "${SUB_PAGE}" | awk -F '/' '{print $2,$3}' | tr ' ' '/' | sort -u)" search; done <<< "$(sed -n '/
/,/
/p' <<< "${PAGE}" | grep '
.*
' | sed 's|
||g;s|<\/div>||g')" fi #################################### ####### output ##################### [[ -n "${FULL}" ]] && echo && echo -e "PACKAGE:REPOSITORY\n-------:----------\n${FULL}" | column -t -s ':'