-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathetckeeper.py
More file actions
32 lines (23 loc) · 780 Bytes
/
etckeeper.py
File metadata and controls
32 lines (23 loc) · 780 Bytes
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
# etckeeper.py, support etckeeper for dnf
#
# Copyright (C) 2014 Peter Listiak
#
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')
servicecmd = '/usr/bin/etckeeper'
command = '%s %s' % (servicecmd, " 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')
servicecmd = '/usr/bin/etckeeper'
command = '%s %s > /dev/null' % (servicecmd, "post-install")
os.system(command)