summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--yum-etckeeper/AUTHORS1
-rw-r--r--yum-etckeeper/LICENSE0
-rw-r--r--yum-etckeeper/README8
-rw-r--r--yum-etckeeper/etckeeper.conf2
-rw-r--r--yum-etckeeper/etckeeper.py40
-rwxr-xr-xyum-etckeeper/list-installed.d/60list-installed7
-rw-r--r--yum-etckeeper/makefile32
-rw-r--r--yum-etckeeper/yum-etckeeper.spec51
8 files changed, 141 insertions, 0 deletions
diff --git a/yum-etckeeper/AUTHORS b/yum-etckeeper/AUTHORS
new file mode 100644
index 0000000..37bddf3
--- /dev/null
+++ b/yum-etckeeper/AUTHORS
@@ -0,0 +1 @@
+jtang@tchpc.tcd.ie
diff --git a/yum-etckeeper/LICENSE b/yum-etckeeper/LICENSE
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/yum-etckeeper/LICENSE
diff --git a/yum-etckeeper/README b/yum-etckeeper/README
new file mode 100644
index 0000000..0d91824
--- /dev/null
+++ b/yum-etckeeper/README
@@ -0,0 +1,8 @@
+yum pre and post install hook, this is similar to the apt get hook.
+its probably not as refined.
+
+there is a simple spec file and makefile for generating installable
+rpms. it also relies on the etckeeper package that I cooked up.
+
+i've been using it on my own systems and it appears to work fine with
+the autoupdate system and when i install/remove apps with yum.
diff --git a/yum-etckeeper/etckeeper.conf b/yum-etckeeper/etckeeper.conf
new file mode 100644
index 0000000..8e4d76c
--- /dev/null
+++ b/yum-etckeeper/etckeeper.conf
@@ -0,0 +1,2 @@
+[main]
+enabled=1
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)
diff --git a/yum-etckeeper/list-installed.d/60list-installed b/yum-etckeeper/list-installed.d/60list-installed
new file mode 100755
index 0000000..aac39ea
--- /dev/null
+++ b/yum-etckeeper/list-installed.d/60list-installed
@@ -0,0 +1,7 @@
+#!/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" = rpm ]; then
+ rpm -qa --queryformat "%{name} %{version} %{arch}\n" | sort
+fi
diff --git a/yum-etckeeper/makefile b/yum-etckeeper/makefile
new file mode 100644
index 0000000..1a666ef
--- /dev/null
+++ b/yum-etckeeper/makefile
@@ -0,0 +1,32 @@
+DESTDIR?=
+prefix=/usr
+etcdir=/etc
+CONFFILE=etckeeper.conf
+
+INSTALL=install
+INSTALL_EXE=${INSTALL} -D
+INSTALL_DATA=${INSTALL} -m 0644 -D
+
+PACKAGE=yum-etckeeper
+DISTFILE=$(PACKAGE).tar.gz
+
+dist: $(DISTFILE)
+
+$(DISTFILE):
+ tar -C .. --exclude .git --exclude $(DISTFILE) \
+ --exclude \*.diff --exclude .gitignore \
+ --exclude .svn \
+ --exclude \*.swp \
+ -cvzf $(DISTFILE) $(PACKAGE)
+
+install:
+ mkdir -p $(DESTDIR)$(etcdir)/etckeeper/list-installed.d $(DESTDIR)$(prefix)/lib/yum-plugins $(DESTDIR)$(etcdir)/yum/pluginconf.d
+ $(INSTALL_DATA) $(CONFFILE) $(DESTDIR)$(etcdir)/yum/pluginconf.d/etckeeper.conf
+ $(INSTALL_DATA) etckeeper.py $(DESTDIR)$(prefix)/lib/yum-plugins/etckeeper.py
+ $(INSTALL_EXE) list-installed.d/60list-installed $(DESTDIR)$(etcdir)/etckeeper/list-installed.d/60list-installed
+
+rpms: dist
+ rpmbuild -ta $(DISTFILE)
+
+clean:
+ -rm -f $(DISTFILE)
diff --git a/yum-etckeeper/yum-etckeeper.spec b/yum-etckeeper/yum-etckeeper.spec
new file mode 100644
index 0000000..e8f9fe5
--- /dev/null
+++ b/yum-etckeeper/yum-etckeeper.spec
@@ -0,0 +1,51 @@
+Name: yum-etckeeper
+Version: snapshot
+Release: 9%{?dist}
+Summary: etckeeper pre and post transaction hook for yum
+
+Group: System Environment/Base
+License: TCD
+URL: http://www.tchpc.tcd.ie
+Source0: yum-etckeeper.tar.gz
+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+
+BuildRequires: etckeeper >= 0.31, yum, git >= 1.6.0.3-1
+Requires: etckeeper >= 0.31, yum, git >= 1.6.0.3-1
+
+%description
+etckeeper pre and post transaction hook for yum
+
+%prep
+%setup -q -n yum-etckeeper
+
+
+%build
+exit 0
+
+%install
+rm -rf $RPM_BUILD_ROOT
+make install DESTDIR=$RPM_BUILD_ROOT
+
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+
+%files
+%defattr(-,root,root,-)
+%doc AUTHORS LICENSE README
+/etc/etckeeper/list-installed.d/60list-installed
+/etc/yum/pluginconf.d/etckeeper.conf
+/usr/lib/yum-plugins/etckeeper.py*
+
+
+%changelog
+* Tue Feb 24 2009 Jimmy Tang <jtang@tchpc.tcd.ie> - snapshot-9
+- ignore previous change, since I've packaged up etckeeper properly now
+* Tue Feb 24 2009 Jimmy Tang <jtang@tchpc.tcd.ie> - snapshot-7
+- upstream etckeeper has a list installed script for rpm so
+removing my own one
+* Mon Feb 16 2009 Jimmy Tang <jtang@tchpc.tcd.ie> - snapshot-4
+- made it work in sl4
+* Mon Feb 16 2009 Jimmy Tang <jtang@tchpc.tcd.ie> - snapshot-1
+- initial package