refpolicy: run setfiles only if $D is not set

Running this setfiles command only applies for the target. Check for existence of $D,
which is only defined for the build environment. If $D is not defined, we're running
on the target, so execute setfiles.