about summary refs log tree commit diff
diff options
context:
space:
mode:
authorajs124 <git@ajs124.de>2020-04-30 02:29:10 +0200
committerajs124 <git@ajs124.de>2020-05-01 15:24:44 +0200
commitac8066c144c76dfbc99a866049b61acaaccb470f (patch)
tree70c687102b1a4abcf10b6f81e30d1f513807d588
parent53b474b5a5e319ce69bdd40933b2d7b6715b66e2 (diff)
memtest86-efi: replace p7zip with mtools
and dd
-rw-r--r--pkgs/tools/misc/memtest86-efi/default.nix14
1 files changed, 7 insertions, 7 deletions
diff --git a/pkgs/tools/misc/memtest86-efi/default.nix b/pkgs/tools/misc/memtest86-efi/default.nix
index 9f029ee5ded33..f2adadc0840b7 100644
--- a/pkgs/tools/misc/memtest86-efi/default.nix
+++ b/pkgs/tools/misc/memtest86-efi/default.nix
@@ -1,4 +1,4 @@
-{ fetchzip, lib, p7zip, stdenv }:
+{ fetchzip, lib, stdenv, mtools }:
 
 stdenv.mkDerivation rec {
   pname = "memtest86-efi";
@@ -22,19 +22,19 @@ stdenv.mkDerivation rec {
     stripRoot = false;
   };
 
-  nativeBuildInputs = [ p7zip ];
+  nativeBuildInputs = [ mtools ];
 
   installPhase = ''
-    mkdir -p $out
+    mkdir -p $out $TEMP/memtest86-files
 
     # memtest86 is distributed as a bootable USB image.  It contains the actual
     # memtest86 EFI app.
     #
-    # The following command uses p7zip to extract the actual EFI app from the
+    # The following uses dd and mcopy to extract the actual EFI app from the
     # usb image so that it can be installed directly on the hard drive.
-    7z x -o$TEMP/temp-efi-dirs $src/memtest86-usb.img
-    7z x -o$TEMP/memtest86-files $TEMP/temp-efi-dirs/EFI\ System\ Partition.img
-    cp -r $TEMP/memtest86-files/EFI/BOOT/* $out/
+    dd if=$src/memtest86-usb.img of=$TEMP/ESP.img skip=2048
+    mcopy -i $TEMP/ESP.img ::/EFI/BOOT/ $TEMP/memtest86-files/
+    mv $TEMP/memtest86-files/BOOT/* $out/
   '';
 
   meta = with lib; {