Rewrite entire installer

Does more, is cleaner, and runs on other shells than the Bash