setup: exit setup script correctly regardless of how it was called
Add helper function to detect whether script was executed or sourced and choose the correct exit strategy.
Add helper function to detect whether script was executed or sourced and choose the correct exit strategy.