This is moved from install.sh, and generalized.