2021-02-05 17:12:51 +00:00
|
|
|
{ lib, stdenv, runCommand }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
let
|
|
|
|
bad-shebang = stdenv.mkDerivation {
|
|
|
|
name = "bad-shebang";
|
|
|
|
dontUnpack = true;
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/bin
|
|
|
|
echo "#!/bin/sh" > $out/bin/test
|
|
|
|
echo "echo -n hello" >> $out/bin/test
|
|
|
|
chmod +x $out/bin/test
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
in runCommand "patch-shebangs-test" {
|
|
|
|
passthru = { inherit bad-shebang; };
|
2021-02-05 17:12:51 +00:00
|
|
|
meta.platforms = lib.platforms.all;
|
2020-04-24 23:36:52 +00:00
|
|
|
} ''
|
|
|
|
printf "checking whether patchShebangs works properly... ">&2
|
|
|
|
if ! grep -q '^#!/bin/sh' ${bad-shebang}/bin/test; then
|
|
|
|
echo "yes" >&2
|
|
|
|
touch $out
|
|
|
|
else
|
|
|
|
echo "no" >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
''
|