[Piuparts-commits] [piuparts] 02/07: p: use Chroot.mount()
Holger Levsen
holger at moszumanska.debian.org
Mon Nov 2 17:19:00 UTC 2015
This is an automated email from the git hooks/post-receive script.
holger pushed a commit to branch develop
in repository piuparts.
commit 8ea5c4650422cb8c7b9fa13bcee4d71523c5d1c3
Author: Andreas Beckmann <anbe at debian.org>
Date: Mon Nov 2 17:32:07 2015 +0100
p: use Chroot.mount()
Signed-off-by: Andreas Beckmann <anbe at debian.org>
---
debian/changelog | 4 +++-
piuparts.py | 21 ++++-----------------
2 files changed, 7 insertions(+), 18 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index 831cc3b..8eaccc6 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,6 +1,8 @@
piuparts (0.68) UNRELEASED; urgency=medium
- * continue development...
+ [ Andreas Beckmann ]
+ * piuparts.py:
+ - Simplify mounting/unmounting into the chroot.
-- Holger Levsen <holger at debian.org> Sat, 17 Oct 2015 16:42:39 +0200
diff --git a/piuparts.py b/piuparts.py
index 6c949d2..0b850ab 100644
--- a/piuparts.py
+++ b/piuparts.py
@@ -769,7 +769,6 @@ class Chroot:
self.unmount_all()
if not settings.schroot:
self.unmount_selinux()
- self.unmount_proc()
if settings.lvm_volume:
logging.debug('Unmounting and removing LVM snapshot %s' % self.lvm_snapshot_name)
run(['umount', self.name])
@@ -1028,8 +1027,7 @@ class Chroot:
self.create_policy_rc_d()
self.create_resolv_conf()
for bindmount in settings.bindmounts:
- run(["mkdir", "-p", self.relative(bindmount)])
- run(["mount", "-obind", bindmount, self.relative(bindmount)])
+ self.mount(bindmount, bindmount, opts="bind")
self.run(["apt-get", "update"])
def upgrade_to_distros(self, distros, packages):
@@ -1569,20 +1567,12 @@ class Chroot:
run(["umount", mountpoint], ignore_errors=True)
def mount_proc(self):
- """Mount /proc inside chroot."""
- self.run(["mount", "-t", "proc", "proc", "/proc"])
+ """Mount /proc etc. inside chroot."""
+ self.mount("proc", "/proc", fstype="proc")
etcmtab = self.relative("etc/mtab")
if not os.path.lexists(etcmtab):
os.symlink("../proc/mounts", etcmtab)
- self.mkdir_p("dev/pts")
- self.run(["mount", "-t", "devpts", "devpts", "/dev/pts"])
-
- def unmount_proc(self):
- """Unmount /proc inside chroot."""
- self.run(["umount", "/proc"], ignore_errors=True)
- self.run(["umount", "/dev/pts"], ignore_errors=True)
- for bindmount in settings.bindmounts:
- run(["umount", self.relative(bindmount)], ignore_errors=True)
+ self.mount("devpts", "/dev/pts", fstype="devpts")
def is_ignored(self, pathname):
"""Is a file (or dir or whatever) to be ignored?"""
@@ -2023,9 +2013,6 @@ class VirtServ(Chroot):
def mount_proc(self):
pass
- def unmount_proc(self):
- pass
-
def selinux_enabled(enabled_test="/usr/sbin/selinuxenabled"):
if os.access(enabled_test, os.X_OK):
--
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