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:
parent
112858ae61
commit
6f5a90edb3
1 changed files with 2 additions and 8 deletions
|
@ -595,15 +595,9 @@ if (( success )); then
|
||||||
filename=${REPO_DB_FILE##*/}
|
filename=${REPO_DB_FILE##*/}
|
||||||
|
|
||||||
pushd "$tmpdir" >/dev/null
|
pushd "$tmpdir" >/dev/null
|
||||||
if [[ -n $(ls) ]]; then
|
# strip the './' off filenames; this also allows us to tar an empty dir
|
||||||
bsdtar -c${TAR_OPT}f "$filename" *
|
bsdtar -s %^./%% -c${TAR_OPT}f "$REPO_DB_FILE" ./
|
||||||
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
|
|
||||||
create_signature "$filename"
|
create_signature "$filename"
|
||||||
|
|
||||||
popd >/dev/null
|
popd >/dev/null
|
||||||
|
|
||||||
[[ -f $REPO_DB_FILE ]] && mv -f "$REPO_DB_FILE" "${REPO_DB_FILE}.old"
|
[[ -f $REPO_DB_FILE ]] && mv -f "$REPO_DB_FILE" "${REPO_DB_FILE}.old"
|
||||||
|
|
Loading…
Add table
Reference in a new issue