index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
author | Dave Reisner <dreisner@archlinux.org> | 2012-08-10 20:20:48 -0400 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2012-09-18 08:37:46 -0500 |
commit | aa50df630c0ca572ff14e938b180ae46040f14a3 (patch) | |
tree | 391a35c882951d930679d6ead0d7615def07ca45 /scripts/makepkg.sh.in | |
parent | 369c5aa7ddabb81c335bb5b0dbd425c42f892459 (diff) |
-rw-r--r-- | scripts/makepkg.sh.in | 12 |
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index dd4066bf..262bcf89 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -2212,6 +2212,14 @@ canonicalize_path() { fi } +dir_is_empty() { + ( + shopt -s dotglob nullglob + files=("$1"/*) + (( ${#files} == 0 )) + ) +} + m4_include(library/parseopts.sh) usage() { @@ -2695,14 +2703,14 @@ if (( NOEXTRACT )); then warning "$(gettext "Skipping source integrity checks -- using existing %s tree")" "src/" warning "$(gettext "Skipping source extraction -- using existing %s tree")" "src/" - if (( NOEXTRACT )) && [[ -z $(ls "$srcdir" 2>/dev/null) ]]; then + if (( NOEXTRACT )) && dir_is_empty "$srcdir"; then error "$(gettext "The source directory is empty, there is nothing to build!")" plain "$(gettext "Aborting...")" exit 1 fi elif (( REPKG )); then if (( ! PKGFUNC && ! SPLITPKG )) \ - && [[ ! -d $pkgdir || -z $(ls "$pkgdir" 2>/dev/null) ]]; then + && { [[ ! -d $pkgdir ]] || dir_is_empty "$pkgdir"; }; then error "$(gettext "The package directory is empty, there is nothing to repackage!")" plain "$(gettext "Aborting...")" exit 1 |