summaryrefslogtreecommitdiff
path: root/lua_scripts
diff options
context:
space:
mode:
authorLauri Aarnio <Lauri.Aarnio@iki.fi>2008-11-19 17:21:55 +0200
committerLauri Leukkunen <lle@rahina.org>2008-12-07 04:32:47 +0200
commitb2de45faa0619f3f8d45ae4d0e344939fc960afb (patch)
tree97e717915911be1ac679bb37e173a62a44a12b5d /lua_scripts
parentbff8f6cc9fee86ac863580efec776668cb7f9b14 (diff)
Added "tools" mapping mode
- Within the "tools" mapping mode almost everything is mapped to tools_root. - Example: This is useful for listing the contents of the package DB: "sb2 -m tools dpkg -l" lists packages from tools_root (note that the package DB is mapped to the target_root directories in other mapping modes)
Diffstat (limited to 'lua_scripts')
-rw-r--r--lua_scripts/pathmaps/tools/00_default.lua140
1 files changed, 140 insertions, 0 deletions
diff --git a/lua_scripts/pathmaps/tools/00_default.lua b/lua_scripts/pathmaps/tools/00_default.lua
new file mode 100644
index 0000000..7f144ec
--- /dev/null
+++ b/lua_scripts/pathmaps/tools/00_default.lua
@@ -0,0 +1,140 @@
+-- Copyright (C) 2008 Lauri Leukkunen <lle@rahina.org>
+-- Copyright (C) 2008 Nokia Corporation.
+-- Licensed under MIT license.
+
+-- "tools" mapping mode: Almost everything maps to tools_root.
+
+-- Rule file interface version, mandatory.
+--
+rule_file_interface_version = "16"
+----------------------------------
+
+-- If the permission token exists and contains "root", tools_root directories
+-- will be available in R/W mode. Otherwise it will be "mounted" R/O.
+local tools_root_is_readonly
+if sb.get_session_perm() == "root" then
+ tools_root_is_readonly = false
+else
+ tools_root_is_readonly = true
+end
+
+-- disable the gcc toolchain tricks. gcc & friends will be available, if
+-- those have been installed to tools_root
+enable_cross_gcc_toolchain = false
+
+mapall_chain = {
+ next_chain = nil,
+ binary = nil,
+ rules = {
+ {path = sbox_cputransparency_method, use_orig_path = true,
+ readonly = true},
+
+ {path = "/usr/bin/sb2-show", use_orig_path = true,
+ readonly = true},
+
+ -- ldconfig is static binary, and needs to be wrapped
+ {prefix = "/sb2/wrappers",
+ replace_by = session_dir .. "/wrappers." .. sbox_mapmode,
+ readonly = true},
+
+ --
+ {prefix = "/var/run", map_to = session_dir},
+
+ --
+ {prefix = session_dir, use_orig_path = true},
+ {prefix = "/tmp", map_to = session_dir},
+
+ --
+ {prefix = "/dev", use_orig_path = true},
+ {prefix = "/proc", use_orig_path = true},
+ {prefix = "/sys", use_orig_path = true},
+
+ {prefix = sbox_user_home_dir .. "/.scratchbox2",
+ use_orig_path = true},
+ {prefix = sbox_dir .. "/share/scratchbox2",
+ use_orig_path = true},
+
+ {prefix = "/etc/resolv.conf", use_orig_path = true,
+ readonly = true},
+
+ -- -----------------------------------------------
+ -- home directories = not mapped, R/W access
+ {prefix = "/home", use_orig_path = true},
+
+ -- -----------------------------------------------
+
+ -- The default is to map everything to tools_root
+
+ {path = "/", use_orig_path = true},
+ {prefix = "/", map_to = tools_root,
+ readonly = tools_root_is_readonly}
+ }
+}
+
+export_chains = {
+ mapall_chain
+}
+
+-- Exec policy rules.
+
+default_exec_policy = {
+ name = "Default"
+}
+
+-- For binaries from tools_root:
+-- we have "tools' native" and "host's native" binaries, that would look
+-- identical (and valid!) to the kernel. But they may need to use different
+-- loaders and dynamic libraries! The solution is that we use the location
+-- (as determined by the mapping engine) to decide the execution policy.
+
+tools_mode_tools_ld_so = nil -- default = not needed
+tools_mode_tools_ld_library_path = nil -- default = not needed
+
+-- used if libsb2.so is not available in tools_root:
+tools_mode_tools_ld_library_path_suffix = nil
+
+if (conf_tools_sb2_installed) then
+ if (conf_tools_ld_so ~= nil) then
+ -- use dynamic libraries from tools,
+ -- when executing native binaries!
+ tools_mode_tools_ld_so = conf_tools_ld_so
+ tools_mode_tools_ld_library_path = conf_tools_ld_so_library_path
+
+ -- FIXME: This exec policy should process (map components of)
+ -- the current value of LD_LIBRARY_PATH, and add the results
+ -- to tools_mode_tools_ld_library_path just before exec.
+ -- This has not been done yet.
+ end
+else
+ tools_mode_tools_ld_library_path_suffix = conf_tools_ld_so_library_path
+end
+
+local exec_policy_tools = {
+ name = "Tools_root",
+ native_app_ld_so = tools_mode_tools_ld_so,
+ native_app_ld_so_supports_argv0 = conf_tools_ld_so_supports_argv0,
+ native_app_ld_library_path = tools_mode_tools_ld_library_path,
+
+ native_app_ld_library_path_suffix = tools_mode_tools_ld_library_path_suffix,
+
+ native_app_locale_path = conf_tools_locale_path,
+ native_app_message_catalog_prefix = conf_tools_message_catalog_prefix,
+}
+
+-- Note that the real path (mapped path) is used when looking up rules!
+all_exec_policies_chain = {
+ next_chain = nil,
+ binary = nil,
+ rules = {
+ -- Tools binaries:
+ {prefix = tools_root, exec_policy = exec_policy_tools},
+
+ -- DEFAULT RULE (must exist):
+ {prefix = "/", exec_policy = default_exec_policy}
+ }
+}
+
+exec_policy_chains = {
+ all_exec_policies_chain
+}
+