1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-12-22 15:58:50 -05:00

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 <d@falconindy.com>
This commit is contained in:
Dave Reisner 2011-06-22 15:35:27 -04:00 committed by Dave Reisner
parent 112858ae61
commit 6f5a90edb3

View File

@ -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"