Well 4 has now become a constant following your earlier suggestion -- this is the exit status from `pkg` that indicates there is no work to do.

`$$pkgcmd[2]` modifies a copy of the `PKG_INSTALL_NV` command which is set as a constant `/usr/bin/pkg -R <rootdir> install -nv` so that the third argument `<rootdir>` is the correct directory name.  I do the same with the `PKG_SET_PUBLISHER` constant.