summaryrefslogtreecommitdiff
path: root/lua_scripts/pathmaps
diff options
context:
space:
mode:
authorTimo Savola <tsavola@movial.fi>2008-07-25 14:58:29 +0300
committerTimo Savola <tsavola@movial.fi>2008-07-25 15:20:22 +0300
commitb20013b5a8a1ef62ffa48924d83d6f04c70ab244 (patch)
tree7b4168eefceda8b3e7d6f9a1f82e05ad22c51be8 /lua_scripts/pathmaps
parent3d5b7b96066996a5b7a29ab335d4b93d2b546952 (diff)
'install' mapping mode
intended to make "make install" work. Signed-off-by: Timo Savola <tsavola@movial.fi>
Diffstat (limited to 'lua_scripts/pathmaps')
-rw-r--r--lua_scripts/pathmaps/install/00_default.lua78
1 files changed, 78 insertions, 0 deletions
diff --git a/lua_scripts/pathmaps/install/00_default.lua b/lua_scripts/pathmaps/install/00_default.lua
new file mode 100644
index 0000000..8c77cf2
--- /dev/null
+++ b/lua_scripts/pathmaps/install/00_default.lua
@@ -0,0 +1,78 @@
+-- Copyright (C) 2007 Lauri Leukkunen <lle@rahina.org>
+-- Copyright (C) 2008 Movial
+-- Licensed under MIT license.
+
+if (tools_root and tools_root ~= "/") then
+ tools_source = tools_root
+ tools_target = tools_root
+else
+ tools_source = "/nonexistent"
+ tools_target = "/"
+end
+
+interp_wrapper = os.getenv("SBOX_DIR") .. "/bin/sb2-interp-wrapper"
+
+default_chain = {
+ next_chain = nil,
+ binary = nil,
+ rules = {
+ { prefix = tools_source, use_orig_path = true, readonly = true },
+
+ { path = "/bin/sh", func_name = ".*exec.*", replace_by = interp_wrapper },
+ { path = "/bin/bash", func_name = ".*exec.*", replace_by = interp_wrapper },
+
+ { prefix = "/bin", func_name = ".*exec.*", map_to = tools_target },
+ { prefix = "/usr/bin", func_name = ".*exec.*", map_to = tools_target },
+ { prefix = "/usr/local/bin", func_name = ".*exec.*", map_to = tools_target },
+
+ { prefix = "/dev", func_name = "open.*", use_orig_path = true },
+ { prefix = "/proc", use_orig_path = true },
+ { prefix = "/sys", use_orig_path = true },
+ { prefix = "/tmp", use_orig_path = true },
+
+ { prefix = os.getenv("HOME"), use_orig_path = true },
+ { prefix = os.getenv("SBOX_WORKDIR"), use_orig_path = true },
+ { prefix = os.getenv("SBOX_DIR") .. "/share/scratchbox2", use_orig_path = true, readonly = true },
+ { prefix = os.getenv("SBOX_DIR") .. "/bin", use_orig_path = true, readonly = true },
+ { prefix = os.getenv("SBOX_TARGET_TOOLCHAIN_DIR"), use_orig_path = true, readonly = true },
+
+ { prefix = "/", map_to = target_root },
+ }
+}
+
+bash_chain = {
+ next_chain = default_chain,
+ binary = "bash",
+ rules = {
+ { prefix = "/bin", func_name = "__xstat.*", map_to = tools_target },
+ { prefix = "/usr/bin", func_name = "__xstat.*", map_to = tools_target },
+ { prefix = "/usr/local/bin", func_name = "__xstat.*", map_to = tools_target },
+ }
+}
+
+sh_chain = {
+ next_chain = default_chain,
+ binary = "sh",
+ rules = {
+ { prefix = "/bin", func_name = "__xstat.*", map_to = tools_target },
+ { prefix = "/usr/bin", func_name = "__xstat.*", map_to = tools_target },
+ { prefix = "/usr/local/bin", func_name = "__xstat.*", map_to = tools_target },
+ }
+}
+
+interp_wrapper_chain = {
+ next_chain = default_chain,
+ binary = "sb2-interp-wrapper",
+ rules = {
+ { prefix = "/bin", func_name = "__xstat.*", map_to = tools_target },
+ { prefix = "/usr/bin", func_name = "__xstat.*", map_to = tools_target },
+ { prefix = "/usr/local/bin", func_name = "__xstat.*", map_to = tools_target },
+ }
+}
+
+export_chains = {
+ sh_chain,
+ bash_chain,
+ interp_wrapper_chain,
+ default_chain,
+}