summaryrefslogtreecommitdiff
path: root/gnu
diff options
context:
space:
mode:
authorMaxim Cournoyer <maxim@guixotic.coop>2025-10-13 22:20:49 +0900
committerMaxim Cournoyer <maxim@guixotic.coop>2025-10-13 23:53:07 +0900
commit83e76aa1f3b7be79c10c7a160c4b4cc8e75020f7 (patch)
treeaca11936e54ff731c768d9f39d10c2647b829ec8 /gnu
parent685a9b83e9eaffe35e1589f40b358b081803fd9c (diff)
gnu: libblockdev: More thoroughly patch commands.
* gnu/packages/disk.scm (libblockdev) [#:phases] {patch-plugins-paths}: Rename to... {patch-paths}: ... this, and extend with more patching. [inputs]: Add exfatprogs, f2fs-tools, nilfs-utils and udftools. Fixes: #3466 Change-Id: I35659abcd7cdefa694f69900e5c956812f937499
Diffstat (limited to 'gnu')
-rw-r--r--gnu/packages/disk.scm79
1 files changed, 66 insertions, 13 deletions
diff --git a/gnu/packages/disk.scm b/gnu/packages/disk.scm
index b5db001d0df..269a7063701 100644
--- a/gnu/packages/disk.scm
+++ b/gnu/packages/disk.scm
@@ -24,7 +24,7 @@
24;;; Copyright © 2021 Justin Veilleux <terramorpha@cock.li> 24;;; Copyright © 2021 Justin Veilleux <terramorpha@cock.li>
25;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev> 25;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev>
26;;; Copyright © 2014, 2022 Ludovic Courtès <ludo@gnu.org> 26;;; Copyright © 2014, 2022 Ludovic Courtès <ludo@gnu.org>
27;;; Copyright © 2022 Maxim Cournoyer <maxim@guixotic.coop> 27;;; Copyright © 2022, 2025 Maxim Cournoyer <maxim@guixotic.coop>
28;;; Copyright © 2022 Disseminate Dissent <disseminatedissent@protonmail.com> 28;;; Copyright © 2022 Disseminate Dissent <disseminatedissent@protonmail.com>
29;;; Copyright © 2023 Timotej Lazar <timotej.lazar@araneo.si> 29;;; Copyright © 2023 Timotej Lazar <timotej.lazar@araneo.si>
30;;; Copyright © 2023 Morgan Smith <Morgan.J.Smith@outlook.com> 30;;; Copyright © 2023 Morgan Smith <Morgan.J.Smith@outlook.com>
@@ -1341,6 +1341,7 @@ to create devices with respective mappings for the ATARAID sets discovered.")
1341 (build-system gnu-build-system) 1341 (build-system gnu-build-system)
1342 (arguments 1342 (arguments
1343 (list 1343 (list
1344 #:modules (cons '(ice-9 format) %default-gnu-modules)
1344 #:phases 1345 #:phases
1345 #~(modify-phases %standard-phases 1346 #~(modify-phases %standard-phases
1346 (add-after 'unpack 'patch-configuration-directory 1347 (add-after 'unpack 'patch-configuration-directory
@@ -1348,22 +1349,70 @@ to create devices with respective mappings for the ATARAID sets discovered.")
1348 (substitute* "src/lib/blockdev.c" 1349 (substitute* "src/lib/blockdev.c"
1349 (("/etc/libblockdev/conf.d/" path) 1350 (("/etc/libblockdev/conf.d/" path)
1350 (string-append #$output path))))) 1351 (string-append #$output path)))))
1351 (add-after 'unpack 'patch-plugin-paths 1352 (add-after 'unpack 'patch-paths
1352 (lambda* (#:key inputs #:allow-other-keys) 1353 (lambda* (#:key inputs #:allow-other-keys)
1354 (define* (find-program program #:key fail-if-missing?)
1355 (or (and (string=? "vfat-resize" program)
1356 (string-append #$output "/bin/vfat-resize"))
1357 (false-if-exception
1358 (search-input-file inputs
1359 (string-append "bin/" program)))
1360 (false-if-exception
1361 (search-input-file inputs
1362 (string-append "sbin/" program)))
1363 (if fail-if-missing?
1364 (error "could not find" program)
1365 (begin
1366 (format (current-warning-port)
1367 "warning: program ~s left unpatched~%"
1368 program)
1369 program))))
1353 (substitute* (find-files "src/plugins" "\\.c$") 1370 (substitute* (find-files "src/plugins" "\\.c$")
1354 (("(gchar \\*arg.+\\{\")([^\"]+)" all start program) 1371 (("(gchar \\*arg.+\\{\")([^\"]+)" all start program)
1355 (string-append 1372 (string-append
1356 start (or (false-if-exception 1373 start (find-program program))))
1357 (search-input-file inputs 1374 (substitute* "src/plugins/fs/generic.c"
1358 (string-append "bin/" program))) 1375 (("_util = \"([^\"]*)\"" all program)
1359 (false-if-exception 1376 (format #f "_util = ~s" (find-program program))))
1360 (search-input-file inputs 1377 ;; Tip: look for check_deps calls in the source to find where
1361 (string-append "sbin/" program))) 1378 ;; commands are looked up from PATH.
1362 (begin 1379 (let-syntax
1363 (format (current-warning-port) 1380 ((patch-helpers
1364 "warning: program ~s left unpatched~%" 1381 (lambda (x)
1365 program) 1382 (syntax-case x ()
1366 program)))))))))) 1383 ((_ file (helpers ...))
1384 (with-syntax ((pattern (datum->syntax x 'pattern)))
1385 #'(let ((pattern (format #f "\"(~{~a~^|~})\""
1386 '(helpers ...))))
1387 (substitute* file
1388 ((pattern dummy program)
1389 (format
1390 #f "~s"
1391 (find-program
1392 program #:fail-if-missing? #t)))))))))))
1393
1394 (patch-helpers "src/plugins/fs/btrfs.c"
1395 ("mkfs.btrfs" "btrfsck" "btrfs" "btrfstune"))
1396 (patch-helpers "src/plugins/fs/exfat.c"
1397 ("mkfs.exfat" "fsck.exfat" "tune.exfat"))
1398 (patch-helpers "src/plugins/fs/ext.c"
1399 ("mke2fs" "e2fsck" "tune2fs" "resize2fs"))
1400 (patch-helpers "src/plugins/fs/f2fs.c"
1401 ("mkfs.f2fs" "fsck.f2fs" "dump.f2fs"
1402 "resize.f2fs"))
1403 (patch-helpers "src/plugins/fs/nilfs.c"
1404 ("mkfs.nilfs2" "nilfs-tune" "nilfs-resize"))
1405 (patch-helpers "src/plugins/fs/ntfs.c"
1406 ("mkntfs" "ntfsfix" "ntfsresize" "ntfslabel"
1407 "ntfsinfo"))
1408 (patch-helpers "src/plugins/fs/udf.c"
1409 ("mkudffs" "udflabel" "udfinfo"))
1410 (patch-helpers "src/plugins/fs/vfat.c"
1411 ("mkfs.vfat" "fat label" "fsck.vfat"
1412 "vfat-resize" "fatlabel"))
1413 (patch-helpers "src/plugins/fs/xfs.c"
1414 ("mkfs.xfs" "xfs_db" "xfs_repair" "xfs_admin"
1415 "xfs_growfs"))))))))
1367 (native-inputs 1416 (native-inputs
1368 (list gobject-introspection 1417 (list gobject-introspection
1369 pkg-config 1418 pkg-config
@@ -1380,6 +1429,8 @@ to create devices with respective mappings for the ATARAID sets discovered.")
1380 dmraid 1429 dmraid
1381 e2fsprogs 1430 e2fsprogs
1382 eudev 1431 eudev
1432 exfatprogs
1433 f2fs-tools
1383 glib 1434 glib
1384 gptfdisk 1435 gptfdisk
1385 json-glib-minimal 1436 json-glib-minimal
@@ -1392,9 +1443,11 @@ to create devices with respective mappings for the ATARAID sets discovered.")
1392 lvm2 1443 lvm2
1393 mdadm 1444 mdadm
1394 ndctl 1445 ndctl
1446 nilfs-utils
1395 nss 1447 nss
1396 ntfs-3g 1448 ntfs-3g
1397 parted 1449 parted
1450 udftools
1398 util-linux 1451 util-linux
1399 volume-key 1452 volume-key
1400 xfsprogs))) 1453 xfsprogs)))