diff options
author | Jimmy Tang <jtang@duo.tchpc.tcd.ie> | 2009-02-24 10:08:22 +0000 |
---|---|---|
committer | Joey Hess <joey@gnu.kitenet.net> | 2009-02-25 14:28:37 -0500 |
commit | 84ba43d1bc553a2b28c4b33922e1a6453587efa0 (patch) | |
tree | 2fecc42b31b40a0ad6533c6d0fce8dd4bbad604e /yum-etckeeper/etckeeper.py | |
parent | d4fab621ca7f1e4cc788b1bea8f7629be52d31bc (diff) |
yum plugin for etckeeper, this similar to the apt hooks
this plugin works on SL4 and SL5 based systems, it should work
with any RHEL based distro. this will probably need to be
updated when the next version of etckeeper comes out as the
current dev version's list installed hook does the right thing.
Diffstat (limited to 'yum-etckeeper/etckeeper.py')
-rw-r--r-- | yum-etckeeper/etckeeper.py | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/yum-etckeeper/etckeeper.py b/yum-etckeeper/etckeeper.py new file mode 100644 index 0000000..f1b7edb --- /dev/null +++ b/yum-etckeeper/etckeeper.py @@ -0,0 +1,40 @@ +#!/usr/bin/env python +# +# author: jtang@tchpc.tcd.ie +# +# this plugin is based on the hello world example +# from http://yum.baseurl.org/wiki/WritingYumPlugins +# +# to install, copy this file to /usr/lib/yum-plugins/etckeeper.py +# and then create /etc/yum/pluginconf.d/etckeeper.conf with the contents +# below. +# +# /etc/yum/pluginconf.d/etckeeper.conf: +# [main] +# enabled=1 +# +# this was also needed in /etc/etckeeper/list-installed.d/60list-installed +#if [ "$LOWLEVEL_PACKAGE_MANAGER" = rpm ]; then +# rpm -qa --queryformat "%{name} %{version} %{arch}\n" | sort +#fi + +import os +from glob import fnmatch + +import yum +from yum.plugins import TYPE_CORE + +requires_api_version = '2.1' +plugin_type = (TYPE_CORE,) + +def pretrans_hook(conduit): + conduit.info(2, 'etckeeper: pre transaction commit') + servicecmd = conduit.confString('main', 'servicecmd', '/usr/sbin/etckeeper') + command = '%s %s' % (servicecmd, " pre-install") + os.system(command) + +def posttrans_hook(conduit): + conduit.info(2, 'etckeeper: post transcation commit') + servicecmd = conduit.confString('main', 'servicecmd', '/usr/sbin/etckeeper') + command = '%s %s' % (servicecmd, "post-install") + os.system(command) |