blob: e8a1a5124b60ac0cf25e2a9c6b3d8d2e840b4a98 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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-plugins"],
package_dir={"dnf-plugins":"etckeeper-dnf"})
|