From 6f5a90edb39cdd7e5e3faa7acdbaad288876f9da Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Wed, 22 Jun 2011 15:35:27 -0400 Subject: repo-add: refactor repacking of repo file Dump the whole conditional and filter the contents of the directory to create an empty or non-empty archive. Signed-off-by: Dave Reisner --- scripts/repo-add.sh.in | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'scripts') diff --git a/scripts/repo-add.sh.in b/scripts/repo-add.sh.in index 1e77015f..e7a4be40 100644 --- a/scripts/repo-add.sh.in +++ b/scripts/repo-add.sh.in @@ -595,15 +595,9 @@ if (( success )); then filename=${REPO_DB_FILE##*/} pushd "$tmpdir" >/dev/null - if [[ -n $(ls) ]]; then - bsdtar -c${TAR_OPT}f "$filename" * - else - # we have no packages remaining? zip up some emptyness - warning "$(gettext "No packages remain, creating empty database.")" - bsdtar -c${TAR_OPT}f "$filename" -T /dev/null - fi + # strip the './' off filenames; this also allows us to tar an empty dir + bsdtar -s %^./%% -c${TAR_OPT}f "$REPO_DB_FILE" ./ create_signature "$filename" - popd >/dev/null [[ -f $REPO_DB_FILE ]] && mv -f "$REPO_DB_FILE" "${REPO_DB_FILE}.old" -- cgit v1.2.3-70-g09d2