repo-add: check early for xdelta if it is needed
The check for xdelta3 was done as needed (and not in all cases). Do this check early so that repo-add does not abort part way through. Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
parent
81d233b793
commit
6aef45ee1a
1 changed files with 24 additions and 4 deletions
|
@ -212,6 +212,28 @@ check_gpg() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
check_xdelta() {
|
||||||
|
local need_xdelta=0
|
||||||
|
|
||||||
|
if (( DELTA )); then
|
||||||
|
need_xdelta=1
|
||||||
|
else
|
||||||
|
if [[ $cmd == "repo-add" ]];
|
||||||
|
for f in ${args[@]:1}; do
|
||||||
|
case $f in
|
||||||
|
*.delta) need_xdelta=1 ;;
|
||||||
|
*) ;;
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
if (( need_xdelta )); then
|
||||||
|
if ! type xdelta3 &>/dev/null; then
|
||||||
|
error "$(gettext "Cannot find the xdelta3 binary! Is xdelta3 installed?")"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# sign the package database once repackaged
|
# sign the package database once repackaged
|
||||||
create_signature() {
|
create_signature() {
|
||||||
(( ! SIGN )) && return
|
(( ! SIGN )) && return
|
||||||
|
@ -525,10 +547,6 @@ add() {
|
||||||
if [[ ${1##*.} == "delta" ]]; then
|
if [[ ${1##*.} == "delta" ]]; then
|
||||||
deltafile=$1
|
deltafile=$1
|
||||||
msg "$(gettext "Adding delta '%s'")" "$deltafile"
|
msg "$(gettext "Adding delta '%s'")" "$deltafile"
|
||||||
if ! type xdelta3 &>/dev/null; then
|
|
||||||
error "$(gettext "Cannot find the xdelta3 binary! Is xdelta3 installed?")"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
if db_write_delta "$deltafile"; then
|
if db_write_delta "$deltafile"; then
|
||||||
return 0
|
return 0
|
||||||
else
|
else
|
||||||
|
@ -736,6 +754,8 @@ if (( SIGN || KEY || VERIFY )); then
|
||||||
check_gpg
|
check_gpg
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
check_xdelta
|
||||||
|
|
||||||
fail=0
|
fail=0
|
||||||
for arg in "${args[@]:1}"; do
|
for arg in "${args[@]:1}"; do
|
||||||
case $cmd in
|
case $cmd in
|
||||||
|
|
Loading…
Add table
Reference in a new issue