kics2-mirror-sync.sh
is the entry point.
The submodule to subtree conversion script is based on http://stackoverflow.com/questions/28215244/convert-git-submodule-to-subtree.
The rest of the code should be self-explanatory.
Some aspects should/could be improved, so pull requests are totally welcome.
Also, I don't currently have an always-online machine or VM at my service, so I'm having to run the sync script manually, which is currently more or less OK, but if anyone would like to set up a CRON job or equivalent, any help would be very welcome.