From 0ef878020877de725ff244c4d3f44697b6efd3ab Mon Sep 17 00:00:00 2001 From: Petr Spacek Date: Tue, 28 Oct 2014 21:23:18 +0100 Subject: add support for DNF package manager --- etckeeper-dnf/__init__.py | 0 etckeeper-dnf/etckeeper.py | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 etckeeper-dnf/__init__.py create mode 100644 etckeeper-dnf/etckeeper.py (limited to 'etckeeper-dnf') diff --git a/etckeeper-dnf/__init__.py b/etckeeper-dnf/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/etckeeper-dnf/etckeeper.py b/etckeeper-dnf/etckeeper.py new file mode 100644 index 0000000..b31c3b0 --- /dev/null +++ b/etckeeper-dnf/etckeeper.py @@ -0,0 +1,39 @@ +# etckeeper.py, support etckeeper for dnf +# +# Copyright (C) 2014 Peter Listiak +# https://github.com/plistiak/dnf-etckeeper +# +# Later modifications by Petr Spacek: +# Distutils code below was copied from etckeeper-bzr distributed with v1.15 +# + +from dnfpluginscore import logger + +import os +import dnf + + +class Etckeeper(dnf.Plugin): + + name = 'etckeeper' + + def _out(self, msg): + logger.debug('Etckeeper plugin: %s', msg) + + def resolved(self): + self._out('pre transaction commit') + command = '%s %s' % ('etckeeper', " pre-install") + ret = os.system(command) + if ret != 0: + raise dnf.exceptions.Error('etckeeper returned %d' % (ret >> 8)) + + def transaction(self): + self._out('post transaction commit') + command = '%s %s > /dev/null' % ('etckeeper', "post-install") + os.system(command) + +if __name__ == "__main__": + from distutils.core import setup + setup(name="dnf-etckeeper", + packages=["dnf.plugin"], + package_dir={"dnf.plugin":"etckeeper-dnf"}) -- cgit v1.2.3