From b4b7c0996c73291b34f0566f74ad2513c44a6371 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 25 Mar 2008 20:53:02 -0400 Subject: Keep track of what packages change state during an installation, and include that in the commit message at the end. --- Makefile | 3 ++- debian/changelog | 2 ++ list-installed.d/50list-installed | 8 ++++++++ post-install.d/50vcs-commit | 13 ++++++++++++- pre-install.d/10packagelist | 3 +++ 5 files changed, 27 insertions(+), 2 deletions(-) create mode 100755 list-installed.d/50list-installed create mode 100755 pre-install.d/10packagelist diff --git a/Makefile b/Makefile index db5fb3a..930dc7b 100644 --- a/Makefile +++ b/Makefile @@ -8,13 +8,14 @@ prefix=/usr bindir=${prefix}/bin etcdir=/etc mandir=${prefix}/share/man +vardir=/var INSTALL=install INSTALL_EXE=${INSTALL} -D INSTALL_DATA=${INSTALL} -m 0644 -D install: - mkdir -p $(DESTDIR)$(etcdir)/etckeeper/ + mkdir -p $(DESTDIR)$(etcdir)/etckeeper/ $(DESTDIR)$(vardir)/cache/etckeeper/ cp -a *.d $(DESTDIR)$(etcdir)/etckeeper/ $(INSTALL_DATA) $(CONFFILE) $(DESTDIR)$(etcdir)/etckeeper/etckeeper.conf $(INSTALL_EXE) etckeeper $(DESTDIR)$(bindir)/etckeeper diff --git a/debian/changelog b/debian/changelog index 6550bbb..28f905e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -15,6 +15,8 @@ etckeeper (0.13) UNRELEASED; urgency=low automatically transitioned, and the file removed. Also, etckeeper init on a historical version of a repository that still contains .metadata will use it, if metastore is installed. + * Keep track of what packages change state during an installation, + and include that in the commit message at the end. Closes: #459384 -- Joey Hess Fri, 14 Mar 2008 01:51:53 -0400 diff --git a/list-installed.d/50list-installed b/list-installed.d/50list-installed new file mode 100755 index 0000000..116a42a --- /dev/null +++ b/list-installed.d/50list-installed @@ -0,0 +1,8 @@ +#!/bin/sh +# Output to stdout a *sorted* list of all currently installed +# (or removed but still with config-files) packages, in the +# format "package version\n". +if [ "$LOWLEVEL_PACKAGE_MANAGER" = dpkg ]; then + dpkg-query -W -f '${Status}\t${Package} ${Version}\n' | \ + egrep '(ok installed|ok config-files)' | cut -f2,3 +fi diff --git a/post-install.d/50vcs-commit b/post-install.d/50vcs-commit index 581e310..76fb668 100755 --- a/post-install.d/50vcs-commit +++ b/post-install.d/50vcs-commit @@ -1,6 +1,17 @@ #!/bin/sh set -e + +pl="/var/cache/etckeeper/packagelist" +NL=" +" if etckeeper unclean; then - etckeeper commit "committing changes after $HIGHLEVEL_PACKAGE_MANAGER run" + message="committing changes in /etc after $HIGHLEVEL_PACKAGE_MANAGER run" + + if [ -e $pl.pre-install ]; then + message="$message$NL$(etckeeper list-installed | diff -U0 $pl.pre-install - | tail -n+4)" + rm -f $pl.pre-install + fi + + etckeeper commit "$(printf "$message")" fi diff --git a/pre-install.d/10packagelist b/pre-install.d/10packagelist new file mode 100755 index 0000000..f83acee --- /dev/null +++ b/pre-install.d/10packagelist @@ -0,0 +1,3 @@ +#!/bin/sh +# This list will be later used when committing. +etckeeper list-installed > /var/cache/etckeeper/packagelist.pre-install -- cgit v1.2.3