summaryrefslogtreecommitdiffstats
path: root/source/ap/slackpkg/files/slackpkg
diff options
context:
space:
mode:
Diffstat (limited to 'source/ap/slackpkg/files/slackpkg')
-rw-r--r--source/ap/slackpkg/files/slackpkg43
1 files changed, 37 insertions, 6 deletions
diff --git a/source/ap/slackpkg/files/slackpkg b/source/ap/slackpkg/files/slackpkg
index 4fcdd61ac..67864930c 100644
--- a/source/ap/slackpkg/files/slackpkg
+++ b/source/ap/slackpkg/files/slackpkg
@@ -22,6 +22,23 @@
# Evaldo Gardenali (aka UdontKnow) evaldogardenali@fasternet.com.br
#
+# Ensure that we're not at the epoch. slackpkg breaks with GPG checks when
+# the date is so far in the past:
+if [ $( date +%s ) -le 1437841588 ]; then
+cat <<"EOF"
+Error: Your system date is wrong. slackpkg requires that the date be correct
+so that the package signatures can be verified.
+
+The date may be incorrect because you have a system such as a Raspberry Pi that
+does does not have an RTC (Real Time Clock), or that the correct date was unable
+to be read from the RTC due to a driver bug, or a missing driver.
+
+You may wish to set up NTP on your system:
+http://docs.slackware.com/howtos:network_services:ntp
+
+EOF
+ exit 1
+fi
#========================================================================
#
@@ -30,22 +47,36 @@
#
# 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=""
# Set temporary directory
#
-TMPDIR=$(mktemp -p /tmp -d slackpkg.XXXXXX 2>/dev/null)
+mkdir -p ${ROOT}/tmp
+TMPDIR=$(mktemp -p ${ROOT}/tmp -d slackpkg.XXXXXX 2>/dev/null)
if [ $? -ne 0 ]; then
- TMPDIR="/tmp/slackpkg.${RANDOM}"
- mkdir -m 700 $TMPDIR || TMPDIR="FAILED"
+ TMPDIR="${ROOT}/tmp/slackpkg.${RANDOM}"
+ mkdir -p -m 700 $TMPDIR || TMPDIR="FAILED"
fi
#
@@ -485,7 +516,7 @@ case "$CMD" in
if ( found != 1 ) {
print \"No packages found! Try:\n\n\tslackpkg search $PATTERN\n\nand choose one (and ONLY one package).\n\"
}
- }" ${WORKDIR}/PACKAGES.TXT 2>/dev/null
+ }" ${ROOT}/${WORKDIR}/PACKAGES.TXT 2>/dev/null
;;
new-config)
POSTINST=on