A Lisp implemented in AWK
(defun use-canned-facts-freebsd-jail (hostname alt-root)
  (setq *fact-short-hostname* hostname)
  (setq *fact-uname-os* "FreeBSD")
  (setq *fact-alt-root* alt-root)
  (setq *rooted* (lambda (pn) (strcat alt-root pn)))
  (setq *run-in-chroot*
        (lambda argv (append (list "chroot" *fact-alt-root*) argv)))
  (log-info "working with alternate root %s" alt-root))

(defun use-this-host ()
  (setq *fact-short-hostname* (output-of "hostname" "-s"))
  (setq *fact-uname-os* (output-of "uname" "-s"))
  (setq *fact-alt-root* nil)
  (setq *rooted* (lambda (pn) pn))
  (setq *run-in-chroot*
        (lambda argv argv))
  (log-info "working on this machine, %s, with the real root"
            *fact-short-hostname*))