From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43664) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dRzC5-00016n-PD for guix-patches@gnu.org; Mon, 03 Jul 2017 07:07:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dRzC2-0000Hi-Ab for guix-patches@gnu.org; Mon, 03 Jul 2017 07:07:05 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:46782) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dRzC2-0000GR-5o for guix-patches@gnu.org; Mon, 03 Jul 2017 07:07:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dRzC1-0004Mw-Pt for guix-patches@gnu.org; Mon, 03 Jul 2017 07:07:01 -0400 Subject: [bug#27521] [PATCH] guix system: Add "--file-system-type" option. Resent-Message-ID: From: Danny Milosavljevic Date: Mon, 3 Jul 2017 12:34:07 +0200 Message-Id: <20170703103407.18974-1-dannym@scratchpost.org> In-Reply-To: <878tk6rmvo.fsf@gnu.org> References: <878tk6rmvo.fsf@gnu.org> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: 27521@debbugs.gnu.org * guix/scripts/system.scm (process-action): Pass file-system-type to ... (perform-action): ... here. Add new keyword argument. Pass new value to ... (system-derivation-for-action): ... here. Add new keyword argument. Pass new value to system-disk-image. * doc/guix.texi (disk-image): Document new option. --- doc/guix.texi | 3 +++ guix/scripts/system.scm | 23 +++++++++++++++++++---- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index d61a5b751..25354b8c9 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -16190,6 +16190,9 @@ in @var{file} that stands alone. By default, @command{guix system} estimates the size of the image needed to store the system, but you can use the @option{--image-size} option to specify a value. +You can specify the root file system type by using the +@option{--file-system-type} option. It defaults to "ext4". + When using @code{vm-image}, the returned image is in qcow2 format, which the QEMU emulator can efficiently use. @xref{Running GuixSD in a VM}, for more information on how to run the image in a virtual machine. diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm index 7e20b10da..ff6c53716 100644 --- a/guix/scripts/system.scm +++ b/guix/scripts/system.scm @@ -560,7 +560,8 @@ PATTERN, a string. When PATTERN is #f, display all the system generations." ;;; (define* (system-derivation-for-action os action - #:key image-size full-boot? mappings) + #:key image-size file-system-type + full-boot? mappings) "Return as a monadic value the derivation for OS according to ACTION." (case action ((build init reconfigure) @@ -578,7 +579,8 @@ PATTERN, a string. When PATTERN is #f, display all the system generations." (* 70 (expt 2 20))) #:mappings mappings)) ((disk-image) - (system-disk-image os #:disk-image-size image-size)))) + (system-disk-image os #:disk-image-size image-size + #:file-system-type file-system-type)))) (define (maybe-suggest-running-guix-pull) "Suggest running 'guix pull' if this has never been done before." @@ -610,13 +612,15 @@ and TARGET arguments." #:key install-bootloader? dry-run? derivations-only? use-substitutes? device target - image-size full-boot? + image-size file-system-type full-boot? (mappings '()) (gc-root #f)) "Perform ACTION for OS. INSTALL-BOOTLOADER? specifies whether to install bootloader; DEVICE is the target devices for 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. FULL-BOOT? is used for the 'vm' action; +'vm-image' and 'disk-image' actions. +The root filesystem is created as a FILE-SYSTEM-TYPE filesystem. +FULL-BOOT? is used for the 'vm' action; it determines whether to boot directly to the kernel or to the bootloader. When DERIVATIONS-ONLY? is true, print the derivation file name(s) without @@ -632,6 +636,7 @@ output when building a system derivation, such as a disk image." (mlet* %store-monad ((sys (system-derivation-for-action os action + #:file-system-type file-system-type #:image-size image-size #:full-boot? full-boot? #:mappings mappings)) @@ -775,6 +780,10 @@ Some ACTIONS support additional ARGS.\n")) --on-error=STRATEGY apply STRATEGY when an error occurs while reading FILE")) (display (G_ " + --file-system-type=TYPE + for 'disk-image', produce a root file system of TYPE + (one of 'ext4', 'iso9660')")) + (display (G_ " --image-size=SIZE for 'vm-image', produce an image of SIZE")) (display (G_ " --no-bootloader for 'init', do not install a bootloader")) @@ -812,6 +821,10 @@ Some ACTIONS support additional ARGS.\n")) (lambda (opt name arg result) (alist-cons 'on-error (string->symbol arg) result))) + (option '(#\f "file-system-type") #t #f + (lambda (opt name arg result) + (alist-cons 'file-system-type arg + result))) (option '("image-size") #t #f (lambda (opt name arg result) (alist-cons 'image-size (size->number arg) @@ -854,6 +867,7 @@ Some ACTIONS support additional ARGS.\n")) (build-hook? . #t) (max-silent-time . 3600) (verbosity . 0) + (file-system-type . "ext4") (image-size . guess) (install-bootloader? . #t))) @@ -906,6 +920,7 @@ resulting from command-line parsing." #:derivations-only? (assoc-ref opts 'derivations-only?) #:use-substitutes? (assoc-ref opts 'substitutes?) + #:file-system-type (assoc-ref opts 'file-system-type) #:image-size (assoc-ref opts 'image-size) #:full-boot? (assoc-ref opts 'full-boot?) #:mappings (filter-map (match-lambda