Just shilling a single-file almost POSIX sh script I made to do the same: https://git.sr.ht/~q3cpma/scripts/tree/master/item/mkcdb