gracefully handle running as the root user when there is no sudo command installed

In some cases, we would end up with a missing $SUDO substitution that
would cause some variables to get set in the wrong place