summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDidier Spaier <didier@slint.fr>2018-01-06 17:19:27 -0600
committerRobby Workman <rworkman@slackware.com>2018-01-06 17:53:46 -0600
commit9cea505db928846879073267635dd32c3f503315 (patch)
tree37aa81b3fa900e431ebcf00034c7d40cd525cd62
parentb6cf5ec58c344e22e664424a848dba2d737ebfc9 (diff)
downloadslackpkg-9cea505db928846879073267635dd32c3f503315.tar.xz
files/slackpkg: SOURCE handling - land softer if no trailing /
-rw-r--r--files/slackpkg17
1 files 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=""