From 9cea505db928846879073267635dd32c3f503315 Mon Sep 17 00:00:00 2001 From: Didier Spaier Date: Sat, 6 Jan 2018 17:19:27 -0600 Subject: files/slackpkg: SOURCE handling - land softer if no trailing / --- files/slackpkg | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/files/slackpkg b/files/slackpkg index 1fa7b3e..6786493 100644 --- a/files/slackpkg +++ b/files/slackpkg @@ -47,13 +47,26 @@ fi # # CONF = configuration directory -# SOURCE = A mirror of Slackware. Source can be sett by editing $CONF/mirrors +# SOURCE = A mirror of Slackware. Source can be set by editing $CONF/mirrors # VERSION=@VERSION@ PATH=/bin:/usr/bin:/sbin:/usr/sbin SLACKWARE_VERSION=$(cat /etc/slackware-version | cut -f2 -d\ ) CONF=${CONF:-/etc/slackpkg} -SOURCE=$(sed -e 's/^[[:blank:]]*//' $CONF/mirrors | grep -m1 -e "^\([a-z]\)") +SOURCE=$(sed -n ' + # Remove leading and trailing blanks + s/^[[:blank:]]*// + s/[[:blank:]]*$// + # Only one token is allowed per line + /[[:blank:]]/d + # A single solidus should end the URI + s,[/]*$,/, + # Print the lines beginning with one of the URI schemes we look for + \@^file://@p + \@^cdrom://@p + \@^local://@p + \@^https\{0,1\}://@p + \@^ftps\{0,1\}://@p' $CONF/mirrors) . $CONF/slackpkg.conf ERROR="" -- cgit v1.2.3