From 8a39e6d26b920d7b4c5d2eca818d0c74ebcb0df5 Mon Sep 17 00:00:00 2001 From: Eric Hameleers Date: Fri, 1 Nov 2019 17:50:53 +0100 Subject: Fix a logic bug in finding packages --- make_slackware_live.sh | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/make_slackware_live.sh b/make_slackware_live.sh index 72d09f0..f880514 100755 --- a/make_slackware_live.sh +++ b/make_slackware_live.sh @@ -320,18 +320,22 @@ uncompressfs () { # full_pkgname() { PACK=$1 - TOPDIR=$2 - # Perhaps I will use this more readable code in future: - #for FL in $(find ${TOPDIR} -name "${PACK}-*.t?z" 2>/dev/null) ; do - # # Weed out package names starting with "$PACK"; we want exactly "$PACK": - # if [ "$(echo $FL |rev |cut -d- -f4- |cut -d/ -f1 |rev)" != "$PACK" ]; then - # continue - # else - # break - # fi - #done - #echo "$FL" - echo "$(find ${TOPDIR} -name "${PACK}-*.t?z" 2>/dev/null |grep -E "\<${PACK//+/\\+}-[^-]+-[^-]+-[^-]+.t?z" |head -1)" + if [ -e $2 ]; then + TOPDIR=$2 + # Perhaps I will use this more readable code in future: + #for FL in $(find ${TOPDIR} -name "${PACK}-*.t?z" 2>/dev/null) ; do + # # Weed out package names starting with "$PACK"; we want exactly "$PACK": + # if [ "$(echo $FL |rev|cut -d- -f4-|cut -d/ -f1|rev)" != "$PACK" ]; then + # continue + # else + # break + # fi + #done + #echo "$FL" + echo "$(find ${TOPDIR}/ -name "${PACK}-*.t?z" 2>/dev/null |grep -E "\<${PACK//+/\\+}-[^-]+-[^-]+-[^-]+.t?z" |head -1)" + else + echo "" + fi } # @@ -385,7 +389,7 @@ function install_pkgs() { else SELECTION="" fi - if [ ! -d ${SL_REPO} -o -z "$(find ${SL_PKGROOT} -type f 2>/dev/null)" ]; then + if [ ! -d ${SL_REPO} -o -z "$(find ${SL_PKGROOT}/ -type f 2>/dev/null)" ]; then # Oops... empty local repository. Let's see if we can rsync from remote: echo "** Slackware package repository root '${SL_REPO}' does not exist or is empty!" RRES=1 -- cgit v1.2.3