setup.R: refactor out local check