diff options
author | Eric Hameleers <alien@slackware.com> | 2016-02-28 11:37:00 +0100 |
---|---|---|
committer | Eric Hameleers <alien@slackware.com> | 2016-02-28 11:37:00 +0100 |
commit | ff39ee5639ab3414d882a7e813d8ddd4a4ed1bd3 (patch) | |
tree | 6b68e4237b08297300db53191415dd371f8095f2 | |
parent | f482e420fa930d22155deb1ff50a0ddec7fed068 (diff) | |
download | liveslak-ff39ee5639ab3414d882a7e813d8ddd4a4ed1bd3.tar.gz liveslak-ff39ee5639ab3414d882a7e813d8ddd4a4ed1bd3.tar.xz |
Use correct grep command to find unique package name.
The grep command used so far would find "vim-gvim" when searching for "vim"
because it did not try to match from the beginning of the string.
Diffstat (limited to '')
-rwxr-xr-x | make_slackware_live.sh | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/make_slackware_live.sh b/make_slackware_live.sh index 77f3c8f..e1d0102 100755 --- a/make_slackware_live.sh +++ b/make_slackware_live.sh @@ -212,6 +212,24 @@ cleanup() { } trap 'echo "*** $0 FAILED at line $LINENO ***"; cleanup; exit 1' ERR INT TERM +# +# Return the full pathname of first package found below $2 matching exactly $1: +# +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)" +} # # Find packages and install them into the temporary root: @@ -286,18 +304,18 @@ function install_pkgs() { # Look in ./patches ; then ./slackware$DIRSUFFIX ; then ./extra # Need to escape any '+' in package names such a 'gtk+2': if [ ! -z "${SL_PATCHROOT}" ]; then - FULLPKG=$(find ${SL_PATCHROOT} -name "${PKG}-*.t?z" 2>/dev/null | grep -E "${PKG//+/\\+}-[^-]+-[^-]+-[^-]+.t?z") + FULLPKG=$(full_pkgname ${PKG} ${SL_PATCHROOT}) else FULLPKG="" fi if [ "x${FULLPKG}" = "x" ]; then - FULLPKG=$(find ${SL_PKGROOT} -name "${PKG}-*.t?z" 2>/dev/null |grep -E "${PKG//+/\\+}-[^-]+-[^-]+-[^-]+.t?z" |head -1) + FULLPKG=$(full_pkgname ${PKG} ${SL_PKGROOT}) else echo "-- $PKG found in patches" fi if [ "x${FULLPKG}" = "x" ]; then # One last attempt: look in ./extra - FULLPKG=$(find $(dirname ${SL_PKGROOT})/extra -name "${PKG}-*.t?z" 2>/dev/null |grep -E "${PKG//+/\\+}-[^-]+-[^-]+-[^-]+.t?z" |head -1) + FULLPKG=$(full_pkgname ${PKG} $(dirname ${SL_PKGROOT})/extra) fi if [ "x${FULLPKG}" = "x" ]; then |