#!/bin/sh # elvis: slack -- Search Slackware.com packages # Author: B. Watson (yalhcru at gmail) # Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details. # Unfortunately we can't use GET with this form. Well, we can, # except the checkboxes for "search sets" don't work. So it has # to be a POST request, which means this elvis depends on wget. I # suppose it could support curl instead (or in addition) but I don't # see the point. # The source search is pretty useless, but that's not this script's fault. . surfraw || exit 1 check_bins() { local i missing for i in "$@"; do if [ -z "$( type -p $i )" ]; then warn "required external binary $i not found on PATH." missing="${missing}$i " fi done if [ -n "$missing" ]; then err "please install the missing binaries, or adjust PATH (currently \"$PATH\")" fi } url="https://packages.slackware.com/" get_slack_ver() { local ver sitevers i # initially set to the currently running version, if we can. # unfortunately, this can be wrong: if someone upgraded to -current # but didn't upgrade aaa_base, it'll still say 14.2 (or whatever they # upgraded from). if [ -e /etc/slackware-version ]; then ver="$( cut -d' ' -f2 < /etc/slackware-version )" else # we're not on slackware, assume current echo "current" return fi # now check the site, make sure it's a supported version. this would # be easier in perl, but I wanna keep external deps to a minimum. sitevers="$( wget -qO- "$url" | \ sed 's,<,\n<,g' | \ sed -n 's/