duperemove: encode absolute path to lscpu

Without the change `duperemove` fails to run in parallel
if `PATH` is missing `lscpu` as:

    $ PATH= ./result/bin/duperemove /tmp
    sh: line 1: lscpu: No such file or directory
    Gathering file list...
    No dedupe candidates found.

Noticed when wrote a minimal systemd timer for `duperemove`.
This commit is contained in:
Sergei Trofimovich 2023-08-12 09:59:44 +01:00
parent 7ad1b2d4e1
commit b3218a102f

View File

@ -1,5 +1,6 @@
{ lib, stdenv, fetchFromGitHub, libgcrypt
, pkg-config, glib, linuxHeaders ? stdenv.cc.libc.linuxHeaders, sqlite }:
, pkg-config, glib, linuxHeaders ? stdenv.cc.libc.linuxHeaders, sqlite
, util-linux }:
stdenv.mkDerivation rec {
pname = "duperemove";
@ -12,6 +13,11 @@ stdenv.mkDerivation rec {
sha256 = "sha256-WjUM52IqMDvBzeGHo7p4JcvMO5iPWPVOr8GJ3RSsnUs=";
};
postPatch = ''
substituteInPlace util.c --replace \
"lscpu" "${lib.getBin util-linux}/bin/lscpu"
'';
nativeBuildInputs = [ pkg-config ];
buildInputs = [ libgcrypt glib linuxHeaders sqlite ];