Create meaningful etckeeper commit messages

I want to keep track of the /etc changes with etckeeper

Unfortunately, the commit messages are the same for all commits

saving uncommitted changes in /etc prior to emerge run

I wish there would be something more descriptive like

apt-get install foo

on debian based systems or

emerge foo

on gentoo based systems when reading the logs with git log.
Is there a hook script, I can use for this?

Answer

The changelog message comes from one of the hook scripts of etckeeper. For example the “saving uncommitted changes” message is from /etc/etckeeper/pre-install.d/50uncommitted-changes.

But if you want truly meaningful messages for changes that you made, a computer cannot generate them for you. (Changes resulting from apt-get or emerge operation do get a meaningful messages listing the packages that got installed, upgraded or removed.) You need to run etckeeper commit or $vcs commit and enter a meaningful message. To prevent apt-get or emerge from running if there are uncommitted changes, edit /etc/etckeeper/etckeeper.conf and uncomment the line AVOID_COMMIT_BEFORE_INSTALL=1 (and AVOID_DAILY_AUTOCOMMITS=1 if it’s commented out).

Attribution
Source : Link , Question Author : Jonas Stein , Answer Author : Gilles ‘SO- stop being evil’

Leave a Comment