[Piuparts-devel] Bug#507171: piuparts: mount /selinux if enabled

Filippo Giunchedi filippo at debian.org
Sat Nov 29 14:23:46 UTC 2008


On Fri, Nov 28, 2008 at 07:44:41PM +0100, Filippo Giunchedi wrote:
> Index: piuparts.py
> ===================================================================
> --- piuparts.py	(revision 173)
> +++ piuparts.py	(working copy)
> @@ -548,6 +548,7 @@
>  
>          self.configure_chroot()
>          self.mount_proc()
> +        self.mount_selinux()
>          if settings.basetgz:
>              self.run(["apt-get", "-yf", "upgrade"])
>          self.minimize()
> @@ -562,6 +563,7 @@
>          """Remove a chroot and all its contents."""
>          if not settings.keep_tmpdir and os.path.exists(self.name):
>              self.unmount_proc()
> +            self.unmount_selinux()
>              shutil.rmtree(self.name)
>              logging.debug("Removed directory tree at %s" % self.name)
>  
> @@ -864,6 +866,18 @@
>                            indent_string(output))
>              panic()
>  
> +
> +    def mount_selinux(self):
> +        if selinux_enabled():
> +            run(["mkdir", "-p", self.relative("/selinux")])
> +            run(["mount", "-t", "selinuxfs", "/selinux", self.relative("/selinux")]))
> +            logging.info("SElinux mounted into chroot")
> +
> +    def unmount_selinux(self):
> +        if selinux_enabled():
> +            run(["umount", self.relative("/selinux")])
> +            logging.info("SElinux unmounted from chroot")

you might want to remove the logging.info() calls as they are not there for
mount_proc for example

thanks,
filippo
--
Filippo Giunchedi - http://esaurito.net
PGP key: 0x6B79D401
random quote follows:

To be learned in an art&C, the Theory is sufficient; to be a master of
it, both the Theory and practice are requisite.
-- Charles Hutton





More information about the Piuparts-devel mailing list