aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuta SATOH <nigoro.dev@gmail.com>2017-12-28 17:02:02 -0800
committerBrian Dolbec <dolsen@gentoo.org>2017-12-28 18:01:27 -0800
commit16155aaa9b09112a7a49d0c833b19be3399e746a (patch)
tree5ae5383c6efae346e2a59a426be107511abcd963
parenttestpath: Change to PWD instead of BASH_SOURCE (diff)
downloadcatalyst-16155aaa9b09112a7a49d0c833b19be3399e746a.tar.gz
catalyst-16155aaa9b09112a7a49d0c833b19be3399e746a.tar.bz2
catalyst-16155aaa9b09112a7a49d0c833b19be3399e746a.zip
main.py: Disable snakeoil's namespace module on Gentoo/FreeBSD #363557
Some code improvement by: Patrice Clement <monsieurp@gentoo.org> Bug url: https://bugs.gentoo.org/363577
-rw-r--r--catalyst/main.py17
1 files changed, 10 insertions, 7 deletions
diff --git a/catalyst/main.py b/catalyst/main.py
index 4c55a415..2d2faada 100644
--- a/catalyst/main.py
+++ b/catalyst/main.py
@@ -430,13 +430,16 @@ 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')
+ # Namespaces aren't supported on *BSDs at the moment. So let's check
+ # whether we're on Linux.
+ if os.uname().sysname in ["Linux", "linux"]:
+ # 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: