I'd like to place a custom configured /etc/my.cnf ONLY if the default my.conf is currently in place. Once the default my.cnf has been replaced or edited, I don't want to risk replacing it with my customized my.cnf.
My best ideas, and the drawbacks I see:
Take a checksum of the default my.cnf file, and if it matches that checksum, replace it. This seems the safest, but also annoying when there are new versions or minor changes to my.cnf
Look for text in my.cnf that only the default file includes, and none of my replacement my.cnf files would include. This seems slightly less annoying than my first option, but more risky.
Use a handler to replace my.cnf when mysql is installed. This could have disastrous consequences if I (or someone else) change the mysql requirement from "present" to "latest". I also worry about oddities I may hit if I need to adjust for mysql package name changes (for example, now that mysql isn't included in centos anymore, the oracle repo now has "community" in all the package names).
I'm looking for other methods. If its something you've already coded, I'd appreciate examples as well.
Thanks!