1 |
commit: 32dd2617139e93159abb42eb4e3028a8b3f2f48a |
2 |
Author: Anthony G. Basile <blueness <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Dec 30 23:57:28 2013 +0000 |
4 |
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com> |
5 |
CommitDate: Wed Jan 22 04:30:16 2014 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=32dd2617 |
7 |
|
8 |
catalyst/targets/generic_stage_target.py: mount /dev/shm on linux |
9 |
|
10 |
Add shm targets defaults. Anthony G. Basile <blueness <AT> gentoo.org> |
11 |
Some build systems require /dev/shm to be mounted, like python's |
12 |
build system. We make sure that on Linux systems, /dev/shm is |
13 |
mounted in the stage chroots. See bug #496328. |
14 |
|
15 |
Douglas Freed <dwfreed <AT> mtu.edu> : |
16 |
Mount /dev/shm in the chroot with the right options |
17 |
Bind mounting /dev/shm into the chroot isn't a good idea, as there may |
18 |
be collisions and result in weird side effects. Instead, we can just |
19 |
mount a new tmpfs there, with the right options to ensure security. |
20 |
|
21 |
(Forward ported to 3.0 branch from 2.X Brian Dolbec) |
22 |
|
23 |
--- |
24 |
catalyst/base/stagebase.py | 6 +++++- |
25 |
catalyst/defaults.py | 2 ++ |
26 |
2 files changed, 7 insertions(+), 1 deletion(-) |
27 |
|
28 |
diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py |
29 |
index 7e09ed1..10868ee 100644 |
30 |
--- a/catalyst/base/stagebase.py |
31 |
+++ b/catalyst/base/stagebase.py |
32 |
@@ -209,6 +209,7 @@ class StageBase(TargetBase, ClearBase, GenBase): |
33 |
#self.mountmap["portdir"] = None |
34 |
if os.uname()[0] == "Linux": |
35 |
self.mounts.append("devpts") |
36 |
+ self.mounts.append("shm") |
37 |
|
38 |
self.set_mounts() |
39 |
|
40 |
@@ -930,7 +931,7 @@ class StageBase(TargetBase, ClearBase, GenBase): |
41 |
ensure_dirs(target, mode=0755) |
42 |
|
43 |
if not os.path.exists(self.mountmap[x]): |
44 |
- if not self.mountmap[x] == "tmpfs": |
45 |
+ if self.mountmap[x] not in ["tmpfs", "shmfs"]: |
46 |
ensure_dirs(self.mountmap[x], mode=0755) |
47 |
|
48 |
src=self.mountmap[x] |
49 |
@@ -951,6 +952,9 @@ class StageBase(TargetBase, ClearBase, GenBase): |
50 |
self.settings["var_tmpfs_portage"] + "G " + \ |
51 |
src + " " + target |
52 |
retval=os.system(cmd) |
53 |
+ elif src == "shmfs": |
54 |
+ cmd = "mount -t tmpfs -o noexec,nosuid,nodev shm " + target |
55 |
+ retval=os.system(cmd) |
56 |
else: |
57 |
cmd = "mount --bind " + src + " " + target |
58 |
#print "bind(); cmd =", cmd |
59 |
|
60 |
diff --git a/catalyst/defaults.py b/catalyst/defaults.py |
61 |
index 27bcff4..1f86c1d 100644 |
62 |
--- a/catalyst/defaults.py |
63 |
+++ b/catalyst/defaults.py |
64 |
@@ -92,6 +92,7 @@ TARGET_MOUNT_DEFAULTS = { |
65 |
"port_tmpdir": "/var/tmp/portage", |
66 |
"port_logdir": "/var/log/portage", |
67 |
"proc": "/proc", |
68 |
+ "shm": "/dev/shm", |
69 |
} |
70 |
|
71 |
SOURCE_MOUNT_DEFAULTS = { |
72 |
@@ -101,6 +102,7 @@ SOURCE_MOUNT_DEFAULTS = { |
73 |
"portdir": None, # set from settings options |
74 |
"port_tmpdir": "tmpfs", |
75 |
"proc": "/proc", |
76 |
+ "shm": "shmfs", |
77 |
} |
78 |
|
79 |
# legend: key: message |