11# Paths bundle (used by other bodies)
22
33bundle common paths
4- # @brief Defines an array `path` with common paths to standard binaries,
5- # and classes for defined and existing paths.
4+ # @brief Defines an array `path` with common paths to standard binaries and
5+ # directories as well as classes for defined and existing paths.
66#
77# If the current platform knows that binary XYZ should be present,
88# `_stdlib_has_path_XYZ` is defined. Furthermore, if XYZ is actually present
@@ -25,6 +25,22 @@ bundle common paths
2525# comment => "Alternate array reference style";
2626# }
2727# ```
28+ #
29+ # Additionally several path entries are present to aid in policy sharing between
30+ # unix systems and Android Termux environments.
31+ #
32+ # **Example:**
33+ #
34+ # ```cf3
35+ # bundle agent track_sshd_config
36+ # {
37+ # files:
38+ # "$(paths.etc_path)/sshd/sshd_config"
39+ # changes => detect_all_change;
40+ # }
41+ # ```
42+ #
43+ # In case of termux, `paths.etc_path` will be `/data/data/com.termux/files/usr/etc`.
2844{
2945 vars:
3046
@@ -570,6 +586,32 @@ bundle common paths
570586
571587 "path[shadow]" string => "/etc/security/passwd";
572588
589+ termux::
590+ "path[tar]" string => "/usr/bin/tar";
591+ "path[true]" string => "/usr/bin/true";
592+ "path[false]" string => "/usr/bin/false";
593+ "path[cat]" string => "/usr/bin/cat";
594+ "path[sysctl]" string => "/usr/bin/sysctl";
595+ "path[env]" string => "/usr/bin/env";
596+
597+ # now, mangle the values by prepending the TERMUX_PREFIX
598+ "files_path" string => "/data/data/com.termux/files";
599+ "etc_path" string => "$(files_path)/usr/etc";
600+ "tmp_path" string => "$(files_path)/usr/tmp";
601+ "bin_path" string => "$(files_path)/usr/bin";
602+ "var_path" string => "$(files_path)/usr/var";
603+ "tmp_paths" slist => getindices("path");
604+ "tmp_path[$(tmp_paths)]" string => "$(files_path)$(path[$(tmp_paths)])";
605+ "path[$(tmp_paths)]" string => "$(tmp_path[$(tmp_paths)])";
606+
607+ !(termux|windows)::
608+ # reasonable defaults for unix systems to allow for writing
609+ # more portable paths between termux and other systems
610+ "etc_path" string => "/etc";
611+ "tmp_path" string => "/tmp";
612+ "bin_path" string => "/bin";
613+ "var_path" string => "/var";
614+
573615 any::
574616
575617 "all_paths" slist => getindices("path");
0 commit comments