diff options
author | Ludovic Courtès <ludo@gnu.org> | 2016-08-30 17:59:15 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2016-08-31 15:44:19 +0200 |
commit | 183605c8533ad321ff8bba209b64071a9e84714a (patch) | |
tree | acf1fd1ac0e496f7dd7d69a006e1859f6bdad1fa /guix/scripts | |
parent | 1bc4d0c26634163413a8ec12c627367ca5c1bbba (diff) | |
download | gnu-guix-183605c8533ad321ff8bba209b64071a9e84714a.tar gnu-guix-183605c8533ad321ff8bba209b64071a9e84714a.tar.gz |
services: herd: Provide <live-service> objects.
* gnu/services/herd.scm (<live-service>): New record type.
(current-services): Change to return a single value: #f or a list of
<live-service>.
* guix/scripts/system.scm (call-with-service-upgrade-info): Adjust
accordingly.
* gnu/tests/base.scm (run-basic-test)["shepherd services"]: Adjust
accordingly.
Diffstat (limited to 'guix/scripts')
-rw-r--r-- | guix/scripts/system.scm | 51 |
1 files changed, 28 insertions, 23 deletions
diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm index a9fe7d5975..55a8e475d4 100644 --- a/guix/scripts/system.scm +++ b/guix/scripts/system.scm @@ -283,29 +283,34 @@ unload." (map (compose first shepherd-service-provision) new-services)) - (let-values (((running stopped) (current-services))) - (if (and running stopped) - (let* ((to-load - ;; Only load services that are either new or currently stopped. - (remove (lambda (service) - (memq (first (shepherd-service-provision service)) - running)) - new-services)) - (to-unload - ;; Unload services that are (1) no longer required, or (2) are - ;; in TO-LOAD. - (remove essential? - (append (remove (lambda (service) - (memq service new-service-names)) - (append running stopped)) - (filter (lambda (service) - (memq service stopped)) - (map shepherd-service-canonical-name - to-load)))))) - (mproc to-load to-unload)) - (with-monad %store-monad - (warning (_ "failed to obtain list of shepherd services~%")) - (return #f))))) + (match (current-services) + ((services ...) + (let* ((running (map (compose first live-service-provision) + (filter live-service-running services))) + (stopped (map (compose first live-service-provision) + (remove live-service-running services))) + (to-load + ;; Only load services that are either new or currently stopped. + (remove (lambda (service) + (memq (first (shepherd-service-provision service)) + running)) + new-services)) + (to-unload + ;; Unload services that are (1) no longer required, or (2) are + ;; in TO-LOAD. + (remove essential? + (append (remove (lambda (service) + (memq service new-service-names)) + (append running stopped)) + (filter (lambda (service) + (memq service stopped)) + (map shepherd-service-canonical-name + to-load)))))) + (mproc to-load to-unload))) + (#f + (with-monad %store-monad + (warning (_ "failed to obtain list of shepherd services~%")) + (return #f))))) (define (upgrade-shepherd-services os) "Upgrade the Shepherd (PID 1) by unloading obsolete services and loading new |