summaryrefslogtreecommitdiff
path: root/yum-etckeeper.py
diff options
context:
space:
mode:
authorJimmy Tang <jtang@duo.tchpc.tcd.ie>2009-02-25 10:56:39 +0000
committerJoey Hess <joey@gnu.kitenet.net>2009-02-25 14:28:52 -0500
commitfd2b5ae1fa1f1644ce72327cb5a581c11a25ab59 (patch)
tree684d8183c93ffed4689c9651b7125bf98123bda5 /yum-etckeeper.py
parent84ba43d1bc553a2b28c4b33922e1a6453587efa0 (diff)
added yum-etckeeper plugin to top level etckeeper specfile. made makefile install said plugin when yum is selected as a high level package manager.
Diffstat (limited to 'yum-etckeeper.py')
-rw-r--r--yum-etckeeper.py36
1 files changed, 36 insertions, 0 deletions
diff --git a/yum-etckeeper.py b/yum-etckeeper.py
new file mode 100644
index 0000000..f3ec762
--- /dev/null
+++ b/yum-etckeeper.py
@@ -0,0 +1,36 @@
+#!/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
+#
+
+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)