When having a look at git yesterday, I stumbled upon etckeeper, a tool to keep /etc in a git (or mercurial) repository and also keeps the metadata (file permissions, …) in the repo making use of metastore.
It hooks into apt but I used /etc/portage/basrc to call it before and after installing a package:
case “$EBUILD_PHASE” in
elog “Running etckeeper pre-install…”
elog “Running etckeeper post-install…”
One could also modify /etc/etckeeper/post-install.d/50vcs-commit to include the package name etc. in the commit message while emerging:
@@ -2,5 +2,12 @@
if etckeeper unclean; then
– etckeeper commit “committing changes after $HIGHLEVEL_PACKAGE_MANAGER run”
+ case $LOWLEVEL_PACKAGE_MANAGER in
+ etckeeper commit “committing changes after $HIGHLEVEL_PACKAGE_MANAGER run ($CATEGORY/$P)”
+ etckeeper commit “committing changes after $HIGHLEVEL_PACKAGE_MANAGER run”
There are probably other/better ways to accomplish this and more…
Anyways… etckeeper looks like a nice and very flexible tool to keep /etc in a repository if one wants to.