]> git.ipfire.org Git - ipfire-3.x.git/commitdiff
naoki: Hardcode the environment users.
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 22 Apr 2010 18:17:20 +0000 (20:17 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 22 Apr 2010 18:17:20 +0000 (20:17 +0200)
There are differences in the host system that
cause the old approach to break.

naoki/chroot.py

index a1888fd9cb3b2f1a6cd9a480806bdb6d5e2fbedf..7623c200ba03c84b8b63b45191b9efd85971f555 100644 (file)
@@ -209,22 +209,15 @@ class Environment(object):
                os.umask(prevMask)
 
        def _setupUsers(self):
-               ## 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") or line.startswith("nobody"):
-                               g.write("%s" % line)
-               g.close()
+               f = open(self.chrootPath("etc", "passwd"), "w")
+               f.write("root:x:0:0:root:/root:/bin/bash\n")
+               f.write("nobody:x:99:99:Nobody:/:/sbin/nologin\n")
                f.close()
 
-               f = open("/etc/group")
-               g = open(self.chrootPath("etc", "group"), "w")
-               for line in f.readlines():
-                       if line.startswith("root") or line.startswith("nobody"):
-                               g.write("%s" % line)
-               g.close()
+               f = open(self.chrootPath("etc", "group"), "w")
+               f.write("root:x:0:root\n")
+               f.write("nobody:x:99:\n")
                f.close()
 
        def _setupDns(self):