diff options
author | Dan McGee <dan@archlinux.org> | 2009-09-30 04:08:06 +0200 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2009-09-30 04:08:06 +0200 |
commit | 8e7652f1afd7ba5198f3aa10a94c50bb67f7a407 (patch) | |
tree | fb125716750985f491070796bd1a51211a0fe89b /scripts | |
parent | 2071286770b3dbe531423aa3e8517dac68f04154 (diff) | |
parent | 20392c0a025d01128eb78c6656db7c15b3fbcd89 (diff) | |
download | pacman-8e7652f1afd7ba5198f3aa10a94c50bb67f7a407.tar.gz pacman-8e7652f1afd7ba5198f3aa10a94c50bb67f7a407.tar.xz |
Merge branch 'maint'
Conflicts:
lib/libalpm/dload.c
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/repo-add.sh.in | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/scripts/repo-add.sh.in b/scripts/repo-add.sh.in index 6aa7fe73..bcbd3b37 100644 --- a/scripts/repo-add.sh.in +++ b/scripts/repo-add.sh.in @@ -306,9 +306,14 @@ check_repo_db() fi if [ -f "$REPO_DB_FILE" ]; then - if ! bsdtar -tqf "$REPO_DB_FILE" '*/desc' 2>&1 >/dev/null; then - error "$(gettext "Repository file '%s' is not a proper pacman database.")" "$REPO_DB_FILE" - exit 1 + # there are two situations we can have here- a DB with some entries, + # or a DB with no contents at all. + if ! bsdtar -tqf "$REPO_DB_FILE" '*/desc' >/dev/null 2>&1; then + # check empty case + if [ -n "$(bsdtar -tqf "$REPO_DB_FILE" '*' 2>/dev/null)" ]; then + error "$(gettext "Repository file '%s' is not a proper pacman database.")" "$REPO_DB_FILE" + exit 1 + fi fi msg "$(gettext "Extracting database to a temporary location...")" bsdtar -xf "$REPO_DB_FILE" -C "$tmpdir" @@ -472,8 +477,9 @@ if [ $success -eq 1 ]; then if [ -n "$(ls)" ]; then bsdtar -c${TAR_OPT}f "$filename" * else - # the database will be moved to .old below, and there will be no new one to replace it - error "$(gettext "All packages have been removed from the database. Deleting '%s'.")" "$REPO_DB_FILE" + # 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 cd "$startdir" |