aboutsummaryrefslogtreecommitdiff
path: root/gnu/packages/irc.scm
diff options
context:
space:
mode:
authorW. Kosior <koszko@koszko.org>2024-09-04 21:02:12 +0200
committerW. Kosior <koszko@koszko.org>2024-09-04 21:02:12 +0200
commitd9444c277738dff2a832964069ab8624cd762f4c (patch)
treea4021c4006e3667190aeeaf1838548c7490ad7c3 /gnu/packages/irc.scm
parent4aad2dedac15c2f3c9b427dc8a9ae2992e963a16 (diff)
downloadguix-koszko.tar.gz
guix-koszko.zip
Allow unauthorized `guix pull`HEADkoszko
Change-Id: If9f9b01e81a9778275944ebd2645db685ca8ccbc
Diffstat (limited to 'gnu/packages/irc.scm')
0 files changed, 0 insertions, 0 deletions
. 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