eyre.bins

bins

All the binaries searched for by default by gather-paths

gather-paths

(gather-paths {:keys [exec shell], :as args})

Discovers the absolute paths of common binaries on the host reachable via exec.

Arguments

Takes a map with:

  • :exec - an executor function that runs a script string on the target host and returns {:exit int :out string :err string}.
  • :shell - the shell map returned by eyre.shell/gather-shell; its :type selects which generated lookup script is run (see make-which).
  • :bins - optional list of binaries to search for. If absent uses this namespace’s bin var.

Returns

A map of binary name keyword -> absolute path string for every binary in eyre.bins/bins that was found on the host, e.g.

{:bash "/usr/bin/bash"
 :git "/usr/bin/git"
 :systemctl "/usr/bin/systemctl"}

Binaries that are not installed (or not on the searched PATH) are simply absent from the map, so the exact key set varies between hosts. The probed binary list covers shells, core file/text utilities, hash and checksum tools, user/group administration tools, downloaders, and common package/service managers.

The lookup prepends /usr/local/sbin, /usr/sbin and /sbin to the search PATH (on posix shells) so system binaries are found even when the login shell’s default PATH omits them. Shell builtins that have no external binary (e.g. true in some shells) may still be resolved by searching PATH directory-by-directory; those with no on-disk counterpart are omitted.

Example

(bins/gather-paths {:exec local-exec :shell shell})
;; => {:bash "/usr/bin/bash" :cat "/usr/bin/cat" ...}