makepkg : check for invalid backup entry

This implements FS#13551

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Xavier Chantry 2009-08-18 20:30:04 +02:00 committed by Dan McGee
parent cb07265851
commit b53aa87ea9
1 changed files with 22 additions and 0 deletions

View File

@ -949,6 +949,18 @@ write_pkginfo() {
fi
}
check_package() {
cd "$pkgdir"
# check existence of backup files
local file
for file in "${backup[@]}"; do
if [ ! -f "$file" ]; then
warning "$(gettext "Invalid backup entry : %s")" "$file"
fi
done
}
create_package() {
if [ ! -d "$pkgdir" ]; then
error "$(gettext "Missing pkg/ directory.")"
@ -956,6 +968,8 @@ create_package() {
exit 1 # $E_MISSING_PKGDIR
fi
check_package
cd "$pkgdir"
msg "$(gettext "Creating package...")"
@ -1158,6 +1172,14 @@ check_sanity() {
fi
done
local file
for file in "${backup[@]}"; do
if [ "${file:0:1}" = "/" ]; then
error "$(gettext "Invalid backup entry : %s")" "$file"
return 1
fi
done
if [ "$install" -a ! -f "$install" ]; then
error "$(gettext "Install scriptlet (%s) does not exist.")" "$install"
return 1