From b3065092ca220e1b72fd10d639ec6dbf47f05277 Mon Sep 17 00:00:00 2001 From: Daniel Hokka Zakrisson Date: Tue, 1 Jul 2008 19:50:05 +0000 Subject: [PATCH] Copy the library once per boot, in case it gets updated. --- source/utils.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/source/utils.py b/source/utils.py index 5c75606..65750a9 100644 --- a/source/utils.py +++ b/source/utils.py @@ -93,6 +93,7 @@ def sysexec( cmd, log= None ): return 1 +_chroot_lib_copied = False def sysexec_chroot( path, cmd, log= None ): """ same as sysexec, but inside a chroot @@ -101,10 +102,11 @@ def sysexec_chroot( path, cmd, log= None ): release = os.uname()[2] # 2.6.12 kernels need this if release[:5] == "2.6.1": - library = "%s/lib/libc-opendir-hack.so" % path - if not os.path.exists(library): - shutil.copy("./libc-opendir-hack.so", library) - preload = "/bin/env LD_PRELOAD=/lib/libc-opendir-hack.so" + library = "/lib/libc-opendir-hack.so" + if not _chroot_lib_copied: + shutil.copy("./libc-opendir-hack.so", "%s/%s" % (path, library)) + _chroot_lib_copied = True + preload = "/bin/env LD_PRELOAD=%s" % library sysexec("chroot %s %s %s" % (path, preload, cmd), log) -- 2.47.0