From: Michael Tremer Date: Sun, 19 Sep 2010 21:18:06 +0000 (+0200) Subject: naoki: Add optional support for loop devices in chroot. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fc2e8556caf2e5a5de8f12b10527157296e3ab4f;p=ipfire-3.x.git naoki: Add optional support for loop devices in chroot. I do not normally want them here because they can be a risk for the host system. --- diff --git a/naoki/environ.py b/naoki/environ.py index 4987eac5e..2c322336f 100644 --- a/naoki/environ.py +++ b/naoki/environ.py @@ -30,9 +30,14 @@ def set(e): class _Environment(object): kernel_version = os.uname()[2] - def __init__(self, arch): + def __init__(self, arch, **settings): self.arch = arch + self._settings = { + "enable_loop" : False, + } + self._settings.update(settings) + logging.debug("Successfully initialized %s" % self) # XXX check if already locked @@ -107,6 +112,10 @@ class _Environment(object): (stat.S_IFCHR | 0600, os.makedev(5, 1), "dev/console") ] + if self._settings["enable_loop"]: + for i in range(0, 7): + devNodes.append((stat.S_IFBLK | 0660, os.makedev(7, i), "dev/loop%d" % i)) + # make device node for el4 and el5 if self.kernel_version < "2.6.19": devNodes.append((stat.S_IFCHR | 0666, os.makedev(5, 2), "dev/ptmx")) diff --git a/naoki/generators.py b/naoki/generators.py index bcb027bee..d6c73825d 100644 --- a/naoki/generators.py +++ b/naoki/generators.py @@ -13,7 +13,7 @@ from environ import _Environment class Generator(_Environment): def __init__(self, type, arch=None): - _Environment.__init__(self, arch) + _Environment.__init__(self, arch, enable_loop=True) self.type = type