summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2023-08-22 10:20:11 +0200
committerLudovic Courtès <ludo@gnu.org>2023-08-22 11:17:53 +0200
commit6fc754c2d670d49f5a843d4b36729af95cf02d18 (patch)
treee1930a4c743b144b4fc3346b6344913a0fc7fbad
parent91bef86aa2bd7d94c60fc06f7527216b625b857a (diff)
downloadguix-6fc754c2d670d49f5a843d4b36729af95cf02d18.tar.gz
services: file-database: Set 'PATH' for 'updatedb'.
Previously 'updatedb' would fail to find 'sed', 'rm', etc.

* gnu/services/admin.scm (file-database-mcron-jobs): Set PATH before
invoking 'updatedb'.
-rw-r--r--gnu/services/admin.scm21
1 files changed, 15 insertions, 6 deletions
diff --git a/gnu/services/admin.scm b/gnu/services/admin.scm
index edd8ce59da..fa2407ed84 100644
--- a/gnu/services/admin.scm
+++ b/gnu/services/admin.scm
@@ -22,7 +22,7 @@
 (define-module (gnu services admin)
   #:use-module (gnu packages admin)
   #:use-module ((gnu packages base)
-                #:select (canonical-package findutils))
+                #:select (canonical-package findutils coreutils sed))
   #:use-module (gnu packages certs)
   #:use-module (gnu packages package-management)
   #:use-module (gnu services)
@@ -330,11 +330,20 @@ is passed to the @option{--prunepaths} option of
     (package schedule excluded-directories)
     (let ((updatedb (program-file
                      "updatedb"
-                     #~(execl #$(file-append package "/bin/updatedb")
-                              "updatedb"
-                              #$(string-append "--prunepaths="
-                                               (string-join
-                                                excluded-directories))))))
+                     #~(begin
+                         ;; 'updatedb' is a shell script that expects various
+                         ;; commands in $PATH.
+                         (setenv "PATH"
+                                 (string-append #$package "/bin:"
+                                                #$(canonical-package coreutils)
+                                                "/bin:"
+                                                #$(canonical-package sed)
+                                                "/bin"))
+                         (execl #$(file-append package "/bin/updatedb")
+                                "updatedb"
+                                #$(string-append "--prunepaths="
+                                                 (string-join
+                                                  excluded-directories)))))))
       (list #~(job #$schedule #$updatedb)))))
 
 (define file-database-service-type