From 584a111fe1e81b44b56df6ab2cbc2fc46d39555c Mon Sep 17 00:00:00 2001 From: linsui Date: Thu, 22 Sep 2022 17:16:24 +0800 Subject: [PATCH] quickemu: 4.0 -> 4.3 --- pkgs/development/quickemu/default.nix | 31 ++++++++++------ .../quickemu/input_overrides.patch | 37 ------------------- 2 files changed, 20 insertions(+), 48 deletions(-) delete mode 100644 pkgs/development/quickemu/input_overrides.patch diff --git a/pkgs/development/quickemu/default.nix b/pkgs/development/quickemu/default.nix index c2f360fc0cf5..956ccabffb19 100644 --- a/pkgs/development/quickemu/default.nix +++ b/pkgs/development/quickemu/default.nix @@ -4,6 +4,7 @@ , makeWrapper , qemu , gnugrep +, gnused , lsb-release , jq , procps @@ -11,13 +12,16 @@ , cdrtools , usbutils , util-linux +, socat , spice-gtk , swtpm +, unzip , wget , xdg-user-dirs , xrandr , zsync , OVMF +, OVMFFull , quickemu , testers }: @@ -25,6 +29,7 @@ let runtimePaths = [ qemu gnugrep + gnused jq lsb-release procps @@ -32,6 +37,8 @@ let cdrtools usbutils util-linux + unzip + socat spice-gtk swtpm wget @@ -43,31 +50,33 @@ in stdenv.mkDerivation rec { pname = "quickemu"; - version = "4.0"; + version = "4.3"; src = fetchFromGitHub { owner = "quickemu-project"; repo = "quickemu"; rev = version; - sha256 = "sha256-CiCQg1UsSAwlEnZEmzU2ynn2RZ+wXPv9FV1b9GVkc00="; + hash = "sha256-+ksv1DBNby3bJx2ylnDkqlQfsFIDRS/hZvsJn2+bcz8="; }; - patches = [ - ./input_overrides.patch - ]; + postPatch = '' + sed -i \ + -e '/OVMF_CODE_4M.secboot.fd/s|ovmfs=(|ovmfs=("${OVMFFull.fd}/FV/OVMF_CODE.fd","${OVMFFull.fd}/FV/OVMF_VARS.fd" |' \ + -e '/OVMF_CODE_4M.fd/s|ovmfs=(|ovmfs=("${OVMF.fd}/FV/OVMF_CODE.fd","${OVMF.fd}/FV/OVMF_VARS.fd" |' \ + -e '/cp "''${VARS_IN}" "''${VARS_OUT}"/a chmod +w "''${VARS_OUT}"' \ + -e 's/Icon=.*qemu.svg/Icon=qemu/' \ + quickemu + ''; nativeBuildInputs = [ makeWrapper ]; installPhase = '' runHook preInstall - install -Dm755 -t "$out/bin" quickemu quickget macrecovery + install -Dm755 -t "$out/bin" macrecovery quickemu quickget windowskey - for f in quickget macrecovery quickemu; do - wrapProgram $out/bin/$f \ - --prefix PATH : "${lib.makeBinPath runtimePaths}" \ - --set ENV_EFI_CODE "${OVMF.fd}/FV/OVMF_CODE.fd" \ - --set ENV_EFI_VARS "${OVMF.fd}/FV/OVMF_VARS.fd" + for f in macrecovery quickget quickemu windowskey; do + wrapProgram $out/bin/$f --prefix PATH : "${lib.makeBinPath runtimePaths}" done runHook postInstall diff --git a/pkgs/development/quickemu/input_overrides.patch b/pkgs/development/quickemu/input_overrides.patch deleted file mode 100644 index 42e4d2e18294..000000000000 --- a/pkgs/development/quickemu/input_overrides.patch +++ /dev/null @@ -1,37 +0,0 @@ -diff --git a/quickemu b/quickemu -index 24e1007..39cd5e4 100755 ---- a/quickemu -+++ b/quickemu -@@ -196,7 +196,7 @@ function efi_vars() { - - if [ ! -e "${VARS_OUT}" ]; then - if [ -e "${VARS_IN}" ]; then -- cp "${VARS_IN}" "${VARS_OUT}" -+ cp "${VARS_IN}" "${VARS_OUT}" && chmod +w "${VARS_OUT}" - else - echo "ERROR! ${VARS_IN} was not found. Please install edk2." - exit 1 -@@ -383,7 +383,10 @@ function vm_boot() { - # https://bugzilla.redhat.com/show_bug.cgi?id=1929357#c5 - case ${secureboot} in - on) -- if [ -e "/usr/share/OVMF/OVMF_CODE_4M.secboot.fd" ]; then -+ if [[ ${ENV_EFI_CODE_SECURE} && ${ENV_EFI_CODE_SECURE-x} ]] && [[ ${ENV_EFI_VARS_SECURE} && ${ENV_EFI_VARS_SECURE-x} ]]; then -+ EFI_CODE="${ENV_EFI_CODE_SECURE}" -+ efi_vars "${ENV_EFI_VARS_SECURE}" "${EFI_VARS}" -+ elif [ -e "/usr/share/OVMF/OVMF_CODE_4M.secboot.fd" ]; then - EFI_CODE="/usr/share/OVMF/OVMF_CODE_4M.secboot.fd" - efi_vars "/usr/share/OVMF/OVMF_VARS_4M.fd" "${EFI_VARS}" - elif [ -e "/usr/share/edk2/ovmf/OVMF_CODE.secboot.fd" ]; then -@@ -408,7 +411,10 @@ function vm_boot() { - fi - ;; - *) -- if [ -e "/usr/share/OVMF/OVMF_CODE_4M.fd" ]; then -+ if [[ ${ENV_EFI_CODE} && ${ENV_EFI_CODE-x} ]] && [[ ${ENV_EFI_VARS} && ${ENV_EFI_VARS-x} ]]; then -+ EFI_CODE="${ENV_EFI_CODE}" -+ efi_vars "${ENV_EFI_VARS}" "${EFI_VARS}" -+ elif [ -e "/usr/share/OVMF/OVMF_CODE_4M.fd" ]; then - EFI_CODE="/usr/share/OVMF/OVMF_CODE_4M.fd" - efi_vars "/usr/share/OVMF/OVMF_VARS_4M.fd" "${EFI_VARS}" - elif [ -e "/usr/share/edk2/ovmf/OVMF_CODE.fd" ]; then