path: root/etc
diff options
context:
space:
mode:
Diffstat (limited to 'etc')
0 files changed, 0 insertions, 0 deletions
ser namespace but living in a ;; different mount namespace, so that they can lookup users. (list (file-system-mapping (source "/etc/passwd") (target source)) (file-system-mapping (source "/etc/group") (target source)))) (append (cons (tmpfs "/tmp") %container-file-systems) (let ((mappings `(,@(if (memq 'net namespaces) '() %network-file-mappings) ,@(if (and (memq 'mnt namespaces) (not (memq 'user namespaces))) accounts '()) ;; Tell the process what timezone we're in. This ;; makes sure that, for instance, its syslog ;; messages have the correct timestamp. ,(file-system-mapping (source "/etc/localtime") (target source)) ,%store-mapping))) ;XXX: coarse-grain (map file-system-mapping->bind-mount (filter (lambda (mapping) (file-exists? (file-system-mapping-source mapping))) mappings))))) (define* (exec-command* command #:key user group log-file pid-file (supplementary-groups '()) (directory "/") (environment-variables (environ))) "Like 'exec-command', but first restore signal handles modified by shepherd (PID 1)." ;; First restore the default handlers. (for-each (cut sigaction <> SIG_DFL) %precious-signals) ;; Unblock any signals that have been blocked by the parent process. (unblock-signals %precious-signals) (mkdir-p "/var/run") (clean-up pid-file) (exec-command command #:user user #:group group #:supplementary-groups supplementary-groups #:log-file log-file #:directory directory #:environment-variables environment-variables)) (define* (fork+exec-command/container command #:key pid #:allow-other-keys #:rest args) "This is a variant of 'fork+exec-command' procedure, that joins the namespaces of process PID beforehand. If there is no support for containers, on Hurd systems for instance, fallback to direct forking." (define (strip-pid args) ;; TODO: Replace with 'strip-keyword-arguments' when that no longer pulls ;; in (guix config). (let loop ((args args) (result '())) (match args (() (reverse result)) ((#:pid _ . rest) (loop rest result)) ((head . rest) (loop rest (cons head result)))))) (let ((container-support? (file-exists? "/proc/self/ns"))) (if (and container-support? (not (and pid (= pid (getpid))))) (container-excursion* pid (lambda () ;; Note: In the Shepherd 0.9, 'fork+exec-command' expects to be ;; called from the shepherd process (because it creates a pipe to ;; capture stdout/stderr and spawns a logging fiber) so we cannot ;; use it here. (match (primitive-fork) (0 (dynamic-wind (const #t) (lambda () (apply exec-command* command (strip-pid args))) (lambda () (primitive-_exit 127)))) (pid pid)))) ;XXX: assuming the same PID namespace (apply fork+exec-command command (strip-pid args))))) ;; Local Variables: ;; eval: (put 'container-excursion* 'scheme-indent-function 1) ;; End: ;;; shepherd.scm ends here