From 923951e500821ef74b552a601ba6a6f83c015dcd Mon Sep 17 00:00:00 2001 From: KSJ2000 Date: Tue, 15 Oct 2024 14:33:53 +0300 Subject: [PATCH] dumpifs: init at 0-unstable-2020-05-07 --- pkgs/by-name/du/dumpifs/package.nix | 72 +++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 pkgs/by-name/du/dumpifs/package.nix diff --git a/pkgs/by-name/du/dumpifs/package.nix b/pkgs/by-name/du/dumpifs/package.nix new file mode 100644 index 00000000000000..57003f6f19fab7 --- /dev/null +++ b/pkgs/by-name/du/dumpifs/package.nix @@ -0,0 +1,72 @@ +{ + clang, + fetchFromGitHub, + lib, + lzo, + lz4, + stdenv, + ucl, + unstableGitUpdater, + zlib, +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "dumpifs"; + version = "0-unstable-2020-05-07"; + + src = fetchFromGitHub { + owner = "askac"; + repo = "dumpifs"; + rev = "b7bac90e8312eca2796f2003a52791899eb8dcd9"; + hash = "sha256-vFiMKcPfowLQQZXlXbq5ZR1X6zr7u3iQwz3o4A6aQMY="; + }; + + buildInputs = [ + clang + lzo + lz4 + ucl + zlib + ]; + + postUnpack = '' + rm source/{dumpifs,exMifsLzo,uuu,zzz} + ''; + + preBuild = '' + #FIX LINUX BUILD ERRORS + sed -i '10i #include ' fixdecifs.c + sed -i '6i #include ' fixencifs.c + sed -i '/error(1/{N; d;}' exMifsLzo.c + sed -i '76i fprintf(stderr, "decompression init failure"); exit(1);' exMifsLzo.c + + #FIX MAC BUILD ERRORS + sed -i '/#include /d' uuu.c + sed -i '9i #include ' uuu.c + sed -i '/error(1/{N; d;}' uuu.c + sed -i '41i fprintf(stderr, "compression failure.\\n"); exit(1);' uuu.c + + sed -i '/#include /d' zzz.c + sed -i '9i #include ' zzz.c + sed -i '/error(1/{N; d;}' zzz.c + sed -i '43i fprintf(stderr, "compression failure.\\n"); exit(1);' zzz.c + ''; + + installPhase = '' + runHook preInstall + + install -D dumpifs exMifsLz4 exMifsLzo fixdecifs fixencifs uuu zzz -t $out/bin + + runHook postInstall + ''; + + passthru.updateScript = unstableGitUpdater { }; + + meta = { + description = "Tool for those who are interested in hacking MIB2 firmware"; + homepage = "https://github.com/askac/dumpifs"; + platforms = lib.platforms.unix; + maintainers = with lib.maintainers; [ KSJ2000 ]; + mainProgram = "dumpifs"; + }; +})