| 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 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 | ;;; |
| 12 | ;;; This file is part of GNU Guix. |
| 13 | ;;; |
| 14 | ;;; GNU Guix is free software; you can redistribute it and/or modify it |
| 15 | ;;; under the terms of the GNU General Public License as published by |
| 16 | ;;; the Free Software Foundation; either version 3 of the License, or (at |
| 17 | ;;; your option) any later version. |
| 18 | ;;; |
| 19 | ;;; GNU Guix is distributed in the hope that it will be useful, but |
| 20 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of |
| 21 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 22 | ;;; GNU General Public License for more details. |
| 23 | ;;; |
| 24 | ;;; You should have received a copy of the GNU General Public License |
| 25 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. |
| 26 | |
| 27 | (define-module (gnu packages disk) |
| 28 | #:use-module ((guix licenses) #:prefix license:) |
| 29 | #:use-module (guix packages) |
| 30 | #:use-module (guix download) |
| 31 | #:use-module (guix build-system gnu) |
| 32 | #:use-module (guix build-system trivial) |
| 33 | #:use-module (gnu packages) |
| 34 | #:use-module (gnu packages base) |
| 35 | #:use-module (gnu packages docbook) |
| 36 | #:use-module (gnu packages gettext) |
| 37 | #:use-module (gnu packages glib) |
| 38 | #:use-module (gnu packages gtk) |
| 39 | #:use-module (gnu packages gnome) |
| 40 | #:use-module (gnu packages linux) |
| 41 | #:use-module (gnu packages ncurses) |
| 42 | #:use-module (gnu packages perl) |
| 43 | #:use-module (gnu packages pkg-config) |
| 44 | #:use-module (gnu packages popt) |
| 45 | #:use-module (gnu packages python) |
| 46 | #:use-module (gnu packages readline) |
| 47 | #:use-module (gnu packages guile) |
| 48 | #:use-module (gnu packages compression) |
| 49 | #:use-module (gnu packages vim) |
| 50 | #:use-module (gnu packages xml)) |
| 51 | |
| 52 | (define-public parted |
| 53 | (package |
| 54 | (name "parted") |
| 55 | (version "3.2") |
| 56 | (source (origin |
| 57 | (method url-fetch) |
| 58 | (uri (string-append "mirror://gnu/parted/parted-" |
| 59 | version ".tar.xz")) |
| 60 | (sha256 |
| 61 | (base32 |
| 62 | "1r3qpg3bhz37mgvp9chsaa3k0csby3vayfvz8ggsqz194af5i2w5")))) |
| 63 | (build-system gnu-build-system) |
| 64 | (arguments |
| 65 | `(#:phases |
| 66 | (modify-phases %standard-phases |
| 67 | (add-after |
| 68 | 'unpack 'fix-locales-and-python |
| 69 | (lambda* (#:key inputs #:allow-other-keys) |
| 70 | (substitute* "tests/t0251-gpt-unicode.sh" |
| 71 | (("C.UTF-8") "en_US.utf8")) ;not in Glibc locales |
| 72 | (substitute* "tests/msdos-overlap" |
| 73 | (("/usr/bin/python") (which "python")))))))) |
| 74 | (inputs |
| 75 | `(("lvm2" ,lvm2) |
| 76 | ("readline" ,readline) |
| 77 | ("util-linux" ,util-linux))) |
| 78 | (native-inputs |
| 79 | `(("gettext" ,gettext-minimal) |
| 80 | ;; For the tests. |
| 81 | ("perl" ,perl) |
| 82 | ("python" ,python-2))) |
| 83 | (home-page "https://www.gnu.org/software/parted/") |
| 84 | (synopsis "Disk partition editor") |
| 85 | (description |
| 86 | "GNU Parted is a package for creating and manipulating disk partition |
| 87 | tables. It includes a library and command-line utility.") |
| 88 | (license license:gpl3+))) |
| 89 | |
| 90 | (define-public fdisk |
| 91 | (package |
| 92 | (name "fdisk") |
| 93 | (version "2.0.0a1") |
| 94 | (source |
| 95 | (origin |
| 96 | (method url-fetch) |
| 97 | (uri (string-append "mirror://gnu/fdisk/gnufdisk-" |
| 98 | version ".tar.gz")) |
| 99 | (sha256 |
| 100 | (base32 |
| 101 | "1d8za79kw8ihnp2br084rgyjv9whkwp7957rzw815i0izx6xhqy9")))) |
| 102 | (build-system gnu-build-system) |
| 103 | (inputs |
| 104 | `(("gettext" ,gettext-minimal) |
| 105 | ("guile" ,guile-1.8) |
| 106 | ("util-linux" ,util-linux) |
| 107 | ("parted" ,parted))) |
| 108 | ;; The build neglects to look for its own headers in its own tree. A next |
| 109 | ;; release should fix this, but may never come: GNU fdisk looks abandoned. |
| 110 | (arguments |
| 111 | `(#:phases |
| 112 | (modify-phases %standard-phases |
| 113 | (add-after 'unpack 'skip-broken-header-probes |
| 114 | (lambda _ |
| 115 | (substitute* "backend/configure" |
| 116 | (("gnufdisk-common.h .*") "\n")) |
| 117 | #t))) |
| 118 | #:make-flags (list (string-append "CPPFLAGS=" |
| 119 | " -I../common/include " |
| 120 | " -I../debug/include " |
| 121 | " -I../exception/include")))) |
| 122 | (home-page "https://www.gnu.org/software/fdisk/") |
| 123 | (synopsis "Low-level disk partitioning and formatting") |
| 124 | (description |
| 125 | "GNU fdisk provides a GNU version of the common disk partitioning tool |
| 126 | fdisk. fdisk is used for the creation and manipulation of disk partition |
| 127 | tables, and it understands a variety of different formats.") |
| 128 | (license license:gpl3+))) |
| 129 | |
| 130 | (define-public gptfdisk |
| 131 | (package |
| 132 | (name "gptfdisk") |
| 133 | (version "1.0.3") |
| 134 | (source |
| 135 | (origin |
| 136 | (method url-fetch) |
| 137 | (uri (string-append "mirror://sourceforge/gptfdisk/gptfdisk/" |
| 138 | version "/" name "-" version ".tar.gz")) |
| 139 | (sha256 |
| 140 | (base32 |
| 141 | "0p0vr67lnqdsgdv2y144xmjqa1a2nijrrd3clc8dc2f46pn5mzc9")))) |
| 142 | (build-system gnu-build-system) |
| 143 | (inputs |
| 144 | `(("gettext" ,gettext-minimal) |
| 145 | ("ncurses" ,ncurses) |
| 146 | ("popt" ,popt) |
| 147 | ("util-linux" ,util-linux))) ; libuuid |
| 148 | (arguments |
| 149 | `(#:test-target "test" |
| 150 | #:phases |
| 151 | (modify-phases %standard-phases |
| 152 | ;; no configure script |
| 153 | (delete 'configure) |
| 154 | ;; no install target |
| 155 | (replace 'install |
| 156 | (lambda* (#:key outputs #:allow-other-keys) |
| 157 | (let* ((out (assoc-ref outputs "out")) |
| 158 | (bin (string-append out "/bin")) |
| 159 | (man (string-append out "/share/man/man8"))) |
| 160 | (install-file "gdisk" bin) |
| 161 | (install-file "sgdisk" bin) |
| 162 | (install-file "cgdisk" bin) |
| 163 | (install-file "fixparts" bin) |
| 164 | (install-file "cgdisk.8" man) |
| 165 | (install-file "fixparts.8" man) |
| 166 | (install-file "gdisk.8" man) |
| 167 | (install-file "sgdisk.8" man))))))) |
| 168 | (home-page "http://www.rodsbooks.com/gdisk/") |
| 169 | (synopsis "Low-level GPT disk partitioning and formatting") |
| 170 | (description "GPT fdisk (aka gdisk) is a text-mode partitioning tool that |
| 171 | works on Globally Unique Identifier (@dfn{GUID}) Partition Table (@dfn{GPT}) |
| 172 | disks, rather than on the older Master Boot Record (@dfn{MBR}) partition |
| 173 | scheme.") |
| 174 | (license license:gpl2))) |
| 175 | |
| 176 | (define-public ddrescue |
| 177 | (package |
| 178 | (name "ddrescue") |
| 179 | (version "1.22") |
| 180 | (source |
| 181 | (origin |
| 182 | (method url-fetch) |
| 183 | (uri (string-append "mirror://gnu/ddrescue/ddrescue-" |
| 184 | version ".tar.lz")) |
| 185 | (sha256 |
| 186 | (base32 |
| 187 | "19qhx9ggkkjl0g3a88g501wmybkj1y4n5lm5kp0km0blh0p7p189")))) |
| 188 | (build-system gnu-build-system) |
| 189 | (home-page "https://www.gnu.org/software/ddrescue/ddrescue.html") |
| 190 | (synopsis "Data recovery utility") |
| 191 | (native-inputs `(("lzip" ,lzip))) |
| 192 | (description |
| 193 | "GNU ddrescue is a fully automated data recovery tool. It copies data |
| 194 | from one file to another, working to rescue data in case of read errors. The |
| 195 | program also includes a tool for manipulating its log files, which are used |
| 196 | to recover data more efficiently by only reading the necessary blocks.") |
| 197 | (license license:gpl3+))) |
| 198 | |
| 199 | (define-public dosfstools |
| 200 | (package |
| 201 | (name "dosfstools") |
| 202 | (version "4.1") |
| 203 | (source |
| 204 | (origin |
| 205 | (method url-fetch) |
| 206 | (uri (string-append "https://github.com/" name "/" name |
| 207 | "/releases/download/v" version "/" |
| 208 | name "-" version ".tar.xz")) |
| 209 | (sha256 |
| 210 | (base32 |
| 211 | "0wy13i3i4x2bw1hf5m4fd0myh61f9bcrs035fdlf6gyc1jksrcp6")))) |
| 212 | (build-system gnu-build-system) |
| 213 | (arguments |
| 214 | `(#:make-flags (list (string-append "PREFIX=" %output) |
| 215 | "CC=gcc"))) |
| 216 | (native-inputs |
| 217 | `(("xxd" ,vim))) ; for tests |
| 218 | (home-page "https://github.com/dosfstools/dosfstools") |
| 219 | (synopsis "Utilities for making and checking MS-DOS FAT file systems") |
| 220 | (description |
| 221 | "The dosfstools package includes the mkfs.fat and fsck.fat utilities, |
| 222 | which respectively make and check MS-DOS FAT file systems.") |
| 223 | (license license:gpl3+))) |
| 224 | |
| 225 | (define dosfstools/static |
| 226 | (static-package |
| 227 | (package (inherit dosfstools)))) |
| 228 | |
| 229 | (define-public fatfsck/static |
| 230 | (package |
| 231 | (name "fatfsck-static") |
| 232 | (version (package-version dosfstools)) |
| 233 | (build-system trivial-build-system) |
| 234 | (source #f) |
| 235 | (arguments |
| 236 | `(#:modules ((guix build utils)) |
| 237 | #:builder |
| 238 | (begin |
| 239 | (use-modules (guix build utils)) |
| 240 | (let ((src (string-append (assoc-ref %build-inputs "dosfstools") |
| 241 | "/sbin")) |
| 242 | (exe "fsck.fat") |
| 243 | (bin (string-append (assoc-ref %outputs "out") "/sbin"))) |
| 244 | (mkdir-p bin) |
| 245 | (with-directory-excursion bin |
| 246 | (copy-file (string-append src "/" exe) exe) |
| 247 | (remove-store-references exe) |
| 248 | (chmod exe #o555) |
| 249 | ;; Add fsck.vfat symlink to match the Linux driver name. |
| 250 | (symlink exe "fsck.vfat") |
| 251 | #t))))) |
| 252 | (inputs `(("dosfstools" ,dosfstools/static))) |
| 253 | (home-page (package-home-page dosfstools)) |
| 254 | (synopsis "Statically linked fsck.fat from dosfstools") |
| 255 | (description "This package provides a statically-linked @command{fsck.fat} |
| 256 | and a @command{fsck.vfat} compatibility symlink for use in an initrd.") |
| 257 | (license (package-license dosfstools)))) |
| 258 | |
| 259 | (define-public sdparm |
| 260 | (package |
| 261 | (name "sdparm") |
| 262 | (version "1.10") |
| 263 | (source |
| 264 | (origin |
| 265 | (method url-fetch) |
| 266 | (uri (string-append "http://sg.danny.cz/sg/p/" |
| 267 | name "-" version ".tar.xz")) |
| 268 | (sha256 |
| 269 | (base32 |
| 270 | "1jjq3lzgfy4r76rc26q02lv4wm5cb4dx5nh913h489zjrr4f3jbx")))) |
| 271 | (build-system gnu-build-system) |
| 272 | (home-page "http://sg.danny.cz/sg/sdparm.html") |
| 273 | (synopsis "Provide access to SCSI device parameters") |
| 274 | (description |
| 275 | "Sdparm reads and modifies SCSI device parameters. These devices can be |
| 276 | SCSI disks, in which case the role of @command{sdparm} is similar to its |
| 277 | namesake: the @command{hdparm} utility originally designed for ATA disks. |
| 278 | However, @command{sdparm} can be used to access parameters on any device that |
| 279 | uses a SCSI command set. Such devices include CD/DVD drives (irrespective of |
| 280 | transport), SCSI and ATAPI tape drives, and SCSI enclosures. This utility can |
| 281 | also send commands associated with starting and stopping the media, loading |
| 282 | and unloading removable media and some other housekeeping functions.") |
| 283 | (license license:bsd-3))) |
| 284 | |
| 285 | (define-public idle3-tools |
| 286 | (package |
| 287 | (name "idle3-tools") |
| 288 | (version "0.9.1") |
| 289 | (source |
| 290 | (origin |
| 291 | (method url-fetch) |
| 292 | (uri (string-append "mirror://sourceforge/idle3-tools/idle3-tools-" |
| 293 | version ".tgz")) |
| 294 | (sha256 |
| 295 | (base32 |
| 296 | "00ia7xq9yldxyl9gz0mr4xa568nav14p0fnv82f2rbbkg060cy4p")))) |
| 297 | (build-system gnu-build-system) |
| 298 | (arguments |
| 299 | `(#:tests? #f ;no test suite |
| 300 | #:phases |
| 301 | (modify-phases %standard-phases |
| 302 | (delete 'configure)) |
| 303 | #:make-flags (list "CC=gcc" |
| 304 | (string-append "manprefix=") |
| 305 | (string-append "DESTDIR=" |
| 306 | (assoc-ref %outputs "out"))))) |
| 307 | (home-page "http://idle3-tools.sourceforge.net") |
| 308 | (synopsis "Change or disable Western Digital hard drives' Idle3 timer") |
| 309 | (description |
| 310 | "Idle3-tools provides a utility to get, set, or disable the Idle3 timer |
| 311 | present in many Western Digital hard drives. This timer is part of the |
| 312 | \"IntelliPark\" feature that stops the disk when not in use. Unfortunately, |
| 313 | the default timer setting is not well suited to Linux or other *nix systems, |
| 314 | and can dramatically shorten the lifespan of the drive if left unchecked.") |
| 315 | (license license:gpl3+))) |
| 316 | |
| 317 | (define-public gparted |
| 318 | (package |
| 319 | (name "gparted") |
| 320 | (version "0.28.1") |
| 321 | (source |
| 322 | (origin |
| 323 | (method url-fetch) |
| 324 | (uri (string-append "mirror://sourceforge/gparted/gparted/gparted-" |
| 325 | version "/gparted-" version ".tar.gz")) |
| 326 | (sha256 |
| 327 | (base32 "0cyk8lpimm6wani8khw0szwqkgw5wpq2mfnfxkbgfm2774a1z2bn")))) |
| 328 | (build-system gnu-build-system) |
| 329 | (arguments |
| 330 | `(#:tests? #f ; Tests require a network connection. |
| 331 | #:configure-flags '("--disable-scrollkeeper"))) |
| 332 | (inputs |
| 333 | `(("util-linux" ,util-linux) |
| 334 | ("parted" ,parted) |
| 335 | ("glib" ,glib) |
| 336 | ("gtkmm" ,gtkmm-2) |
| 337 | ("libxml2" ,libxml2) |
| 338 | ("libxslt" ,libxslt) |
| 339 | ("gnome-doc-utils" ,gnome-doc-utils) |
| 340 | ("docbook-xml" ,docbook-xml-4.2) |
| 341 | ("python" ,python-2) |
| 342 | ("python-libxml2" ,python2-libxml2) |
| 343 | ("which" ,which))) |
| 344 | (native-inputs |
| 345 | `(("intltool" ,intltool) |
| 346 | ("pkg-config" ,pkg-config))) |
| 347 | (home-page "https://sourceforge.net/projects/gparted/") |
| 348 | (synopsis "Partition editor to graphically manage disk partitions") |
| 349 | (description "GParted is a GNOME partition editor for creating, |
| 350 | reorganizing, and deleting disk partitions. It uses libparted from the parted |
| 351 | project to detect and manipulate partition tables. Optional file system tools |
| 352 | permit managing file systems not included in libparted.") |
| 353 | ;; The home page says GPLv2, but the source code says GPLv2+. |
| 354 | (license license:gpl2+))) |
| 355 | |
| 356 | |
| 357 | (define-public f3 |
| 358 | (package |
| 359 | (name "f3") |
| 360 | (version "6.0") |
| 361 | (source |
| 362 | (origin |
| 363 | (method url-fetch) |
| 364 | (uri (string-append "https://github.com/AltraMayor/f3/archive/" |
| 365 | "v" version ".tar.gz")) |
| 366 | (file-name (string-append name "-" version ".tar.gz")) |
| 367 | (sha256 |
| 368 | (base32 |
| 369 | "1mgbzc1swvgil45md1336j0aqkmkhwmpxical0ln5g09b2qxsanp")))) |
| 370 | (build-system gnu-build-system) |
| 371 | (arguments |
| 372 | '(#:tests? #f ; no check target |
| 373 | #:make-flags (list "CC=gcc" |
| 374 | (string-append "PREFIX=" %output)) |
| 375 | #:phases |
| 376 | (modify-phases %standard-phases |
| 377 | (delete 'configure) |
| 378 | (add-before 'build 'fix-makefile |
| 379 | (lambda _ |
| 380 | (substitute* "Makefile" |
| 381 | ;; Install without setting owner and group |
| 382 | (("\\$\\(INSTALL\\) -oroot -groot ") "$(INSTALL) ") |
| 383 | ;; also build and install experimental tools |
| 384 | (("^all: ") "all: $(EXPERIMENTAL_TARGETS) ") |
| 385 | (("^install: ") "install-all: ") |
| 386 | (("^install-experimental: ") "install: install-all ")) |
| 387 | #t))))) |
| 388 | (inputs |
| 389 | `(("eudev" ,eudev) |
| 390 | ("parted" ,parted))) |
| 391 | (home-page "http://oss.digirati.com.br/f3/") |
| 392 | (synopsis "Test real capacity of flash memory cards and such.") |
| 393 | (description "F3 (Fight Flash Fraud or Fight Fake Flash) tests the full |
| 394 | capacity of a flash card (flash drive, flash disk, pendrive). F3 writes to |
| 395 | the card and then checks if can read it. It will assure you haven't been sold |
| 396 | a card with a smaller capacity than stated.") |
| 397 | (license license:gpl3+))) |