1 |
commit: e5a9e20376397f2714aa7a835b7f42f71fcc38d9 |
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: Fri Jan 3 06:39:31 2014 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=e5a9e203 |
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 pending branch from 2.X Brian Dolbec) |
22 |
Conflicts: |
23 |
catalyst/targets/generic_stage_target.py |
24 |
|
25 |
--- |
26 |
modules/generic_stage_target.py | 8 +++++++- |
27 |
1 file changed, 7 insertions(+), 1 deletion(-) |
28 |
|
29 |
diff --git a/modules/generic_stage_target.py b/modules/generic_stage_target.py |
30 |
index 790e4da..3d66231 100644 |
31 |
--- a/modules/generic_stage_target.py |
32 |
+++ b/modules/generic_stage_target.py |
33 |
@@ -20,6 +20,7 @@ TARGET_MOUNTS_DEFAULTS = { |
34 |
"port_tmpdir": "/var/tmp/portage", |
35 |
"port_logdir": "/var/log/portage", |
36 |
"proc": "/proc", |
37 |
+ "shm": "/dev/shm", |
38 |
} |
39 |
|
40 |
SOURCE_MOUNTS_DEFAULTS = { |
41 |
@@ -29,6 +30,7 @@ SOURCE_MOUNTS_DEFAULTS = { |
42 |
"portdir": "/usr/portage", |
43 |
"port_tmpdir": "tmpfs", |
44 |
"proc": "/proc", |
45 |
+ "shm": "shmfs", |
46 |
} |
47 |
|
48 |
|
49 |
@@ -218,6 +220,7 @@ class generic_stage_target(generic_target): |
50 |
#self.mountmap["portdir"] = None |
51 |
if os.uname()[0] == "Linux": |
52 |
self.mounts.append("devpts") |
53 |
+ self.mounts.append("shm") |
54 |
|
55 |
self.set_mounts() |
56 |
|
57 |
@@ -938,7 +941,7 @@ class generic_stage_target(generic_target): |
58 |
os.makedirs(target, 0755) |
59 |
|
60 |
if not os.path.exists(self.mountmap[x]): |
61 |
- if not self.mountmap[x] == "tmpfs": |
62 |
+ if self.mountmap[x] not in ["tmpfs", "shmfs"]: |
63 |
os.makedirs(self.mountmap[x], 0755) |
64 |
|
65 |
src=self.mountmap[x] |
66 |
@@ -959,6 +962,9 @@ class generic_stage_target(generic_target): |
67 |
self.settings["var_tmpfs_portage"] + "G " + \ |
68 |
src + " " + target |
69 |
retval=os.system(cmd) |
70 |
+ elif src == "shmfs": |
71 |
+ cmd = "mount -t tmpfs -o noexec,nosuid,nodev shm " + target |
72 |
+ retval=os.system(cmd) |
73 |
else: |
74 |
cmd = "mount --bind " + src + " " + target |
75 |
#print "bind(); cmd =", cmd |