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.
This commit is contained in:
Mathieu Othacehe 2021-01-17 11:32:51 +01:00
parent 868c4dec0f
commit e74baa1245
No known key found for this signature in database
GPG key ID: 8354763531769CA6
4 changed files with 27 additions and 24 deletions

View file

@ -2661,7 +2661,7 @@ The installation image described above was built using the @command{guix
system} command, specifically: system} command, specifically:
@example @example
guix system disk-image -t iso9660 gnu/system/install.scm guix system image -t iso9660 gnu/system/install.scm
@end example @end example
Have a look at @file{gnu/system/install.scm} in the source tree, 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: includes the bootloader, specifically:
@example @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 @end example
@code{A20-OLinuXino-Lime2} is the name of the board. If you specify an invalid @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 System images, creation in various formats
@cindex Creating system images in various formats @cindex Creating system images in various formats
@item vm-image @item vm-image
@itemx disk-image @itemx image
@itemx docker-image @itemx docker-image
Return a virtual machine, disk image, or Docker image of the operating Return a virtual machine, disk image, or Docker image of the operating
system declared in @var{file} that stands alone. By default, 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 the @option{--image-size} option is ignored in the case of
@code{docker-image}. @code{docker-image}.
@cindex disk-image, creating disk images @cindex image, creating disk images
The @code{disk-image} command can produce various image types. The The @code{image} command can produce various image types. The
image type can be selected using the @option{--image-type} option. It image type can be selected using the @option{--image-type} option. It
defaults to @code{efi-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 @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 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 installed on the generated image is taken from the provided
@code{operating-system} definition. The following example demonstrates @code{operating-system} definition. The following example demonstrates
how to generate an image that uses the @code{grub-efi-bootloader} how to generate an image that uses the @code{grub-efi-bootloader}
bootloader and boot it with QEMU: bootloader and boot it with QEMU:
@example @example
image=$(guix system disk-image --image-type=qcow2 \ image=$(guix system image --image-type=qcow2 \
gnu/system/examples/lightweight-desktop.tmpl) gnu/system/examples/lightweight-desktop.tmpl)
cp $image /tmp/my-image.qcow2 cp $image /tmp/my-image.qcow2
chmod +w /tmp/my-image.qcow2 chmod +w /tmp/my-image.qcow2
qemu-system-x86_64 -enable-kvm -hda /tmp/my-image.qcow2 -m 1000 \ 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: the image to it using the following command:
@example @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 @end example
The @code{--list-image-types} command lists all the available image The @code{--list-image-types} command lists all the available image
@ -31551,7 +31551,7 @@ of the image.
@item --image-type=@var{type} @item --image-type=@var{type}
@itemx -t @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 When this option is omitted, @command{guix system} uses the
@code{efi-raw} image type. @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. for burning on CDs and DVDs.
@item --image-size=@var{size} @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 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,, include a unit as a suffix (@pxref{Block size, size specifications,,
coreutils, GNU Coreutils}). coreutils, GNU Coreutils}).

View file

@ -5,7 +5,7 @@
;; To build a disk image for a virtual machine, do ;; 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 ;; gnu/system/examples/bare-hurd.tmpl
;; ;;
;; You may run it like so ;; You may run it like so

View file

@ -705,9 +705,11 @@ (define* (system-derivation-for-action os action
image-size image-size
(* 70 (expt 2 20))) (* 70 (expt 2 20)))
#:mappings mappings)) #:mappings mappings))
((disk-image) ((image disk-image)
(let* ((base-image (os->image os #:type image-type)) (let* ((base-image (os->image os #:type image-type))
(base-target (image-target base-image))) (base-target (image-target base-image)))
(when (eq? action 'disk-image)
(warning (G_ "'disk-image' is deprecated: use 'image' instead~%")))
(lower-object (lower-object
(system-image (system-image
(image (image
@ -779,7 +781,7 @@ (define* (perform-action action os
"Perform ACTION for OS. INSTALL-BOOTLOADER? specifies whether to install "Perform ACTION for OS. INSTALL-BOOTLOADER? specifies whether to install
bootloader; BOOTLOADER-TAGET is the target for the bootloader; TARGET is the 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 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 be built. When VOLATILE-ROOT? is #t, the root file system is mounted
volatile. volatile.
@ -968,7 +970,7 @@ (define (show-help)
(display (G_ "\ (display (G_ "\
vm-image build a freestanding virtual machine image\n")) vm-image build a freestanding virtual machine image\n"))
(display (G_ "\ (display (G_ "\
disk-image build a disk image, suitable for a USB stick\n")) image build a Guix System image\n"))
(display (G_ "\ (display (G_ "\
docker-image build a Docker image\n")) docker-image build a Docker image\n"))
(display (G_ "\ (display (G_ "\
@ -994,15 +996,15 @@ (define (show-help)
(display (G_ " (display (G_ "
--list-image-types list available image types")) --list-image-types list available image types"))
(display (G_ " (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_ " (display (G_ "
--image-size=SIZE for 'vm-image', produce an image of SIZE")) --image-size=SIZE for 'vm-image', produce an image of SIZE"))
(display (G_ " (display (G_ "
--no-bootloader for 'init', do not install a bootloader")) --no-bootloader for 'init', do not install a bootloader"))
(display (G_ " (display (G_ "
--volatile for 'disk-image', make the root file system volatile")) --volatile for 'image', make the root file system volatile"))
(display (G_ " (display (G_ "
--label=LABEL for 'disk-image', label disk image with LABEL")) --label=LABEL for 'image', label disk image with LABEL"))
(display (G_ " (display (G_ "
--save-provenance save provenance information")) --save-provenance save provenance information"))
(display (G_ " (display (G_ "
@ -1014,7 +1016,7 @@ (define (show-help)
(display (G_ " (display (G_ "
-N, --network for 'container', allow containers to access the network")) -N, --network for 'container', allow containers to access the network"))
(display (G_ " (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 and 'build', make FILE a symlink to the result, and
register it as a garbage collector root")) register it as a garbage collector root"))
(display (G_ " (display (G_ "
@ -1335,7 +1337,7 @@ (define (parse-sub-command arg result)
(alist-cons 'argument arg result) (alist-cons 'argument arg result)
(let ((action (string->symbol arg))) (let ((action (string->symbol arg)))
(case action (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 extension-graph shepherd-graph
list-generations describe list-generations describe
delete-generations roll-back delete-generations roll-back
@ -1368,7 +1370,8 @@ (define (fail)
(exit 1)) (exit 1))
(case action (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) (unless (or (= count 1)
(and expr (= count 0))) (and expr (= count 0)))
(fail))) (fail)))

View file

@ -262,8 +262,8 @@ guix system vm "$tmpfile" -d | grep '\.drv$'
drv1="`guix system vm "$tmpfile" -d`" drv1="`guix system vm "$tmpfile" -d`"
drv2="`guix system vm "$tmpfile" -d`" drv2="`guix system vm "$tmpfile" -d`"
test "$drv1" = "$drv2" test "$drv1" = "$drv2"
drv1="`guix system disk-image -t iso9660 "$tmpfile" -d`" drv1="`guix system image -t iso9660 "$tmpfile" -d`"
drv2="`guix system disk-image -t iso9660 "$tmpfile" -d`" drv2="`guix system image -t iso9660 "$tmpfile" -d`"
test "$drv1" = "$drv2" test "$drv1" = "$drv2"
make_user_config "group-that-does-not-exist" "users" make_user_config "group-that-does-not-exist" "users"