diff options
| author | Giacomo Leidi <goodoldpaul@autistici.org> | 2023-01-02 18:05:24 +0100 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2023-01-10 11:49:14 +0100 |
| commit | 5f63811032dab5c04c397e043cc7290cb3d51ee0 (patch) | |
| tree | 0e2be1ba3e1cd7b73e83350a6211f65c9725b112 /gnu/services/admin.scm | |
| parent | 22e9b01bdaa8184aa08f03542798750bc587b457 (diff) | |
services: unattended-upgrade: Add 'operating-system-expression' field.
* gnu/services/admin.scm (<unattended-upgrade-configuration>)
[operating-system-expression]: New field.
(unattended-upgrade-mcron-jobs): Honor it.
* doc/guix.texi (Unattended Upgrades): Document it.
Co-authored-by: Ludovic Courtès <ludo@gnu.org>
Diffstat (limited to 'gnu/services/admin.scm')
| -rw-r--r-- | gnu/services/admin.scm | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/gnu/services/admin.scm b/gnu/services/admin.scm index 252bedb0bd2..1c10cfb1f6a 100644 --- a/gnu/services/admin.scm +++ b/gnu/services/admin.scm | |||
| @@ -1,7 +1,8 @@ | |||
| 1 | ;;; GNU Guix --- Functional package management for GNU | 1 | ;;; GNU Guix --- Functional package management for GNU |
| 2 | ;;; Copyright © 2016 Jan Nieuwenhuizen <janneke@gnu.org> | 2 | ;;; Copyright © 2016 Jan Nieuwenhuizen <janneke@gnu.org> |
| 3 | ;;; Copyright © 2016-2022 Ludovic Courtès <ludo@gnu.org> | 3 | ;;; Copyright © 2016-2023 Ludovic Courtès <ludo@gnu.org> |
| 4 | ;;; Copyright © 2020 Brice Waegeneire <brice@waegenei.re> | 4 | ;;; Copyright © 2020 Brice Waegeneire <brice@waegenei.re> |
| 5 | ;;; Copyright © 2023 Giacomo Leidi <goodoldpaul@autistici.org> | ||
| 5 | ;;; | 6 | ;;; |
| 6 | ;;; This file is part of GNU Guix. | 7 | ;;; This file is part of GNU Guix. |
| 7 | ;;; | 8 | ;;; |
| @@ -58,6 +59,7 @@ | |||
| 58 | unattended-upgrade-configuration | 59 | unattended-upgrade-configuration |
| 59 | unattended-upgrade-configuration? | 60 | unattended-upgrade-configuration? |
| 60 | unattended-upgrade-configuration-operating-system-file | 61 | unattended-upgrade-configuration-operating-system-file |
| 62 | unattended-upgrade-configuration-operating-system-expression | ||
| 61 | unattended-upgrade-configuration-channels | 63 | unattended-upgrade-configuration-channels |
| 62 | unattended-upgrade-configuration-schedule | 64 | unattended-upgrade-configuration-schedule |
| 63 | unattended-upgrade-configuration-services-to-restart | 65 | unattended-upgrade-configuration-services-to-restart |
| @@ -263,6 +265,8 @@ Old log files are removed or compressed according to the configuration.") | |||
| 263 | unattended-upgrade-configuration? | 265 | unattended-upgrade-configuration? |
| 264 | (operating-system-file unattended-upgrade-operating-system-file | 266 | (operating-system-file unattended-upgrade-operating-system-file |
| 265 | (default "/run/current-system/configuration.scm")) | 267 | (default "/run/current-system/configuration.scm")) |
| 268 | (operating-system-expression unattended-upgrade-operating-system-expression | ||
| 269 | (default #f)) | ||
| 266 | (schedule unattended-upgrade-configuration-schedule | 270 | (schedule unattended-upgrade-configuration-schedule |
| 267 | (default "30 01 * * 0")) | 271 | (default "30 01 * * 0")) |
| 268 | (channels unattended-upgrade-configuration-channels | 272 | (channels unattended-upgrade-configuration-channels |
| @@ -296,6 +300,14 @@ Old log files are removed or compressed according to the configuration.") | |||
| 296 | (define config-file | 300 | (define config-file |
| 297 | (unattended-upgrade-operating-system-file config)) | 301 | (unattended-upgrade-operating-system-file config)) |
| 298 | 302 | ||
| 303 | (define expression | ||
| 304 | (unattended-upgrade-operating-system-expression config)) | ||
| 305 | |||
| 306 | (define arguments | ||
| 307 | (if expression | ||
| 308 | #~(list "-e" (object->string '#$expression)) | ||
| 309 | #~(list #$config-file))) | ||
| 310 | |||
| 299 | (define code | 311 | (define code |
| 300 | (with-imported-modules (source-module-closure '((guix build utils) | 312 | (with-imported-modules (source-module-closure '((guix build utils) |
| 301 | (gnu services herd))) | 313 | (gnu services herd))) |
| @@ -333,9 +345,9 @@ Old log files are removed or compressed according to the configuration.") | |||
| 333 | (format #t "~a starting upgrade...~%" (timestamp)) | 345 | (format #t "~a starting upgrade...~%" (timestamp)) |
| 334 | (guard (c ((invoke-error? c) | 346 | (guard (c ((invoke-error? c) |
| 335 | (report-invoke-error c))) | 347 | (report-invoke-error c))) |
| 336 | (invoke #$(file-append guix "/bin/guix") | 348 | (apply invoke #$(file-append guix "/bin/guix") |
| 337 | "time-machine" "-C" #$channels | 349 | "time-machine" "-C" #$channels |
| 338 | "--" "system" "reconfigure" #$config-file) | 350 | "--" "system" "reconfigure" #$arguments) |
| 339 | 351 | ||
| 340 | ;; 'guix system delete-generations' fails when there's no | 352 | ;; 'guix system delete-generations' fails when there's no |
| 341 | ;; matching generation. Thus, catch 'invoke-error?'. | 353 | ;; matching generation. Thus, catch 'invoke-error?'. |
