Subject: [PATCH 2/2] gnu: bees: Wrap script.

From: Hilton Chain <[email-masked]>
Date: Sat, 8 Jul 2023 11:49:55 +0800

* gnu/packages/file-systems.scm (bees)[arguments]<#:phases>: Remove 'fixpath.
Add 'wrap.
[inputs]: Add guile-3.0.
---
 gnu/packages/file-systems.scm | 38 +++++++++++++----------------------
 1 file changed, 14 insertions(+), 24 deletions(-)

diff --git a/gnu/packages/file-systems.scm b/gnu/packages/file-systems.scm
index 0b024d6b92..52c8224ec1 100644
--- a/gnu/packages/file-systems.scm
+++ b/gnu/packages/file-systems.scm
@@ -1982,31 +1982,21 @@ (define-public bees
            #:phases
            #~(modify-phases %standard-phases
                (delete 'configure)
-               (add-after 'unpack 'fixpath
+               (add-after 'install 'wrap
                  (lambda* (#:key inputs #:allow-other-keys)
-                   (substitute* "scripts/beesd.in"
-                     (((string-append "\\<(" (string-join (list "realpath"
-                                                                "uuidparse"
-                                                                "grep"
-                                                                "false"
-                                                                "sed"
-                                                                "true"
-                                                                "head"
-                                                                "mkdir"
-                                                                "mount"
-                                                                "touch"
-                                                                "du"
-                                                                "cut"
-                                                                "rm"
-                                                                "truncate"
-                                                                "chmod")
-                                                          "|") ")\\>") command)
-                      (search-input-file inputs (string-append "/bin/" command)))
-
-                     (("btrfs sub")
-                      (string-append (search-input-file inputs "/bin/btrfs")
-                                     " sub"))))))))
-    (inputs (list btrfs-progs cityhash util-linux))
+                   (wrap-script (string-append #$output "/sbin/beesd")
+                     `("PATH" suffix
+                       ,(map (lambda (program)
+                               (dirname (search-input-file
+                                         inputs (string-append "/bin/" program))))
+                             '("btrfs" "grep" "sed"
+                               ;; Provided by `util-linux`:
+                               "uuidparse"
+                               ;; Provided by `coreutils`:
+                               ;;  "chmod" "cut" "du" "false" "head" "mkdir"
+                               ;;  "mount" "realpath" "rm" "touch" "true"
+                               "truncate")))))))))
+    (inputs (list btrfs-progs cityhash guile-3.0 util-linux))
     (home-page "https://github.com/Zygo/bees")
     (synopsis "Deduplication agent for btrfs file systems")
     (description
-- 
2.40.1