aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2015-10-06 16:32:03 -0400
committerMike Frysinger <vapier@gentoo.org>2017-03-11 14:01:27 -0800
commite5a53e42022668563965ede6409a3de233af332c (patch)
tree0446258b959b5d8d26ff6d2295c981d15e3614f2
parentstage1: run bootstrap w/--verbose (diff)
downloadcatalyst-e5a53e42022668563965ede6409a3de233af332c.tar.gz
catalyst-e5a53e42022668563965ede6409a3de233af332c.tar.bz2
catalyst-e5a53e42022668563965ede6409a3de233af332c.zip
catalyst: create namespaces for building
This helps isolate the catalyst builds from the rest of the system and allows us to build as non-root user in more cases. We don't support pid or user namespaces yet.
-rw-r--r--catalyst/main.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/catalyst/main.py b/catalyst/main.py
index 51d2b04a..b8ae662d 100644
--- a/catalyst/main.py
+++ b/catalyst/main.py
@@ -12,6 +12,7 @@ import os
import sys
from snakeoil import process
+from snakeoil.process import namespaces
from DeComp.definitions import (COMPRESS_DEFINITIONS, DECOMPRESS_DEFINITIONS,
CONTENTS_DEFINITIONS)
@@ -421,6 +422,14 @@ def _main(parser, opts):
# catalyst cannot be run as a normal user due to chroots, mounts, etc
log.critical('This script requires root privileges to operate')
+ # Start off by creating unique namespaces to run in. Would be nice to
+ # use pid & user namespaces, but snakeoil's namespace module has signal
+ # transfer issues (CTRL+C doesn't propagate), and user namespaces need
+ # more work due to Gentoo build process (uses sudo/root/portage).
+ namespaces.simple_unshare(
+ mount=True, uts=True, ipc=True, pid=False, net=False, user=False,
+ hostname='catalyst')
+
# everything is setup, so the build is a go
try:
success = build_target(addlargs)