]>
git.proxmox.com Git - mirror_lxc.git/blob - config/yum/lxc-patch.py
1 # Yum plugin to re-patch container rootfs after a yum update is done
3 # Copyright (C) 2012 Oracle
6 # Dwight Engen <dwight.engen@oracle.com>
8 # This library is free software; you can redistribute it and/or
9 # modify it under the terms of the GNU Lesser General Public
10 # License as published by the Free Software Foundation; either
11 # version 2.1 of the License, or (at your option) any later version.
13 # This library is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 # Lesser General Public License for more details.
18 # You should have received a copy of the GNU Lesser General Public
19 # License along with this library; if not, write to the Free Software
20 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
25 from fnmatch
import fnmatch
26 from yum
.plugins
import TYPE_INTERACTIVE
28 requires_api_version
= '2.0'
29 plugin_type
= (TYPE_INTERACTIVE
,)
31 def posttrans_hook(conduit
):
33 patch_required
= False
35 # If we aren't root, we can't have updated anything
39 # See what packages have files that were patched
40 confpkgs
= conduit
.confString('main', 'packages')
44 tmp
= confpkgs
.split(",")
46 pkgs
.append(confpkg
.strip())
48 conduit
.info(2, "lxc-patch: checking if updated pkgs need patching...")
49 ts
= conduit
.getTsInfo()
50 for tsmem
in ts
.getMembers():
52 if fnmatch(pkg
, tsmem
.po
.name
):
55 conduit
.info(2, "lxc-patch: patching container...")
56 os
.spawnlp(os
.P_WAIT
, "lxc-patch", "lxc-patch", "--patch", "/")