From 2860ade2f5f827c41d84bc7826444792433c8009 Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Tue, 28 Jun 2011 21:32:40 -0400 Subject: 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 Signed-off-by: Dan McGee --- scripts/repo-add.sh.in | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/scripts/repo-add.sh.in b/scripts/repo-add.sh.in index a8450498..0500b48c 100644 --- a/scripts/repo-add.sh.in +++ b/scripts/repo-add.sh.in @@ -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" -- cgit v1.2.3-24-g4f1b