1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2012, 2013 Nikita Karetnikov <nikita@karetnikov.org>
3 ;;; Copyright © 2015 Mathieu Lirzin <mthl@gnu.org>
4 ;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
5 ;;; Copyright © 2016, 2018 Tobias Geerinckx-Rice <me@tobias.gr>
6 ;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
7 ;;; Copyright © 2016 Jan Nieuwenhuizen <janneke@gnu.org>
8 ;;; Copyright © 2016 Roel Janssen <roel@gnu.org>
9 ;;; Copyright © 2016, 2017 Marius Bakke <mbakke@fastmail.com>
10 ;;; Copyright © 2017 Hartmut Goebel <h.goebel@crazy-compilers.com>
11 ;;; Copyright © 2017 Stefan Reichör <stefan@xsteve.at>
12 ;;; Copyright © 2018 Vasile Dumitrascu <va511e@yahoo.com>
13 ;;; Copyright © 2018 Eric Bavier <bavier@member.fsf.org>
15 ;;; This file is part of GNU Guix.
17 ;;; GNU Guix is free software; you can redistribute it and/or modify it
18 ;;; under the terms of the GNU General Public License as published by
19 ;;; the Free Software Foundation; either version 3 of the License, or (at
20 ;;; your option) any later version.
22 ;;; GNU Guix is distributed in the hope that it will be useful, but
23 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
24 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 ;;; GNU General Public License for more details.
27 ;;; You should have received a copy of the GNU General Public License
28 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
30 (define-module (gnu packages disk)
31 #:use-module ((guix licenses) #:prefix license:)
32 #:use-module (guix packages)
33 #:use-module (guix download)
34 #:use-module (guix build-system gnu)
35 #:use-module (guix build-system trivial)
36 #:use-module (guix build-system python)
37 #:use-module (gnu packages)
38 #:use-module (gnu packages base)
39 #:use-module (gnu packages check)
40 #:use-module (gnu packages databases)
41 #:use-module (gnu packages docbook)
42 #:use-module (gnu packages gettext)
43 #:use-module (gnu packages glib)
44 #:use-module (gnu packages gtk)
45 #:use-module (gnu packages gnome)
46 #:use-module (gnu packages linux)
47 #:use-module (gnu packages ncurses)
48 #:use-module (gnu packages perl)
49 #:use-module (gnu packages pkg-config)
50 #:use-module (gnu packages popt)
51 #:use-module (gnu packages python)
52 #:use-module (gnu packages readline)
53 #:use-module (gnu packages guile)
54 #:use-module (gnu packages compression)
55 #:use-module (gnu packages vim)
56 #:use-module (gnu packages xml))
64 (uri (string-append "mirror://gnu/parted/parted-"
68 "1r3qpg3bhz37mgvp9chsaa3k0csby3vayfvz8ggsqz194af5i2w5"))))
69 (build-system gnu-build-system)
72 (modify-phases %standard-phases
74 'unpack 'fix-locales-and-python
75 (lambda* (#:key inputs #:allow-other-keys)
76 (substitute* "tests/t0251-gpt-unicode.sh"
77 (("C.UTF-8") "en_US.utf8")) ;not in Glibc locales
78 (substitute* "tests/msdos-overlap"
79 (("/usr/bin/python") (which "python"))))))))
82 ("readline" ,readline)
83 ("util-linux" ,util-linux)))
85 `(("gettext" ,gettext-minimal)
88 ("python" ,python-2)))
89 (home-page "https://www.gnu.org/software/parted/")
90 (synopsis "Disk partition editor")
92 "GNU Parted is a package for creating and manipulating disk partition
93 tables. It includes a library and command-line utility.")
94 (license license:gpl3+)))
103 (uri (string-append "mirror://gnu/fdisk/gnufdisk-"
107 "1d8za79kw8ihnp2br084rgyjv9whkwp7957rzw815i0izx6xhqy9"))))
108 (build-system gnu-build-system)
110 `(("gettext" ,gettext-minimal)
112 ("util-linux" ,util-linux)
114 ;; The build neglects to look for its own headers in its own tree. A next
115 ;; release should fix this, but may never come: GNU fdisk looks abandoned.
118 (modify-phases %standard-phases
119 (add-after 'unpack 'skip-broken-header-probes
121 (substitute* "backend/configure"
122 (("gnufdisk-common.h .*") "\n"))
124 #:make-flags (list (string-append "CPPFLAGS="
125 " -I../common/include "
126 " -I../debug/include "
127 " -I../exception/include"))))
128 (home-page "https://www.gnu.org/software/fdisk/")
129 (synopsis "Low-level disk partitioning and formatting")
131 "GNU fdisk provides a GNU version of the common disk partitioning tool
132 fdisk. fdisk is used for the creation and manipulation of disk partition
133 tables, and it understands a variety of different formats.")
134 (license license:gpl3+)))
136 (define-public gptfdisk
143 (uri (string-append "mirror://sourceforge/gptfdisk/gptfdisk/"
144 version "/" name "-" version ".tar.gz"))
147 "0p0vr67lnqdsgdv2y144xmjqa1a2nijrrd3clc8dc2f46pn5mzc9"))))
148 (build-system gnu-build-system)
150 `(("gettext" ,gettext-minimal)
153 ("util-linux" ,util-linux))) ; libuuid
155 `(#:test-target "test"
157 (modify-phases %standard-phases
158 ;; no configure script
162 (lambda* (#:key outputs #:allow-other-keys)
163 (let* ((out (assoc-ref outputs "out"))
164 (bin (string-append out "/bin"))
165 (man (string-append out "/share/man/man8")))
166 (install-file "gdisk" bin)
167 (install-file "sgdisk" bin)
168 (install-file "cgdisk" bin)
169 (install-file "fixparts" bin)
170 (install-file "cgdisk.8" man)
171 (install-file "fixparts.8" man)
172 (install-file "gdisk.8" man)
173 (install-file "sgdisk.8" man)))))))
174 (home-page "http://www.rodsbooks.com/gdisk/")
175 (synopsis "Low-level GPT disk partitioning and formatting")
176 (description "GPT fdisk (aka gdisk) is a text-mode partitioning tool that
177 works on Globally Unique Identifier (@dfn{GUID}) Partition Table (@dfn{GPT})
178 disks, rather than on the older Master Boot Record (@dfn{MBR}) partition
180 (license license:gpl2)))
182 (define-public ddrescue
189 (uri (string-append "mirror://gnu/ddrescue/ddrescue-"
193 "13cd6c0x91zq10vdlyl6r5rib47bmsn5sshmkin3igwj8pa2vbm9"))))
194 (build-system gnu-build-system)
195 (home-page "https://www.gnu.org/software/ddrescue/ddrescue.html")
196 (synopsis "Data recovery utility")
197 (native-inputs `(("lzip" ,lzip)))
199 "GNU ddrescue is a fully automated data recovery tool. It copies data
200 from one file to another, working to rescue data in case of read errors. The
201 program also includes a tool for manipulating its log files, which are used
202 to recover data more efficiently by only reading the necessary blocks.")
203 (license license:gpl3+)))
205 (define-public dosfstools
212 (uri (string-append "https://github.com/" name "/" name
213 "/releases/download/v" version "/"
214 name "-" version ".tar.xz"))
217 "0wy13i3i4x2bw1hf5m4fd0myh61f9bcrs035fdlf6gyc1jksrcp6"))))
218 (build-system gnu-build-system)
220 `(#:make-flags (list (string-append "PREFIX=" %output)
223 `(("xxd" ,xxd))) ; for tests
224 (home-page "https://github.com/dosfstools/dosfstools")
225 (synopsis "Utilities for making and checking MS-DOS FAT file systems")
227 "The dosfstools package includes the mkfs.fat and fsck.fat utilities,
228 which respectively make and check MS-DOS FAT file systems.")
229 (license license:gpl3+)))
231 (define dosfstools/static
233 (package (inherit dosfstools))))
235 (define-public fatfsck/static
237 (name "fatfsck-static")
238 (version (package-version dosfstools))
239 (build-system trivial-build-system)
242 `(#:modules ((guix build utils))
245 (use-modules (guix build utils))
246 (let ((src (string-append (assoc-ref %build-inputs "dosfstools")
249 (bin (string-append (assoc-ref %outputs "out") "/sbin")))
251 (with-directory-excursion bin
252 (copy-file (string-append src "/" exe) exe)
253 (remove-store-references exe)
255 ;; Add fsck.vfat symlink to match the Linux driver name.
256 (symlink exe "fsck.vfat")
258 (inputs `(("dosfstools" ,dosfstools/static)))
259 (home-page (package-home-page dosfstools))
260 (synopsis "Statically linked fsck.fat from dosfstools")
261 (description "This package provides a statically-linked @command{fsck.fat}
262 and a @command{fsck.vfat} compatibility symlink for use in an initrd.")
263 (license (package-license dosfstools))))
265 (define-public sdparm
272 (uri (string-append "http://sg.danny.cz/sg/p/"
273 name "-" version ".tar.xz"))
276 "1jjq3lzgfy4r76rc26q02lv4wm5cb4dx5nh913h489zjrr4f3jbx"))))
277 (build-system gnu-build-system)
278 (home-page "http://sg.danny.cz/sg/sdparm.html")
279 (synopsis "Provide access to SCSI device parameters")
281 "Sdparm reads and modifies SCSI device parameters. These devices can be
282 SCSI disks, in which case the role of @command{sdparm} is similar to its
283 namesake: the @command{hdparm} utility originally designed for ATA disks.
284 However, @command{sdparm} can be used to access parameters on any device that
285 uses a SCSI command set. Such devices include CD/DVD drives (irrespective of
286 transport), SCSI and ATAPI tape drives, and SCSI enclosures. This utility can
287 also send commands associated with starting and stopping the media, loading
288 and unloading removable media and some other housekeeping functions.")
289 (license license:bsd-3)))
291 (define-public idle3-tools
298 (uri (string-append "mirror://sourceforge/idle3-tools/idle3-tools-"
302 "00ia7xq9yldxyl9gz0mr4xa568nav14p0fnv82f2rbbkg060cy4p"))))
303 (build-system gnu-build-system)
305 `(#:tests? #f ;no test suite
307 (modify-phases %standard-phases
309 #:make-flags (list "CC=gcc"
310 (string-append "manprefix=")
311 (string-append "DESTDIR="
312 (assoc-ref %outputs "out")))))
313 (home-page "http://idle3-tools.sourceforge.net")
314 (synopsis "Change or disable Western Digital hard drives' Idle3 timer")
316 "Idle3-tools provides a utility to get, set, or disable the Idle3 timer
317 present in many Western Digital hard drives. This timer is part of the
318 \"IntelliPark\" feature that stops the disk when not in use. Unfortunately,
319 the default timer setting is not well suited to Linux or other *nix systems,
320 and can dramatically shorten the lifespan of the drive if left unchecked.")
321 (license license:gpl3+)))
323 (define-public gparted
330 (uri (string-append "mirror://sourceforge/gparted/gparted/gparted-"
331 version "/gparted-" version ".tar.gz"))
333 (base32 "1fh7rpgb4xxdhgyjsirb83zvjfc5mfngb8a1pjbv7r6r6jj4jyrv"))))
334 (build-system gnu-build-system)
336 `(#:tests? #f ; tests require a network connection
337 #:configure-flags '("--disable-scrollkeeper")))
339 `(("util-linux" ,util-linux)
345 ("gnome-doc-utils" ,gnome-doc-utils)
346 ("docbook-xml" ,docbook-xml-4.2)
348 ("python-libxml2" ,python2-libxml2)
351 `(("intltool" ,intltool)
352 ("pkg-config" ,pkg-config)))
353 (home-page "https://gparted.org/")
354 (synopsis "Partition editor to graphically manage disk partitions")
355 (description "GParted is a GNOME partition editor for creating,
356 reorganizing, and deleting disk partitions. It uses libparted from the parted
357 project to detect and manipulate partition tables. Optional file system tools
358 permit managing file systems not included in libparted.")
359 ;; The home page says GPLv2, but the source code says GPLv2+.
360 (license license:gpl2+)))
369 (uri (pypi-uri "pydf" version))
372 "0f8ly8xyp93i2hm9c0qjqd4y86nz73axw2f09z01mszwmg1sfivz"))))
373 (build-system python-build-system)
374 (home-page "http://kassiopeia.juls.savba.sk/~garabik/software/pydf/")
375 (synopsis "Colourised @command{df} clone")
376 (description "All-singing, all-dancing, fully colourised @command{df} clone
377 written in Python. It displays the amount of disk space available on the
378 mounted file systems, using different colours for different types of file
379 systems. Output format is completely customizable.")
380 (license license:public-domain)))
389 (uri (string-append "https://github.com/AltraMayor/f3/archive/"
390 "v" version ".tar.gz"))
391 (file-name (string-append name "-" version ".tar.gz"))
394 "1mgbzc1swvgil45md1336j0aqkmkhwmpxical0ln5g09b2qxsanp"))))
395 (build-system gnu-build-system)
397 '(#:tests? #f ; no check target
398 #:make-flags (list "CC=gcc"
399 (string-append "PREFIX=" %output))
401 (modify-phases %standard-phases
403 (add-before 'build 'fix-makefile
405 (substitute* "Makefile"
406 ;; Install without setting owner and group
407 (("\\$\\(INSTALL\\) -oroot -groot ") "$(INSTALL) ")
408 ;; also build and install experimental tools
409 (("^all: ") "all: $(EXPERIMENTAL_TARGETS) ")
410 (("^install: ") "install-all: ")
411 (("^install-experimental: ") "install: install-all "))
416 (home-page "http://oss.digirati.com.br/f3/")
417 (synopsis "Test real capacity of flash memory cards and such.")
418 (description "F3 (Fight Flash Fraud or Fight Fake Flash) tests the full
419 capacity of a flash card (flash drive, flash disk, pendrive). F3 writes to
420 the card and then checks if can read it. It will assure you haven't been sold
421 a card with a smaller capacity than stated.")
422 (license license:gpl3+)))
424 (define-public python-parted
426 (name "python-parted")
431 (uri (string-append "https://github.com/dcantrell/pyparted/archive/v"
435 "0r1nyjj40nacnfnv17x2mnsj6ga1qplyxyza82v2809dfhim2fwq"))))
436 (build-system python-build-system)
439 (modify-phases %standard-phases
441 (add-after 'install 'check
442 (lambda* (#:key outputs inputs #:allow-other-keys)
443 (add-installed-pythonpath inputs outputs)
444 ;; See <https://github.com/dcantrell/pyparted/issues/47>.
445 (substitute* "tests/test__ped_ped.py"
446 (("\"/tmp/temp-device-\"") "self.path"))
447 (invoke "python" "-m" "unittest" "discover" "-v")
450 `(("e2fsprogs" ,e2fsprogs)
451 ("pkg-config" ,pkg-config)))
453 `(("python-six" ,python-six)))
455 `(("parted" ,parted)))
456 (home-page "https://github.com/dcantrell/pyparted")
457 (synopsis "Parted bindings for Python")
458 (description "This package provides @code{parted} bindings for Python.")
459 (license license:gpl2+)))
461 (define-public python2-parted
462 (package-with-python2 python-parted))
464 (define-public duperemove
471 "https://github.com/markfasheh/duperemove/archive/v"
475 "0rjmmh42yqw9a5j6sp31cqwxk3s97dsi4xz0wpxpllj7bsp3aiw5"))
476 (file-name (string-append name "-" version ".tar.gz"))))
477 (build-system gnu-build-system)
479 `(("pkg-config" ,pkg-config)))
484 `(#:tests? #f ; no test suite
486 (modify-phases %standard-phases
487 (delete 'configure)) ; no configure script
488 #:make-flags (list (string-append "PREFIX=" %output)
490 (home-page "https://github.com/markfasheh/duperemove")
491 (synopsis "Tools for de-duplicating file system data")
492 (description "Duperemove is a simple tool for finding duplicated extents
493 and submitting them for deduplication. When given a list of files it will
494 hash their contents on a block by block basis and compare those hashes to each
495 other, finding and categorizing blocks that match each other. When given the
496 @option{-d} option, duperemove will submit those extents for deduplication
497 using the Linux kernel extent-same @code{ioctl}.
499 Duperemove can store the hashes it computes in a @dfn{hash file}. If given an
500 existing hash file, duperemove will only compute hashes for those files which
501 have changed since the last run. Thus you can run duperemove repeatedly on
502 your data as it changes, without having to re-checksum unchanged data.
504 Duperemove can also take input from the @command{fdupes} program.")
505 (license license:gpl2)))
507 (define-public ranger
513 (uri (string-append "https://ranger.github.io/"
514 "ranger-" version ".tar.gz"))
517 "1lnzkrxcnlwnyi3z0v8ybyp8d5rm26qm35rr68kbs2lbs06inha0"))))
518 (build-system python-build-system)
519 (native-inputs ;for tests
520 `(("python-pytest" ,python-pytest)
521 ("python-pylint" ,python-pylint)
522 ("python-flake8" ,python-flake8)
524 (arguments '(#:test-target "test"))
525 (home-page "https://ranger.github.io/")
526 (synopsis "Console file manager")
527 (description "ranger is a console file manager with Vi key bindings. It
528 provides a minimalistic and nice curses interface with a view on the directory
529 hierarchy. It ships with @code{rifle}, a file launcher that is good at
530 automatically finding out which program to use for what file type.")
531 (license license:gpl3)))