quickemu: 2.2.7 -> 3.11

- updated project URL
- add testVersion
- add OVMF.fd and patch detection of paths
- patch quickemu to ensure writeable efi_vars
This commit is contained in:
0x4A6F 2021-12-07 12:49:40 +01:00
parent e98afa97d3
commit 1ea561212a
No known key found for this signature in database
GPG Key ID: 8DEDBA5BE07080E1
3 changed files with 62 additions and 8 deletions

View File

@ -17,6 +17,9 @@
, xdg-user-dirs
, xrandr
, zsync
, OVMF
, quickemu
, testVersion
}:
let
runtimePaths = [
@ -40,15 +43,20 @@ in
stdenv.mkDerivation rec {
pname = "quickemu";
version = "2.2.7";
version = "3.11";
src = fetchFromGitHub {
owner = "wimpysworld";
repo = pname;
owner = "quickemu-project";
repo = "quickemu";
rev = version;
sha256 = "sha256-TNG1pCePsi12QQafhayhj+V5EXq+v7qmaW5v5X8ER6s=";
sha256 = "1xwf9vwbr57wmyxfcqzl1jnmfx3ffh7sfqf0zcdq41wqkm8s106n";
};
patches = [
./efi_vars_ensure_writable.patch
./input_overrides.patch
];
nativeBuildInputs = [ makeWrapper ];
installPhase = ''
@ -56,16 +64,21 @@ stdenv.mkDerivation rec {
install -Dm755 -t "$out/bin" quickemu quickget macrecovery
for f in quickget macrecovery quickemu; do
wrapProgram $out/bin/$f --prefix PATH : "${lib.makeBinPath runtimePaths}"
done
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"
done
runHook postInstall
'';
passthru.tests = testVersion { package = quickemu; };
meta = with lib; {
description = "Quickly create and run optimised Windows, macOS and Linux desktop virtual machines";
homepage = "https://github.com/wimpysworld/quickemu";
homepage = "https://github.com/quickemu-project/quickemu";
license = licenses.mit;
maintainers = with maintainers; [ fedx-sudo ];
};

View File

@ -0,0 +1,13 @@
diff --git a/quickemu b/quickemu
index a9a60a5..1a932ac 100755
--- a/quickemu
+++ b/quickemu
@@ -197,7 +197,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

View File

@ -0,0 +1,28 @@
diff --git a/quickemu b/quickemu
index 1a932ac..ab2f752 100755
--- a/quickemu
+++ b/quickemu
@@ -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
@@ -402,7 +405,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