freebsd-update: Correctly check if pkg(8) is present

On systems without pkg(8) installed, `command -v pkg` will return
success and falsely report that pkg(8) is present. Fix that by checking
via the `pkg -N` form.

This is missing from the final revision of D39695.

Reported by:	delphij
Reviewed by:	fernape, delphij
Fixes:		bc0c6c9cf3 freebsd-update: Add check for kernel modules
Differential Revision:	https://reviews.freebsd.org/D45292
This commit is contained in:
Zhenlei Huang 2024-05-23 12:10:17 +08:00
parent 9fc5e3fb39
commit d76ef58d56

View file

@ -667,7 +667,7 @@ upgrade_check_kmod_ports() {
local report
local w
if ! command -v pkg >/dev/null; then
if ! pkg -N 2>/dev/null; then
echo "Skipping kernel modules check. pkg(8) not present."
return
fi