From b6473e506e4161b539fe710fb1b3e69eaeac7069 Mon Sep 17 00:00:00 2001 From: Mathieu Othacehe Date: Sat, 2 Jan 2021 17:56:25 +0100 Subject: system: image: Fix root offset on rockchip platforms. Fixes: . * gnu/system/image.scm (arm32-disk-image, arm64-disk-image): Turn into procedures, taking the root partition offset as argument. * gnu/system/images/novena.scm (novena-image-type): Adapt accordingly. * gnu/system/images/pine64.scm (pine64-image-type): Ditto. * gnu/system/images/pinebook-pro.scm (pinebook-pro-image-type): Use a 9MiB offset for the root partition. --- gnu/system/image.scm | 12 ++++++------ gnu/system/images/novena.scm | 2 +- gnu/system/images/pine64.scm | 2 +- gnu/system/images/pinebook-pro.scm | 4 +++- 4 files changed, 11 insertions(+), 9 deletions(-) (limited to 'gnu/system') diff --git a/gnu/system/image.scm b/gnu/system/image.scm index 67930750d5..90b9209988 100644 --- a/gnu/system/image.scm +++ b/gnu/system/image.scm @@ -128,21 +128,21 @@ (label "GUIX_IMAGE") (flags '(boot))))))) -(define arm32-disk-image +(define* (arm32-disk-image #:optional (offset root-offset)) (image (format 'disk-image) (target "arm-linux-gnueabihf") (partitions (list (partition (inherit root-partition) - (offset root-offset)))) + (offset offset)))) ;; FIXME: Deleting and creating "/var/run" and "/tmp" on the overlayfs ;; fails. (volatile-root? #f))) -(define arm64-disk-image +(define* (arm64-disk-image #:optional (offset root-offset)) (image - (inherit arm32-disk-image) + (inherit (arm32-disk-image offset)) (target "aarch64-linux-gnu"))) @@ -189,12 +189,12 @@ set to the given OS." (define arm32-image-type (image-type (name 'arm32-raw) - (constructor (cut image-with-os arm32-disk-image <>)))) + (constructor (cut image-with-os (arm32-disk-image) <>)))) (define arm64-image-type (image-type (name 'arm64-raw) - (constructor (cut image-with-os arm64-disk-image <>)))) + (constructor (cut image-with-os (arm64-disk-image) <>)))) ;; diff --git a/gnu/system/images/novena.scm b/gnu/system/images/novena.scm index c4d25e850e..dfaf2c60ee 100644 --- a/gnu/system/images/novena.scm +++ b/gnu/system/images/novena.scm @@ -52,7 +52,7 @@ (define novena-image-type (image-type (name 'novena-raw) - (constructor (cut image-with-os arm32-disk-image <>)))) + (constructor (cut image-with-os (arm32-disk-image) <>)))) (define novena-barebones-raw-image (image diff --git a/gnu/system/images/pine64.scm b/gnu/system/images/pine64.scm index f0b0c3f50d..63b31399a5 100644 --- a/gnu/system/images/pine64.scm +++ b/gnu/system/images/pine64.scm @@ -57,7 +57,7 @@ (define pine64-image-type (image-type (name 'pine64-raw) - (constructor (cut image-with-os arm64-disk-image <>)))) + (constructor (cut image-with-os (arm64-disk-image) <>)))) (define pine64-barebones-raw-image (image diff --git a/gnu/system/images/pinebook-pro.scm b/gnu/system/images/pinebook-pro.scm index b038e262cb..02a0b8132d 100644 --- a/gnu/system/images/pinebook-pro.scm +++ b/gnu/system/images/pinebook-pro.scm @@ -57,7 +57,9 @@ (define pinebook-pro-image-type (image-type (name 'pinebook-pro-raw) - (constructor (cut image-with-os arm64-disk-image <>)))) + (constructor (cut image-with-os + (arm64-disk-image (* 9 (expt 2 20))) ;9MiB + <>)))) (define pinebook-pro-barebones-raw-image (image -- cgit v1.2.3 From a3002104a84c60556b6616d100cb98019e48759d Mon Sep 17 00:00:00 2001 From: Leo Prikler Date: Fri, 1 Jan 2021 12:10:01 +0100 Subject: system: Assert, that user and group names are unique. *gnu/system/shadow.scm (find-duplicates): New variable. (assert-unique-account-names, assert-unique-group-names): New variables. (account-activation): Use them here. --- gnu/system/shadow.scm | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) (limited to 'gnu/system') diff --git a/gnu/system/shadow.scm b/gnu/system/shadow.scm index a69339bc07..183b2cd387 100644 --- a/gnu/system/shadow.scm +++ b/gnu/system/shadow.scm @@ -20,6 +20,7 @@ ;;; along with GNU Guix. If not, see . (define-module (gnu system shadow) + #:use-module ((guix diagnostics) #:select (formatted-message)) #:use-module (guix records) #:use-module (guix gexp) #:use-module (guix store) @@ -34,6 +35,7 @@ #:use-module ((gnu packages admin) #:select (shadow)) #:use-module (gnu packages bash) + #:use-module (ice-9 match) #:use-module (srfi srfi-1) #:use-module (srfi srfi-26) #:use-module (srfi srfi-34) @@ -222,6 +224,46 @@ for a colorful Guile experience.\\n\\n\"))))\n")) (rename-file ".nanorc" ".config/nano/nanorc")) #t)))) +(define (find-duplicates list) + "Find duplicate entries in @var{list}. +Two entries are considered duplicates, if they are @code{equal?} to each other. +This implementation is made asymptotically faster than @code{delete-duplicates} +through the internal use of hash tables." + (let loop ((list list) + ;; We actually modify table in-place, but still allocate it here + ;; so that we only need one level of indentation. + (table (make-hash-table))) + (match list + (() + (hash-fold (lambda (key value seed) + (if (> value 1) + (cons key seed) + seed)) + '() + table)) + ((first . rest) + (hash-set! table first + (1+ (hash-ref table first 0))) + (loop rest table))))) + +(define (assert-unique-account-names users) + (match (find-duplicates (map user-account-name users)) + (() *unspecified*) + (duplicates + (raise + (formatted-message + (G_ "the following accounts appear more than once:~{ ~a~}") + duplicates))))) + +(define (assert-unique-group-names groups) + (match (find-duplicates (map user-group-name groups)) + (() *unspecified*) + (duplicates + (raise + (formatted-message + (G_ "the following groups appear more than once:~{ ~a~}") + duplicates))))) + (define (assert-valid-users/groups users groups) "Raise an error if USERS refer to groups not listed in GROUPS." (let ((groups (list->set (map user-group-name groups)))) @@ -292,6 +334,8 @@ group." (define group-specs (map user-group->gexp groups)) + (assert-unique-account-names accounts) + (assert-unique-group-names groups) (assert-valid-users/groups accounts groups) ;; Add users and user groups. -- cgit v1.2.3 From 8488f45b6e05d646224cc2b410497ddf9864c612 Mon Sep 17 00:00:00 2001 From: Jonathan Brielmaier Date: Tue, 12 Jan 2021 22:57:22 +0100 Subject: Revert "system: Assert, that user and group names are unique." This reverts commit a3002104a84c60556b6616d100cb98019e48759d, which breaks certain system configurations like: $ guix system reconfigure config.scm guix system: error: the following groups appear more than once: lp --- gnu/system/shadow.scm | 44 -------------------------------------------- 1 file changed, 44 deletions(-) (limited to 'gnu/system') diff --git a/gnu/system/shadow.scm b/gnu/system/shadow.scm index 183b2cd387..a69339bc07 100644 --- a/gnu/system/shadow.scm +++ b/gnu/system/shadow.scm @@ -20,7 +20,6 @@ ;;; along with GNU Guix. If not, see . (define-module (gnu system shadow) - #:use-module ((guix diagnostics) #:select (formatted-message)) #:use-module (guix records) #:use-module (guix gexp) #:use-module (guix store) @@ -35,7 +34,6 @@ #:use-module ((gnu packages admin) #:select (shadow)) #:use-module (gnu packages bash) - #:use-module (ice-9 match) #:use-module (srfi srfi-1) #:use-module (srfi srfi-26) #:use-module (srfi srfi-34) @@ -224,46 +222,6 @@ for a colorful Guile experience.\\n\\n\"))))\n")) (rename-file ".nanorc" ".config/nano/nanorc")) #t)))) -(define (find-duplicates list) - "Find duplicate entries in @var{list}. -Two entries are considered duplicates, if they are @code{equal?} to each other. -This implementation is made asymptotically faster than @code{delete-duplicates} -through the internal use of hash tables." - (let loop ((list list) - ;; We actually modify table in-place, but still allocate it here - ;; so that we only need one level of indentation. - (table (make-hash-table))) - (match list - (() - (hash-fold (lambda (key value seed) - (if (> value 1) - (cons key seed) - seed)) - '() - table)) - ((first . rest) - (hash-set! table first - (1+ (hash-ref table first 0))) - (loop rest table))))) - -(define (assert-unique-account-names users) - (match (find-duplicates (map user-account-name users)) - (() *unspecified*) - (duplicates - (raise - (formatted-message - (G_ "the following accounts appear more than once:~{ ~a~}") - duplicates))))) - -(define (assert-unique-group-names groups) - (match (find-duplicates (map user-group-name groups)) - (() *unspecified*) - (duplicates - (raise - (formatted-message - (G_ "the following groups appear more than once:~{ ~a~}") - duplicates))))) - (define (assert-valid-users/groups users groups) "Raise an error if USERS refer to groups not listed in GROUPS." (let ((groups (list->set (map user-group-name groups)))) @@ -334,8 +292,6 @@ group." (define group-specs (map user-group->gexp groups)) - (assert-unique-account-names accounts) - (assert-unique-group-names groups) (assert-valid-users/groups accounts groups) ;; Add users and user groups. -- cgit v1.2.3 From 645a28ee97a8708598643941456ba4310fab951b Mon Sep 17 00:00:00 2001 From: Leo Prikler Date: Wed, 13 Jan 2021 00:34:48 +0100 Subject: Reapply "system: Assert, that user and group names are unique." * gnu/system/shadow.scm (assert-unique-account-names) (assert-unique-group-names): Demote formatted-message to warning. --- gnu/system/shadow.scm | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'gnu/system') diff --git a/gnu/system/shadow.scm b/gnu/system/shadow.scm index a69339bc07..47557191f8 100644 --- a/gnu/system/shadow.scm +++ b/gnu/system/shadow.scm @@ -20,6 +20,7 @@ ;;; along with GNU Guix. If not, see . (define-module (gnu system shadow) + #:use-module ((guix diagnostics) #:select (formatted-message)) #:use-module (guix records) #:use-module (guix gexp) #:use-module (guix store) @@ -34,6 +35,7 @@ #:use-module ((gnu packages admin) #:select (shadow)) #:use-module (gnu packages bash) + #:use-module (ice-9 match) #:use-module (srfi srfi-1) #:use-module (srfi srfi-26) #:use-module (srfi srfi-34) @@ -222,6 +224,44 @@ for a colorful Guile experience.\\n\\n\"))))\n")) (rename-file ".nanorc" ".config/nano/nanorc")) #t)))) +(define (find-duplicates list) + "Find duplicate entries in @var{list}. +Two entries are considered duplicates, if they are @code{equal?} to each other. +This implementation is made asymptotically faster than @code{delete-duplicates} +through the internal use of hash tables." + (let loop ((list list) + ;; We actually modify table in-place, but still allocate it here + ;; so that we only need one level of indentation. + (table (make-hash-table))) + (match list + (() + (hash-fold (lambda (key value seed) + (if (> value 1) + (cons key seed) + seed)) + '() + table)) + ((first . rest) + (hash-set! table first + (1+ (hash-ref table first 0))) + (loop rest table))))) + +(define (assert-unique-account-names users) + (match (find-duplicates (map user-account-name users)) + (() *unspecified*) + (duplicates + (warning + (G_ "the following accounts appear more than once:~{ ~a~}") + duplicates)))) + +(define (assert-unique-group-names groups) + (match (find-duplicates (map user-group-name groups)) + (() *unspecified*) + (duplicates + (warning + (G_ "the following groups appear more than once:~{ ~a~}") + duplicates)))) + (define (assert-valid-users/groups users groups) "Raise an error if USERS refer to groups not listed in GROUPS." (let ((groups (list->set (map user-group-name groups)))) @@ -292,6 +332,8 @@ group." (define group-specs (map user-group->gexp groups)) + (assert-unique-account-names accounts) + (assert-unique-group-names groups) (assert-valid-users/groups accounts groups) ;; Add users and user groups. -- cgit v1.2.3 From 0d22fc8d36e4efba9748c94cab7cedbbe2bbb5bf Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Wed, 13 Jan 2021 22:14:00 +0100 Subject: services: shepherd: 'shepherd-service-type' requires documentation. * gnu/services/shepherd.scm (shepherd-service-type): Require a 'description' form. * gnu/services/base.scm (root-file-system-service-type) (rngd-service-type, host-name-service-type): (virtual-terminal-service-type, console-keymap-service-type) (syslog-service-type, swap-service-type) (kmscon-service-type): Add description. * gnu/services/networking.scm (dhcp-client-service-type): Likewise. * gnu/system/install.scm (cow-store-service-type): Likewise. * gnu/system/linux-container.scm (dummy-networking-service-type): Likewise. * gnu/system/mapped-devices.scm (device-mapping-service-type): Likewise. * tests/guix-system.sh: Likewise. --- gnu/services/base.scm | 32 +++++++++++++++++++++++--------- gnu/services/networking.scm | 6 ++++-- gnu/services/shepherd.scm | 14 ++++++++------ gnu/system/install.scm | 6 ++++-- gnu/system/linux-container.scm | 7 +++++-- gnu/system/mapped-devices.scm | 5 +++-- tests/guix-system.sh | 5 +++-- 7 files changed, 50 insertions(+), 25 deletions(-) (limited to 'gnu/system') diff --git a/gnu/services/base.scm b/gnu/services/base.scm index 945b546607..f6a490f712 100644 --- a/gnu/services/base.scm +++ b/gnu/services/base.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Ludovic Courtès +;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021 Ludovic Courtès ;;; Copyright © 2015, 2016 Alex Kost ;;; Copyright © 2015, 2016, 2020 Mark H Weaver ;;; Copyright © 2015 Sou Bunnbu @@ -279,7 +279,9 @@ system objects."))) (define root-file-system-service-type (shepherd-service-type 'root-file-system - (const %root-file-system-shepherd-service))) + (const %root-file-system-shepherd-service) + (description "Take care of syncing the root file +system and of remounting it read-only when the system shuts down."))) (define (root-file-system-service) "Return a service whose sole purpose is to re-mount read-only the root file @@ -570,7 +572,9 @@ down."))) (requirement '(udev)) (provision '(trng)) (start #~(make-forkexec-constructor '#$rngd-command)) - (stop #~(make-kill-destructor)))))) + (stop #~(make-kill-destructor)))) + (description "Run the @command{rngd} random number generation daemon to +supply entropy to the kernel's pool."))) (define* (rngd-service #:key (rng-tools rng-tools) @@ -597,7 +601,8 @@ to add @var{device} to the kernel's entropy pool. The service will fail if (provision '(host-name)) (start #~(lambda _ (sethostname #$name))) - (one-shot? #t))))) + (one-shot? #t))) + (description "Initialize the machine's host name."))) (define (host-name-service name) "Return a service that sets the host name to @var{name}." @@ -626,7 +631,8 @@ to add @var{device} to the kernel's entropy pool. The service will fail if (display 1 port)))) #t)) (stop #~(const #f))))) - #t)) ;default to UTF-8 + #t ;default to UTF-8 + (description "Ensure the Linux virtual terminals run in UTF-8 mode."))) (define console-keymap-service-type (shepherd-service-type @@ -638,7 +644,10 @@ to add @var{device} to the kernel's entropy pool. The service will fail if (start #~(lambda _ (zero? (system* #$(file-append kbd "/bin/loadkeys") #$@files)))) - (respawn? #f))))) + (respawn? #f))) + (description "@emph{This service is deprecated in favor of the +@code{keyboard-layout} field of @code{operating-system}.} Load the given list +of console keymaps with @command{loadkeys}."))) (define-deprecated (console-keymap-service #:rest files) #f @@ -1341,7 +1350,9 @@ Service Switch}, for an example." (pid (spawn))) (umask mask) pid)))) - (stop #~(make-kill-destructor)))))) + (stop #~(make-kill-destructor)))) + (description "Run the syslog daemon, @command{syslogd}, which is +responsible for logging system messages."))) ;; Snippet adapted from the GNU inetutils manual. (define %default-syslog.conf @@ -2207,7 +2218,8 @@ instance." (when device (restart-on-EINTR (swapoff device))) #f))) - (respawn? #f)))))) + (respawn? #f)))) + (description "Turn on the virtual memory swap area."))) (define (swap-service device) "Return a service that uses @var{device} as a swap device." @@ -2321,7 +2333,9 @@ This service is not part of @var{%base-services}." (requirement '(user-processes udev dbus-system)) (provision (list (symbol-append 'term- (string->symbol virtual-terminal)))) (start #~(make-forkexec-constructor #$kmscon-command)) - (stop #~(make-kill-destructor))))))) + (stop #~(make-kill-destructor))))) + (description "Start the @command{kmscon} virtual terminal emulator for the +Linux @dfn{kernel mode setting} (KMS)."))) (define-record-type* static-networking make-static-networking diff --git a/gnu/services/networking.scm b/gnu/services/networking.scm index 44754781c1..dd4061341e 100644 --- a/gnu/services/networking.scm +++ b/gnu/services/networking.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Ludovic Courtès +;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021 Ludovic Courtès ;;; Copyright © 2015 Mark H Weaver ;;; Copyright © 2016, 2018, 2020 Efraim Flashner ;;; Copyright © 2016 John Darrington @@ -283,7 +283,9 @@ fe80::1%lo0 apps.facebook.com\n") (and (zero? (cdr (waitpid pid))) (read-pid-file #$pid-file))))) (stop #~(make-kill-destructor)))) - isc-dhcp)) + isc-dhcp + (description "Run @command{dhcp}, a Dynamic Host Configuration +Protocol (DHCP) client, on all the non-loopback network interfaces."))) (define-deprecated (dhcp-client-service #:key (dhcp isc-dhcp)) dhcp-client-service-type diff --git a/gnu/services/shepherd.scm b/gnu/services/shepherd.scm index 1faeb350df..d2f9776288 100644 --- a/gnu/services/shepherd.scm +++ b/gnu/services/shepherd.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2013, 2014, 2015, 2016, 2018, 2019, 2020 Ludovic Courtès +;;; Copyright © 2013, 2014, 2015, 2016, 2018, 2019, 2020, 2021 Ludovic Courtès ;;; Copyright © 2017 Clément Lassieur ;;; Copyright © 2018 Carlo Zancanaro ;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen @@ -119,23 +119,25 @@ ensuring they are started and stopped in the right order."))) (service shepherd-root-service-type '())) (define-syntax shepherd-service-type - (syntax-rules () + (syntax-rules (description) "Return a denoting a simple shepherd service--i.e., the type for a service that extends SHEPHERD-ROOT-SERVICE-TYPE and nothing else. When DEFAULT is given, use it as the service's default value." - ((_ service-name proc default) + ((_ service-name proc default (description text)) (service-type (name service-name) (extensions (list (service-extension shepherd-root-service-type (compose list proc)))) - (default-value default))) - ((_ service-name proc) + (default-value default) + (description text))) + ((_ service-name proc (description text)) (service-type (name service-name) (extensions (list (service-extension shepherd-root-service-type - (compose list proc)))))))) + (compose list proc)))) + (description text))))) (define %default-imported-modules ;; Default set of modules imported for a service's consumption. diff --git a/gnu/system/install.scm b/gnu/system/install.scm index e753463473..7fa5c15324 100644 --- a/gnu/system/install.scm +++ b/gnu/system/install.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2014, 2015, 2016, 2017, 2018, 2019, 2020 Ludovic Courtès +;;; Copyright © 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021 Ludovic Courtès ;;; Copyright © 2015 Mark H Weaver ;;; Copyright © 2016 Andreas Enge ;;; Copyright © 2017 Marius Bakke @@ -212,7 +212,9 @@ the given target.") ;; 'user-processes' doesn't depend on us. The 'user-file-systems' ;; service will unmount TARGET eventually. (delete-file-recursively - (string-append target #$%backing-directory)))))))) + (string-append target #$%backing-directory)))))) + (description "Make the store copy-on-write, with writes going to \ +the given target."))) (define (cow-store-service) "Return a service that makes the store copy-on-write, such that writes go to diff --git a/gnu/system/linux-container.scm b/gnu/system/linux-container.scm index 4a9cd0efe2..e6fd0f1315 100644 --- a/gnu/system/linux-container.scm +++ b/gnu/system/linux-container.scm @@ -1,6 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2015 David Thompson -;;; Copyright © 2016, 2017, 2019, 2020 Ludovic Courtès +;;; Copyright © 2016, 2017, 2019, 2020, 2021 Ludovic Courtès ;;; Copyright © 2019 Arun Isaac ;;; Copyright © 2020 Efraim Flashner ;;; Copyright © 2020 Google LLC @@ -76,7 +76,10 @@ from OS that are needed on the bare metal and not in a container." doing anything.") (provision '(loopback networking)) (start #~(const #t)))) - #f)) + #f + (description "Provide loopback and networking without actually doing +anything. This service is used by guest systems running in containers, where +networking support is provided by the host."))) (define %nscd-container-caches ;; Similar to %nscd-default-caches but with smaller cache sizes. This allows diff --git a/gnu/system/mapped-devices.scm b/gnu/system/mapped-devices.scm index 559c27bb28..518dbc4fe8 100644 --- a/gnu/system/mapped-devices.scm +++ b/gnu/system/mapped-devices.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2014, 2015, 2016, 2017, 2018, 2019, 2020 Ludovic Courtès +;;; Copyright © 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021 Ludovic Courtès ;;; Copyright © 2016 Andreas Enge ;;; Copyright © 2017, 2018 Mark H Weaver ;;; @@ -130,7 +130,8 @@ specifications to 'targets'." (documentation "Map a device node using Linux's device mapper.") (start #~(lambda () #$(open source targets))) (stop #~(lambda _ (not #$(close source targets)))) - (respawn? #f)))))) + (respawn? #f)))) + (description "Map a device node using Linux's device mapper."))) (define (device-mapping-service mapped-device) "Return a service that sets up @var{mapped-device}." diff --git a/tests/guix-system.sh b/tests/guix-system.sh index f14c92ca75..e7e4c17e39 100644 --- a/tests/guix-system.sh +++ b/tests/guix-system.sh @@ -1,5 +1,5 @@ # GNU Guix --- Functional package management for GNU -# Copyright © 2014, 2015, 2016, 2017, 2018, 2019, 2020 Ludovic Courtès +# Copyright © 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021 Ludovic Courtès # Copyright © 2017 Tobias Geerinckx-Rice # Copyright © 2018 Chris Marusich # @@ -204,7 +204,8 @@ cat > "$tmpfile" < Date: Thu, 3 Dec 2020 11:53:53 +0100 Subject: image: Rename "raw" image-type to "efi-raw". * gnu/system/image.scm (raw-image-type): Rename to "efi-raw-image-type". * guix/scripts/system.scm (%default-options): Adapt accordingly. * doc/guix.texi: Ditto. Signed-off-by: Mathieu Othacehe --- doc/guix.texi | 10 +++++----- gnu/system/image.scm | 6 +++--- guix/scripts/system.scm | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) (limited to 'gnu/system') diff --git a/doc/guix.texi b/doc/guix.texi index c92f3a5e79..dc41fe9aea 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -31406,7 +31406,7 @@ the @option{--image-size} option is ignored in the case of @cindex disk-image, creating disk images The @code{disk-image} command can produce various image types. The image type can be selected using the @option{--image-type} option. It -defaults to @code{raw}. When its value is @code{iso9660}, the +defaults to @code{efi-raw}. When its value is @code{iso9660}, the @option{--label} option can be used to specify a volume ID with @code{disk-image}. By default, the root file system of a disk image is mounted non-volatile; the @option{--volatile} option can be provided to @@ -31425,8 +31425,8 @@ qemu-system-x86_64 -enable-kvm -hda /tmp/my-image.qcow2 -m 1000 \ -bios $(guix build ovmf)/share/firmware/ovmf_x64.bin @end example -When using the @code{raw} image type, a raw disk image is produced; it -can be copied as is to a USB stick, for instance. Assuming +When using the @code{efi-raw} image type, a raw disk image is produced; +it can be copied as is to a USB stick, for instance. Assuming @code{/dev/sdc} is the device corresponding to a USB stick, one can copy the image to it using the following command: @@ -31553,8 +31553,8 @@ of the image. @itemx -t @var{type} For the @code{disk-image} action, create an image with given @var{type}. -When this option is omitted, @command{guix system} uses the @code{raw} -image type. +When this option is omitted, @command{guix system} uses the +@code{efi-raw} image type. @cindex ISO-9660 format @cindex CD image format diff --git a/gnu/system/image.scm b/gnu/system/image.scm index 90b9209988..1012fa6158 100644 --- a/gnu/system/image.scm +++ b/gnu/system/image.scm @@ -70,7 +70,7 @@ arm64-disk-image image-with-os - raw-image-type + efi-raw-image-type qcow2-image-type iso-image-type uncompressed-iso-image-type @@ -157,9 +157,9 @@ set to the given OS." (inherit base-image) (operating-system os))) -(define raw-image-type +(define efi-raw-image-type (image-type - (name 'raw) + (name 'efi-raw) (constructor (cut image-with-os efi-disk-image <>)))) (define qcow2-image-type diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm index 51c8cf2f76..eb7137b7a9 100644 --- a/guix/scripts/system.scm +++ b/guix/scripts/system.scm @@ -1143,7 +1143,7 @@ Some ACTIONS support additional ARGS.\n")) (debug . 0) (verbosity . #f) ;default (validate-reconfigure . ,ensure-forward-reconfigure) - (image-type . raw) + (image-type . efi-raw) (image-size . guess) (install-bootloader? . #t) (label . #f) -- cgit v1.2.3 From e74baa124592428f05b17562f180469e405037f3 Mon Sep 17 00:00:00 2001 From: Mathieu Othacehe Date: Sun, 17 Jan 2021 11:32:51 +0100 Subject: system: Rename 'disk-image' command 'image'. * guix/scripts/system.scm (system-derivation-for-action): Rename 'disk-image' command 'image'. Warn when using the now deprecated 'disk-image' command. (show-help): Adapt accordingly. (guix-system): Ditto. * tests/guix-system.sh: Ditto. * gnu/system/examples/bare-hurd.tmpl: Ditto. * doc/guix.texi (Building the Installation Image, Building the Installation Image for ARM Boards, Invoking guix pack, Invoking guix system): Adapt documentation. --- doc/guix.texi | 24 ++++++++++++------------ gnu/system/examples/bare-hurd.tmpl | 2 +- guix/scripts/system.scm | 21 ++++++++++++--------- tests/guix-system.sh | 4 ++-- 4 files changed, 27 insertions(+), 24 deletions(-) (limited to 'gnu/system') diff --git a/doc/guix.texi b/doc/guix.texi index 0a82219e7a..f02353d9fa 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -2661,7 +2661,7 @@ The installation image described above was built using the @command{guix system} command, specifically: @example -guix system disk-image -t iso9660 gnu/system/install.scm +guix system image -t iso9660 gnu/system/install.scm @end example Have a look at @file{gnu/system/install.scm} in the source tree, @@ -2678,7 +2678,7 @@ If you build a disk image and the bootloader is not available otherwise includes the bootloader, specifically: @example -guix system disk-image --system=armhf-linux -e '((@@ (gnu system install) os-with-u-boot) (@@ (gnu system install) installation-os) "A20-OLinuXino-Lime2")' +guix system image --system=armhf-linux -e '((@@ (gnu system install) os-with-u-boot) (@@ (gnu system install) installation-os) "A20-OLinuXino-Lime2")' @end example @code{A20-OLinuXino-Lime2} is the name of the board. If you specify an invalid @@ -31393,7 +31393,7 @@ size of the image. @cindex System images, creation in various formats @cindex Creating system images in various formats @item vm-image -@itemx disk-image +@itemx image @itemx docker-image Return a virtual machine, disk image, or Docker image of the operating system declared in @var{file} that stands alone. By default, @@ -31403,22 +31403,22 @@ a value. Docker images are built to contain exactly what they need, so the @option{--image-size} option is ignored in the case of @code{docker-image}. -@cindex disk-image, creating disk images -The @code{disk-image} command can produce various image types. The +@cindex image, creating disk images +The @code{image} command can produce various image types. The image type can be selected using the @option{--image-type} option. It defaults to @code{efi-raw}. When its value is @code{iso9660}, the @option{--label} option can be used to specify a volume ID with -@code{disk-image}. By default, the root file system of a disk image is +@code{image}. By default, the root file system of a disk image is mounted non-volatile; the @option{--volatile} option can be provided to -make it volatile instead. When using @code{disk-image}, the bootloader +make it volatile instead. When using @code{image}, the bootloader installed on the generated image is taken from the provided @code{operating-system} definition. The following example demonstrates how to generate an image that uses the @code{grub-efi-bootloader} bootloader and boot it with QEMU: @example -image=$(guix system disk-image --image-type=qcow2 \ - gnu/system/examples/lightweight-desktop.tmpl) +image=$(guix system image --image-type=qcow2 \ + gnu/system/examples/lightweight-desktop.tmpl) cp $image /tmp/my-image.qcow2 chmod +w /tmp/my-image.qcow2 qemu-system-x86_64 -enable-kvm -hda /tmp/my-image.qcow2 -m 1000 \ @@ -31431,7 +31431,7 @@ it can be copied as is to a USB stick, for instance. Assuming the image to it using the following command: @example -# dd if=$(guix system disk-image my-os.scm) of=/dev/sdc status=progress +# dd if=$(guix system image my-os.scm) of=/dev/sdc status=progress @end example The @code{--list-image-types} command lists all the available image @@ -31551,7 +31551,7 @@ of the image. @item --image-type=@var{type} @itemx -t @var{type} -For the @code{disk-image} action, create an image with given @var{type}. +For the @code{image} action, create an image with given @var{type}. When this option is omitted, @command{guix system} uses the @code{efi-raw} image type. @@ -31563,7 +31563,7 @@ When this option is omitted, @command{guix system} uses the for burning on CDs and DVDs. @item --image-size=@var{size} -For the @code{vm-image} and @code{disk-image} actions, create an image +For the @code{vm-image} and @code{image} actions, create an image of the given @var{size}. @var{size} may be a number of bytes, or it may include a unit as a suffix (@pxref{Block size, size specifications,, coreutils, GNU Coreutils}). diff --git a/gnu/system/examples/bare-hurd.tmpl b/gnu/system/examples/bare-hurd.tmpl index e4b795ff27..135ed23cb6 100644 --- a/gnu/system/examples/bare-hurd.tmpl +++ b/gnu/system/examples/bare-hurd.tmpl @@ -5,7 +5,7 @@ ;; To build a disk image for a virtual machine, do ;; -;; ./pre-inst-env guix system disk-image --target=i586-pc-gnu \ +;; ./pre-inst-env guix system image --target=i586-pc-gnu \ ;; gnu/system/examples/bare-hurd.tmpl ;; ;; You may run it like so diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm index eb7137b7a9..66225bff35 100644 --- a/guix/scripts/system.scm +++ b/guix/scripts/system.scm @@ -705,9 +705,11 @@ checking this by themselves in their 'check' procedure." image-size (* 70 (expt 2 20))) #:mappings mappings)) - ((disk-image) + ((image disk-image) (let* ((base-image (os->image os #:type image-type)) (base-target (image-target base-image))) + (when (eq? action 'disk-image) + (warning (G_ "'disk-image' is deprecated: use 'image' instead~%"))) (lower-object (system-image (image @@ -779,7 +781,7 @@ and TARGET arguments." "Perform ACTION for OS. INSTALL-BOOTLOADER? specifies whether to install bootloader; BOOTLOADER-TAGET is the target for the bootloader; TARGET is the target root directory; IMAGE-SIZE is the size of the image to be built, for -the 'vm-image' and 'disk-image' actions. IMAGE-TYPE is the type of image to +the 'vm-image' and 'image' actions. IMAGE-TYPE is the type of image to be built. When VOLATILE-ROOT? is #t, the root file system is mounted volatile. @@ -968,7 +970,7 @@ Some ACTIONS support additional ARGS.\n")) (display (G_ "\ vm-image build a freestanding virtual machine image\n")) (display (G_ "\ - disk-image build a disk image, suitable for a USB stick\n")) + image build a Guix System image\n")) (display (G_ "\ docker-image build a Docker image\n")) (display (G_ "\ @@ -994,15 +996,15 @@ Some ACTIONS support additional ARGS.\n")) (display (G_ " --list-image-types list available image types")) (display (G_ " - -t, --image-type=TYPE for 'disk-image', produce an image of TYPE")) + -t, --image-type=TYPE for 'image', produce an image of TYPE")) (display (G_ " --image-size=SIZE for 'vm-image', produce an image of SIZE")) (display (G_ " --no-bootloader for 'init', do not install a bootloader")) (display (G_ " - --volatile for 'disk-image', make the root file system volatile")) + --volatile for 'image', make the root file system volatile")) (display (G_ " - --label=LABEL for 'disk-image', label disk image with LABEL")) + --label=LABEL for 'image', label disk image with LABEL")) (display (G_ " --save-provenance save provenance information")) (display (G_ " @@ -1014,7 +1016,7 @@ Some ACTIONS support additional ARGS.\n")) (display (G_ " -N, --network for 'container', allow containers to access the network")) (display (G_ " - -r, --root=FILE for 'vm', 'vm-image', 'disk-image', 'container', + -r, --root=FILE for 'vm', 'vm-image', 'image', 'container', and 'build', make FILE a symlink to the result, and register it as a garbage collector root")) (display (G_ " @@ -1335,7 +1337,7 @@ argument list and OPTS is the option alist." (alist-cons 'argument arg result) (let ((action (string->symbol arg))) (case action - ((build container vm vm-image disk-image reconfigure init + ((build container vm vm-image image disk-image reconfigure init extension-graph shepherd-graph list-generations describe delete-generations roll-back @@ -1368,7 +1370,8 @@ argument list and OPTS is the option alist." (exit 1)) (case action - ((build container vm vm-image disk-image docker-image reconfigure) + ((build container vm vm-image image disk-image docker-image + reconfigure) (unless (or (= count 1) (and expr (= count 0))) (fail))) diff --git a/tests/guix-system.sh b/tests/guix-system.sh index e7e4c17e39..f5ddd1dda3 100644 --- a/tests/guix-system.sh +++ b/tests/guix-system.sh @@ -262,8 +262,8 @@ guix system vm "$tmpfile" -d | grep '\.drv$' drv1="`guix system vm "$tmpfile" -d`" drv2="`guix system vm "$tmpfile" -d`" test "$drv1" = "$drv2" -drv1="`guix system disk-image -t iso9660 "$tmpfile" -d`" -drv2="`guix system disk-image -t iso9660 "$tmpfile" -d`" +drv1="`guix system image -t iso9660 "$tmpfile" -d`" +drv2="`guix system image -t iso9660 "$tmpfile" -d`" test "$drv1" = "$drv2" make_user_config "group-that-does-not-exist" "users" -- cgit v1.2.3 From 239af11a69a588f109d1dcd195f9abe9940cce8c Mon Sep 17 00:00:00 2001 From: Leo Prikler Date: Thu, 14 Jan 2021 13:53:35 +0100 Subject: shadow: End duplicate warnings with new lines. The change from formatted message causes the line to no longer automatically be ended. This will need to be reverted once again, when duplicate names become hard errors. * gnu/system/shadow.scm (assert-unique-account-names) (assert-unique-group-names): End format strings in ~%. --- gnu/system/shadow.scm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gnu/system') diff --git a/gnu/system/shadow.scm b/gnu/system/shadow.scm index 47557191f8..0538fb1a24 100644 --- a/gnu/system/shadow.scm +++ b/gnu/system/shadow.scm @@ -251,7 +251,7 @@ through the internal use of hash tables." (() *unspecified*) (duplicates (warning - (G_ "the following accounts appear more than once:~{ ~a~}") + (G_ "the following accounts appear more than once:~{ ~a~}~%") duplicates)))) (define (assert-unique-group-names groups) @@ -259,7 +259,7 @@ through the internal use of hash tables." (() *unspecified*) (duplicates (warning - (G_ "the following groups appear more than once:~{ ~a~}") + (G_ "the following groups appear more than once:~{ ~a~}~%") duplicates)))) (define (assert-valid-users/groups users groups) -- cgit v1.2.3 From 6c5112dbb32c217abf09ff8ff9bf8c47d0aea651 Mon Sep 17 00:00:00 2001 From: Leo Prikler Date: Thu, 14 Jan 2021 13:58:00 +0100 Subject: services: Do not warn, when duplicate users are eq?. * gnu/system/shadow.scm (account-activation): Delete duplicate (eq?) users and groups before transforming them to specs and asserting, that names are unique. --- gnu/system/shadow.scm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gnu/system') diff --git a/gnu/system/shadow.scm b/gnu/system/shadow.scm index 0538fb1a24..7c57222716 100644 --- a/gnu/system/shadow.scm +++ b/gnu/system/shadow.scm @@ -321,13 +321,13 @@ of user '~a' is undeclared") objects. Raise an error if a user account refers to a undefined group." (define accounts - (filter user-account? accounts+groups)) + (delete-duplicates (filter user-account? accounts+groups) eq?)) (define user-specs (map user-account->gexp accounts)) (define groups - (filter user-group? accounts+groups)) + (delete-duplicates (filter user-group? accounts+groups) eq?)) (define group-specs (map user-group->gexp groups)) -- cgit v1.2.3 From 423653b4ad1b205541d0dbe02973717fd40be549 Mon Sep 17 00:00:00 2001 From: Caliph Nomble Date: Tue, 19 Jan 2021 22:34:23 +0000 Subject: images: pinebook-pro: Fix default serial port. * gnu/system/images/pinebook-pro.scm (pinebook-pro-barebones-os)[services]: Start agetty on ttyS2 instead of ttyS0. --- gnu/system/images/pinebook-pro.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gnu/system') diff --git a/gnu/system/images/pinebook-pro.scm b/gnu/system/images/pinebook-pro.scm index 02a0b8132d..22997fd742 100644 --- a/gnu/system/images/pinebook-pro.scm +++ b/gnu/system/images/pinebook-pro.scm @@ -51,7 +51,7 @@ (extra-options '("-L")) ; no carrier detect (baud-rate "115200") (term "vt100") - (tty "ttyS0"))) + (tty "ttyS2"))) %base-services)))) (define pinebook-pro-image-type -- cgit v1.2.3