From 82b736b616d347e7db440e18455dcb97b706d9aa Mon Sep 17 00:00:00 2001 From: Enno Boland Date: Wed, 18 Nov 2015 11:19:09 +0100 Subject: [PATCH] common: expand_destdir rewrite --- common/environment/install/extglob.sh | 23 +++++++++++++---------- common/hooks/do-pkg/00-gen-pkg.sh | 2 +- common/hooks/pre-pkg/99-pkglint.sh | 2 +- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/common/environment/install/extglob.sh b/common/environment/install/extglob.sh index 048218c60dc..c0bf59d74a1 100644 --- a/common/environment/install/extglob.sh +++ b/common/environment/install/extglob.sh @@ -1,15 +1,18 @@ # This provides the extglob function to expand wildcards in the destdir expand_destdir() { - local glob_list= result= glob= file= + local result= glob= file= - for glob; do - glob_list+=" $DESTDIR/$glob" - done - shopt -s extglob - for file in $glob_list; do - result+=" ${file#$DESTDIR/}" - done - shopt -u extglob - echo $result + ( + set -f + for glob in $@; do + files=$(echo "${PKGDESTDIR}/${glob}") + set +f + for file in $files; do + result+="${blank}${file#$PKGDESTDIR/}" + blank=" " + done + done + echo "$result" + ) } diff --git a/common/hooks/do-pkg/00-gen-pkg.sh b/common/hooks/do-pkg/00-gen-pkg.sh index ab010ff42f8..75d47d36496 100644 --- a/common/hooks/do-pkg/00-gen-pkg.sh +++ b/common/hooks/do-pkg/00-gen-pkg.sh @@ -50,7 +50,7 @@ genpkg() { local _replaces="$(echo $replaces)" local _reverts="$(echo $reverts)" local _mutable_files="$(echo $mutable_files)" - local _conf_files="$(expand_destdir $conf_files)" + local _conf_files="$(expand_destdir "$conf_files")" local _alternatives="$(echo $alternatives)" local _tags="$(echo $tags)" diff --git a/common/hooks/pre-pkg/99-pkglint.sh b/common/hooks/pre-pkg/99-pkglint.sh index e9015e25365..441da4a59f7 100644 --- a/common/hooks/pre-pkg/99-pkglint.sh +++ b/common/hooks/pre-pkg/99-pkglint.sh @@ -25,7 +25,7 @@ hook() { done # Check that configuration files really exist. - for f in $(expand_destdir ${conf_files}); do + for f in $(expand_destdir "${conf_files}"); do if [ ! -f "${PKGDESTDIR}/${f}" ]; then msg_red "${pkgver}: '$f' configuration file not in PKGDESTDIR!\n" error=1