]> git.ipfire.org Git - ipfire-3.x.git/commitdiff
naoki: Create user "nobody" in chroot.
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 12 Feb 2010 00:33:38 +0000 (01:33 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 12 Feb 2010 00:33:38 +0000 (01:33 +0100)
naoki/chroot.py

index 1d4df266e69c44f5aa1cb3dfef2153b2e8d60fe6..becf0f4607a3aa083da425f51e8812ff66f561a9 100644 (file)
@@ -212,21 +212,19 @@ class Environment(object):
                ## XXX Could be done better
                self.log.debug("Creating users")
                f = open("/etc/passwd")
+               g = open(self.chrootPath("etc", "passwd"), "w")
                for line in f.readlines():
-                       if line.startswith("root"):
-                               g = open(self.chrootPath("etc", "passwd"), "w")
+                       if line.startswith("root") or line.startswith("nobody"):
                                g.write("%s" % line)
-                               g.close()
-                               break
+               g.close()
                f.close()
 
                f = open("/etc/group")
+               g = open(self.chrootPath("etc", "group"), "w")
                for line in f.readlines():
-                       if line.startswith("root"):
-                               g = open(self.chrootPath("etc", "group"), "w")
+                       if line.startswith("root") or line.startswith("nobody"):
                                g.write("%s" % line)
-                               g.close()
-                               break
+               g.close()
                f.close()
 
        def _mountall(self):