Refactor: tools: Move all the other subdaemon functions.
Unfortunately, these functions are pretty tangled up with each other so
they can't be moved piecemeal, at least not without doing a lot of
temporary work that would just be removed in the next patch. So here
they are moved in bulk.