Move preferences stuff into prefs repository

I decided to make it a stand-alone thing that anyone can use. All
setup-specific scripts are still here.