ugtrain: move more adaption code where it belongs

The adaption code from the main function, the writing back of the
config to disk - all that belongs to the adaption files.

Functionality is basically the same.