From a2cc7e065abd8024392a60b00110073b11e019f1 Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Mon, 30 Dec 2019 05:48:56 -0500 Subject: Do-over... --- slack | 205 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 205 insertions(+) create mode 100755 slack (limited to 'slack') diff --git a/slack b/slack new file mode 100755 index 0000000..d3e2e7d --- /dev/null +++ b/slack @@ -0,0 +1,205 @@ +#!/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 + +if [ "$( type -p wget )" = "" ]; then + err "wget is required for this. please install it." +fi + +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 + # TODO: rewrite to use sed or awk? maybe not that big a deal. + sitevers="$( + wget -qO- "https://packages.slackware.com" | \ + perl -ne 'print "$1 " while (/