Merge pull request #191747 from linsui/quickemu

quickemu: 4.0 -> 4.3
This commit is contained in:
Jonas Heinrich 2022-09-22 12:15:58 +02:00 committed by GitHub
commit 12305aeeb8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 48 deletions

View file

@ -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

View file

@ -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