prtcheck: consolidate tests of mandatory Pkgfile vars

This commit is contained in:
John McQuah 2024-02-13 15:11:04 +00:00
parent e9ba2b5909
commit 0a61682b93

View File

@ -77,26 +77,25 @@ fi
if [ ! -s Pkgfile ]; then
error "no Pkgfile found or Pkgfile empty!"
fi
desc="$(<Pkgfile awk '/^# Description:/ {print gensub(/# Description:[[:blank:]]*(.*)/,"\\1","g",$0)}')"
if [ "$desc" = "" ]; then
error "no Description in Pkgfile!"
fi
url="$(<Pkgfile awk '/^# URL:/ {print gensub(/# URL:[[:blank:]]*(.*)/,"\\1","g",$0)}')"
if [ "$url" = "" ]; then
error "no URL in Pkgfile!"
fi
maintainer="$(<Pkgfile awk '/^# Maintainer:/ {print gensub(/# Maintainer:[[:blank:]]*(.*)/,"\\1","g",$0)}')"
if [ "$maintainer" = "" ]; then
error "no Maintainer in Pkgfile!"
fi
depends="$(<Pkgfile awk '/^# Depends on:/ {print gensub(/# Depends on:[[:blank:]]*(.*)/,"\\1","g",$0)}')"
if [ "$depends" = "" ]; then
warn "no dependencies, please check!"
fi
desc="$(<Pkgfile awk '/^# Description:/ {print gensub(/# Description:[[:blank:]]*(.*)/,"\\1","g",$0)}')"
url="$(<Pkgfile awk '/^# URL:/ {print gensub(/# URL:[[:blank:]]*(.*)/,"\\1","g",$0)}')"
maintainer="$(<Pkgfile awk '/^# Maintainer:/ {print gensub(/# Maintainer:[[:blank:]]*(.*)/,"\\1","g",$0)}')"
[ -n "$desc" ] || nullvars+=" Description"
[ -n "$url" ] || nullvars+=" URL"
[ -n "$maintainer" ] || nullvars+=" Maintainer"
[ -z "$nullvars" ] || error "Pkgfile is missing the field(s):$nullvars"
#
# Checking .signature
#
[ -s .signature ] || error "no signature file!"
. Pkgfile
(( unsigned=0 ))