Patchwork [1/6] gnu: Add fatfsck-static.

login
register
mail settings
Submitter Marius Bakke
Date Nov. 5, 2016, 12:55 p.m.
Message ID <20161105125511.29383-2-mbakke@fastmail.com>
Download mbox | patch
Permalink /patch/17221/
State New
Headers show

Comments

Marius Bakke - Nov. 5, 2016, 12:55 p.m.
* gnu/packages/disk.scm (dosfstools/static): New private variable.
(fatfsck/static): New variable.
---
 gnu/packages/disk.scm | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)
Hartmut Goebel - Nov. 5, 2016, 4:01 p.m.
Am 05.11.2016 um 13:55 schrieb Marius Bakke:
> +(define-public fatfsck/static
> +  (package
> +    (name "fatfsck-static")

What is the reason for using a different name in "define"?
Marius Bakke - Nov. 5, 2016, 4:11 p.m.
Hartmut Goebel <h.goebel@crazy-compilers.com> writes:

> Am 05.11.2016 um 13:55 schrieb Marius Bakke:
>> +(define-public fatfsck/static
>> +  (package
>> +    (name "fatfsck-static")
>
> What is the reason for using a different name in "define"?

I mostly followed the convention of the e2fsck package. I've seen this
convention elsewhere as well, but don't know the reasoning behind it :)

However fatfsck could perhaps be renamed to dosfsck to better match
the e2fsprogs->e2fsck transformation.
Ludovic Courtès - Nov. 6, 2016, 9:42 p.m.
Marius Bakke <mbakke@fastmail.com> skribis:

> * gnu/packages/disk.scm (dosfstools/static): New private variable.
> (fatfsck/static): New variable.

You could add “#:allowed-references ()” in ‘fatfsck/static’ to make sure
it doesn’t retain references to anything else.

> +    (description "This package provides a statically-linked fsck.fat
> +and a fsck.vfat compatibility symlink for use in an initrd.")

@command{fsck.fat} etc.

Otherwise LGTM, thanks!

Ludo’.

Patch

diff --git a/gnu/packages/disk.scm b/gnu/packages/disk.scm
index db050d6..477c25a 100644
--- a/gnu/packages/disk.scm
+++ b/gnu/packages/disk.scm
@@ -6,6 +6,7 @@ 
 ;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2016 Jan Nieuwenhuizen <janneke@gnu.org>
 ;;; Copyright © 2016 Roel Janssen <roel@gnu.org>
+;;; Copyright © 2016 Marius Bakke <mbakke@fastmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -27,6 +28,7 @@ 
   #:use-module (guix packages)
   #:use-module (guix download)
   #:use-module (guix build-system gnu)
+  #:use-module (guix build-system trivial)
   #:use-module (gnu packages)
   #:use-module (gnu packages base)
   #:use-module (gnu packages docbook)
@@ -197,6 +199,40 @@  to recover data more efficiently by only reading the necessary blocks.")
 which respectively make and check MS-DOS FAT file systems.")
     (license license:gpl3+)))
 
+(define dosfstools/static
+  (static-package
+   (package (inherit dosfstools))))
+
+(define-public fatfsck/static
+  (package
+    (name "fatfsck-static")
+    (version (package-version dosfstools))
+    (build-system trivial-build-system)
+    (source #f)
+    (arguments
+     `(#:modules ((guix build utils))
+       #:builder
+       (begin
+         (use-modules (guix build utils))
+         (let ((source (string-append (assoc-ref %build-inputs "dosfstools")
+                                      "/sbin/"))
+               (exe "fsck.fat")
+               (bin (string-append (assoc-ref %outputs "out") "/sbin")))
+           (mkdir-p bin)
+           (with-directory-excursion bin
+             (copy-file (string-append source exe) exe)
+             (remove-store-references exe)
+             (chmod exe #o555)
+             ;; Add fsck.vfat symlink to match the Linux driver name.
+             (symlink exe "fsck.vfat")
+             #t)))))
+    (inputs `(("dosfstools" ,dosfstools/static)))
+    (home-page (package-home-page dosfstools))
+    (synopsis "Statically linked fsck.fat from dosfstools")
+    (description "This package provides a statically-linked fsck.fat
+and a fsck.vfat compatibility symlink for use in an initrd.")
+    (license (package-license dosfstools))))
+
 (define-public sdparm
   (package
     (name "sdparm")