]> git.ipfire.org Git - ipfire-3.x.git/commitdiff
naoki: Fix for devpts on older kernels.
authorMichael Tremer <michael.tremer@ipfire.org>
Sat, 13 Mar 2010 09:43:49 +0000 (10:43 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Sat, 13 Mar 2010 09:43:49 +0000 (10:43 +0100)
If the kernel is too old, there is no /dev/pts/ptmx node
and so we need to create it on our own.

naoki/chroot.py

index becf0f4607a3aa083da425f51e8812ff66f561a9..241948a2cc13fae9af6ed98e499d86fe3d422fec 100644 (file)
@@ -188,7 +188,6 @@ class Environment(object):
                os.symlink("/proc/self/fd/0", self.chrootPath("dev", "stdin"))
                os.symlink("/proc/self/fd/1", self.chrootPath("dev", "stdout"))
                os.symlink("/proc/self/fd/2", self.chrootPath("dev", "stderr"))
-               os.symlink("/dev/pts/ptmx", self.chrootPath("dev", "ptmx"))
                os.umask(prevMask)
 
                # mount/umount
@@ -208,6 +207,13 @@ class Environment(object):
                        if devMntCmd not in self.mountCmds:
                                self.mountCmds.append(devMntCmd)
 
+       def _checkDev(self):
+               if os.path.exists(self.chrootPath("dev", "pts", "ptmx")):
+                       os.symlink("/dev/pts/ptmx", self.chrootPath("dev", "ptmx"))
+               else:
+                       os.mknod(self.chrootPath("dev", "ptmx"), stat.S_IFCHR | 0666, os.makedev(5, 2))
+                       os.chmod(self.chrootPath("dev", "ptmx"), 666)
+
        def _setupUsers(self):
                ## XXX Could be done better
                self.log.debug("Creating users")
@@ -231,6 +237,7 @@ class Environment(object):
                """mount 'normal' fs like /dev/ /proc/ /sys"""
                for cmd in self.mountCmds:
                        util.do(cmd, shell=True)
+               self._checkDev()
 
        def _umountall(self):
                """umount all mounted chroot fs."""