repo-add.sh.in: avoid being clever with repo repacking

Revert to the old behavior that 6f5a90 attempted to simplify and go with
the original proposed solution of using "ugly" bash to detect empty
directories.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Dave Reisner 2011-06-28 21:32:40 -04:00 committed by Dan McGee
parent 84974ed04c
commit 2860ade2f5
1 changed files with 7 additions and 2 deletions

View File

@ -630,8 +630,13 @@ if (( success )); then
filename=${REPO_DB_FILE##*/}
pushd "$tmpdir/tree" >/dev/null
# strip the './' off filenames; this also allows us to tar an empty dir
bsdtar -s '%^./\?%%' -c${TAR_OPT}f "$tmpdir/$filename" ./
if ( shopt -s nullglob; files=(*); (( ${#files[*]} )) ); then
bsdtar -c${TAR_OPT}f "$tmpdir/$filename" *
else
# we have no packages remaining? zip up some emptyness
warning "$(gettext "No packages remain, creating empty database.")"
bsdtar -c${TAR_OPT}f "$tmpdir/$filename" -T /dev/null
fi
popd >/dev/null
create_signature "$tmpdir/$filename"