mirror of
https://gitlab.alpinelinux.org/alpine/abuild.git
synced 2025-04-01 22:48:56 +00:00
abuild: check sanity of install scripts
we check early that suffix is valid and that we have a matching pkgname or subpackage
This commit is contained in:
parent
12897f2d4c
commit
42df5722ee
11
abuild.in
11
abuild.in
@ -96,7 +96,7 @@ die() {
|
|||||||
|
|
||||||
# check if apkbuild is basicly sane
|
# check if apkbuild is basicly sane
|
||||||
sanitycheck() {
|
sanitycheck() {
|
||||||
local i suggestion
|
local i= j= suggestion=
|
||||||
msg "Checking sanity of $APKBUILD..."
|
msg "Checking sanity of $APKBUILD..."
|
||||||
[ -z "$pkgname" ] && die "Missing pkgname in APKBUILD"
|
[ -z "$pkgname" ] && die "Missing pkgname in APKBUILD"
|
||||||
[ -z "${pkgname##* *}" ] && die "pkgname contains spaces"
|
[ -z "${pkgname##* *}" ] && die "pkgname contains spaces"
|
||||||
@ -121,6 +121,15 @@ sanitycheck() {
|
|||||||
[ -z "$CHOST" ] && die "Please set CHOST in /etc/abuild.conf"
|
[ -z "$CHOST" ] && die "Please set CHOST in /etc/abuild.conf"
|
||||||
|
|
||||||
for i in $install; do
|
for i in $install; do
|
||||||
|
local n=${i%.*}
|
||||||
|
local suff=${i#*.}
|
||||||
|
case "$suff" in
|
||||||
|
pre-install|post-install|pre-upgrade|post-upgrade|pre-deinstall|post-deinstall);;
|
||||||
|
*) die "$i: unknown install script suffix"
|
||||||
|
esac
|
||||||
|
if ! subpackages_has "$n" && [ "$n" != "$pkgname" ]; then
|
||||||
|
die "$i: install script does not match pkgname or any subpackages"
|
||||||
|
fi
|
||||||
[ -e "$startdir/$i" ] || die "install script $startdir/$i is missing"
|
[ -e "$startdir/$i" ] || die "install script $startdir/$i is missing"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user