Refactor setup commands code to use the same checks as the provisioning code.