Fix the updates check for Slackware 13.0

In the updates check we split the package name expression (on the
makepkg line) counting dashes. The 13.0 scripts now have, instead of
'tgz', the expression ${PKGTYPE:-tgz} at the end. This makes us pick
up the ARCH field instead.
Fix this by suppressing any ':-' operation found. This should be
reasonably safe (no 12.2 script has such expression there).
While at it, replace the old cut/rev dance with a single sed invocation.

Signed-off-by: Mauro Giachero <mauro.giachero@gmail.com>
This commit is contained in:
mauro.giachero 2009-08-28 16:57:04 +00:00
parent 805c3cf422
commit 5e36b3195c
2 changed files with 11 additions and 2 deletions

View file

@ -2,5 +2,5 @@ Mon Aug 24 18:13:53 UTC 2009
Sbopkg 0.XX.X released. This version contains the following fixes and Sbopkg 0.XX.X released. This version contains the following fixes and
enhancements: enhancements:
* * Fix the updates code for the 13.0 repo.
+--------------------------+ +--------------------------+

View file

@ -667,7 +667,16 @@ check_for_updates() {
# This is harmless, and the proper cleanup is performed in # This is harmless, and the proper cleanup is performed in
# Step 4. # Step 4.
VERSION_EXPRESSION=$(tac $NEWSB | grep -m1 \$OUTPUT/ | VERSION_EXPRESSION=$(tac $NEWSB | grep -m1 \$OUTPUT/ |
cut -d\$ -f2- | cut -d- -f2- | rev | cut -d- -f3- | rev) sed 's/[^$]*$\(.*\)$/\1/;
s/:-//;
s/^[^-]*-\(.*\)-[^-]*-[^-]*/\1/')
# Explanation of the above 'sed':
# - take from the first $ on (cuts "makepkg" with its
# options, if present
# - drop ':-', which is not present in any 12.2 script
# but is in every 13.0 script (${PKGTYPE:-tgz})
# - narrow the thing a bit deleting everything before
# the first dash or after the penultimate one.
echo "echo $VERSION_EXPRESSION" > $VERSION_FILE echo "echo $VERSION_EXPRESSION" > $VERSION_FILE
# Step 2 - find the used variables and their expressions # Step 2 - find the used variables and their expressions