summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2011-06-29 03:32:40 +0200
committerDan McGee <dan@archlinux.org>2011-06-30 17:32:15 +0200
commit2860ade2f5f827c41d84bc7826444792433c8009 (patch)
treee076fbb37deedcf32eed9bfbc9a95b77549a34f1
parent84974ed04c16218608312ccf6369cf728eada477 (diff)
downloadpacman-2860ade2f5f827c41d84bc7826444792433c8009.tar.gz
pacman-2860ade2f5f827c41d84bc7826444792433c8009.tar.xz
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>
-rw-r--r--scripts/repo-add.sh.in9
1 files 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"