[Piuparts-commits] [piuparts] 01/51: p: mount $(tty) onto /dev/console in the chroot

Holger Levsen holger at layer-acht.org
Thu Jul 20 21:15:00 UTC 2017


This is an automated email from the git hooks/post-receive script.

holger pushed a commit to branch develop
in repository piuparts.

commit dcc3f108ed5ab521b0e865ce7483541c5ef995f2
Author: Andreas Beckmann <anbe at debian.org>
Date:   Sun Jun 18 15:17:21 2017 +0200

    p: mount $(tty) onto /dev/console in the chroot
    
    Signed-off-by: Andreas Beckmann <anbe at debian.org>
    Signed-off-by: Holger Levsen <holger at layer-acht.org>
---
 debian/changelog | 3 ++-
 piuparts.py      | 8 ++++++++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/debian/changelog b/debian/changelog
index 576755b..79053ea 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -11,7 +11,8 @@ piuparts (0.78) UNRELEASED; urgency=medium
       to recognize mirror pushes during distupgrade tests and outdated
       --end-meta meta-data.
     - Mount a new devpts instance on /dev/pts and /dev/ptmx inside the chroot
-      for better pty separation from the host. Inspired by pbuilder.
+      for better pty separation from the host. Mount the current tty onto
+      /dev/console in the chroot. Inspired by pbuilder.
     - Arguments to the --ignore/--ignore-regexp options (and internal
       ignored_files/ignored_patterns settings) that are prefixed with a ':'
       will verbosely log the ignored files if matched.
diff --git a/piuparts.py b/piuparts.py
index 260eb76..f6d575c 100644
--- a/piuparts.py
+++ b/piuparts.py
@@ -1682,6 +1682,14 @@ class Chroot:
         self.mount("devpts", "/dev/pts", fstype="devpts", opts="newinstance,noexec,nosuid,gid=5,mode=0620,ptmxmode=0666")
         if not os.path.islink(self.relative("dev/ptmx")):
             self.mount(self.relative("dev/pts/ptmx"), "/dev/ptmx", opts="bind", no_mkdir=True)
+        p = subprocess.Popen(["tty"], stdout=subprocess.PIPE)
+        stdout, _ = p.communicate()
+        current_tty = stdout.strip()
+        if p.returncode == 0 and os.path.exists(current_tty):
+            dev_console = self.relative("/dev/console")
+            if not os.path.exists(dev_console):
+                os.mknod(dev_console, 0600, os.makedev(5, 1))
+            self.mount(current_tty, "/dev/console", opts="bind", no_mkdir=True)
         self.mount("tmpfs", "/dev/shm", fstype="tmpfs", opts="size=65536k")
         if selinux_enabled():
             self.mount("/sys/fs/selinux", self.selinuxfs_path(), opts="bind,ro")

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/piuparts/piuparts.git



More information about the Piuparts-commits mailing list