One useful technique is to create a feature with an activation receiver.
When you install and activate this you can do whatever you like to the site in code.
The problem is keeping track of what you have done (and did it work).
I would recommend creating a private announcement list that the installer feature writes to.
This makes it easy to check that the install has worked (especially in a SOX environment where you won’t be the one running the script).