summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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"