summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2014-05-03 16:37:04 +0200
committerLudovic Courtès <ludo@gnu.org>2014-05-03 16:37:04 +0200
commite102f940976ad3703981e7f7bf5455843054d687 (patch)
tree51a16d9a2ed785b1cd9c5a40d607ffa592113dab
parent66f23d66219533aff689a05d16439827da1a2a59 (diff)
downloadguix-e102f940976ad3703981e7f7bf5455843054d687.tar.gz
gnu: Add statically-linked versions of e2fsprogs and the fsck.* commands.
* gnu/packages/linux.scm (e2fsprogs/static, e2fsck/static): New
  variables.
-rw-r--r--gnu/packages/linux.scm45
1 files changed, 44 insertions, 1 deletions
diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index 759b92d51e..3325679258 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -42,7 +42,8 @@
   #:use-module (guix download)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system cmake)
-  #:use-module (guix build-system python))
+  #:use-module (guix build-system python)
+  #:use-module (guix build-system trivial))
 
 (define-public (system->linux-architecture arch)
   "Return the Linux architecture name for ARCH, a Guix system name such as
@@ -466,6 +467,48 @@ slabtop, and skill.")
                    lgpl2.0                        ; libext2fs
                    x11))))                        ; libuuid
 
+(define-public e2fsprogs/static
+  (package (inherit e2fsprogs)
+    (name "e2fsprogs-static")
+    (arguments
+     `(#:configure-flags '("LDFLAGS=-static")
+       ,@(package-arguments e2fsprogs)))
+    (synopsis
+     "Statically-linked version of the ext2/ext3/ext4 file system tools")))
+
+(define-public e2fsck/static
+  (package
+    (name "e2fsck-static")
+    (version (package-version e2fsprogs/static))
+    (build-system trivial-build-system)
+    (source #f)
+    (arguments
+     `(#:modules ((guix build utils))
+       #:builder
+       (begin
+         (use-modules (guix build utils)
+                      (ice-9 ftw)
+                      (srfi srfi-26))
+
+         (let ((source (string-append (assoc-ref %build-inputs "e2fsprogs")
+                                      "/sbin"))
+               (bin    (string-append (assoc-ref %outputs "out") "/sbin")))
+           (mkdir-p bin)
+           (with-directory-excursion bin
+             (for-each (lambda (file)
+                         (copy-file (string-append source "/" file)
+                                    file)
+                         (remove-store-references file)
+                         (chmod file #o555))
+                       (scandir source (cut string-prefix? "fsck." <>))))))))
+    (inputs `(("e2fsprogs" ,e2fsprogs/static)))
+    (synopsis "Statically-linked fsck.* commands from e2fsprogs")
+    (description
+     "This package provides statically-linked command of fsck.ext[234] taken
+from the e2fsprogs package.  It is meant to be used in initrds.")
+    (home-page (package-home-page e2fsprogs/static))
+    (license (package-license e2fsprogs/static))))
+
 (define-public strace
   (package
     (name "strace")