diff options
Diffstat (limited to 'etckeeper-dnf')
-rw-r--r-- | etckeeper-dnf/__init__.py | 0 | ||||
-rw-r--r-- | etckeeper-dnf/etckeeper.py | 39 |
2 files changed, 39 insertions, 0 deletions
diff --git a/etckeeper-dnf/__init__.py b/etckeeper-dnf/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/etckeeper-dnf/__init__.py 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"}) |