mirror of
https://github.com/moparisthebest/pacman
synced 2025-03-01 01:41:52 -05:00
repo-add: fail early if repo can not be created
Before this commit, the repo creation could fail after all packages have been added to the database. Now this will be detected before adding anything. Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
parent
35b9dfc380
commit
30e2496775
@ -312,10 +312,20 @@ check_repo_db()
|
|||||||
msg "$(gettext "Extracting database to a temporary location...")"
|
msg "$(gettext "Extracting database to a temporary location...")"
|
||||||
bsdtar -xf "$REPO_DB_FILE" -C "$tmpdir"
|
bsdtar -xf "$REPO_DB_FILE" -C "$tmpdir"
|
||||||
else
|
else
|
||||||
if [ "$cmd" == "repo-remove" ]; then
|
case "$cmd" in
|
||||||
|
repo-remove)
|
||||||
error "$(gettext "Repository file '%s' was not found.")" "$REPO_DB_FILE"
|
error "$(gettext "Repository file '%s' was not found.")" "$REPO_DB_FILE"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
;;
|
||||||
|
repo-add)
|
||||||
|
# check if the file can be created (write permission, directory existence, etc)
|
||||||
|
if ! touch "$REPO_DB_FILE"; then
|
||||||
|
error "$(gettext "Repository file '%s' could not be created.")" "$REPO_DB_FILE"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
rm -f "$REPO_DB_FILE"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user