Unverified Commit bcaf2626 authored by Franz Pletz's avatar Franz Pletz Committed by GitHub
Browse files

Merge pull request #312286 from onemoresuza/haredo-patch-sh

haredo: remove shell wrapper
parents d2732bb3 b155c656
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
diff --git a/src/haredo.ha b/src/haredo.ha
index c2e56e6..304c9ad 100644
--- a/src/haredo.ha
+++ b/src/haredo.ha
@@ -280,12 +280,12 @@ fn try_do(
 	const tmpfilepath = strings::concat(ctx.tmpdir, "/", tmpfilename);
 
 	const cmd = if (ctx.verbose) {
-		fmt::errorln("* sh -ev", dopaths.do, dopaths.target,
+		fmt::errorln("* @bash@/bin/sh -ev", dopaths.do, dopaths.target,
 			dopaths.basename, tmpfilepath)?;
-		yield exec::cmd("sh", "-ev", dopaths.do, dopaths.target,
+		yield exec::cmd("@bash@/bin/sh", "-ev", dopaths.do, dopaths.target,
 			dopaths.basename, tmpfilepath)?;
 	} else {
-		yield exec::cmd("sh", "-e", dopaths.do, dopaths.target,
+		yield exec::cmd("@bash@/bin/sh", "-e", dopaths.do, dopaths.target,
 			dopaths.basename, tmpfilepath)?;
 	};
 
+22 −14
Original line number Diff line number Diff line
{ stdenv
, lib
, fetchFromSourcehut
, hare
, scdoc
, nix-update-script
, makeWrapper
, bash
{
  stdenv,
  lib,
  fetchFromSourcehut,
  hare,
  scdoc,
  nix-update-script,
  makeWrapper,
  bash,
  substituteAll,
}:
stdenv.mkDerivation (finalAttrs: {
  pname = "haredo";
  version = "1.0.5";

  outputs = [ "out" "man" ];
  outputs = [
    "out"
    "man"
  ];

  src = fetchFromSourcehut {
    owner = "~autumnull";
@@ -20,6 +25,14 @@ stdenv.mkDerivation (finalAttrs: {
    hash = "sha256-gpui5FVRw3NKyx0AB/4kqdolrl5vkDudPOgjHc/IE4U=";
  };

  patches = [
    # Use nix store's bash instead of sh. `@bash@/bin/sh` is used, since haredo expects a posix shell.
    (substituteAll {
      src = ./001-use-nix-store-sh.patch;
      inherit bash;
    })
  ];

  nativeBuildInputs = [
    hare
    makeWrapper
@@ -62,11 +75,6 @@ stdenv.mkDerivation (finalAttrs: {
    runHook postInstall
  '';

  postFixup = ''
    wrapProgram $out/bin/haredo \
      --prefix PATH : "${lib.makeBinPath [bash]}"
  '';

  setupHook = ./setup-hook.sh;

  passthru.updateScript = nix-update-script { };