Unverified Commit 6b24ae90 authored by Kroese's avatar Kroese Committed by GitHub
Browse files

fix: Use temporary file when extracting ROM (#930)

parent ba2d1713
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -74,16 +74,17 @@ case "${BOOT_MODE,,}" in
    if [ ! -s "$DEST.rom" ] || [ ! -f "$DEST.rom" ]; then
      [ ! -s "$OVMF/$ROM" ] || [ ! -f "$OVMF/$ROM" ] && error "UEFI boot file ($OVMF/$ROM) not found!" && exit 44
      if [[ "${LOGO:-}" == [Nn]* ]]; then
        cp "$OVMF/$ROM" "$DEST.rom"
        cp "$OVMF/$ROM" "$DEST.tmp"
      else
        /run/utk.bin "$OVMF/$ROM" replace_ffs LogoDXE "/var/www/img/${PROCESS,,}.ffs" save "$DEST.tmp"
        mv "$DEST.tmp" "$DEST.rom"
      fi
      mv "$DEST.tmp" "$DEST.rom"
    fi

    if [ ! -s "$DEST.vars" ] || [ ! -f "$DEST.vars" ]; then
      [ ! -s "$OVMF/$VARS" ] || [ ! -f "$OVMF/$VARS" ]&& error "UEFI vars file ($OVMF/$VARS) not found!" && exit 45
      cp "$OVMF/$VARS" "$DEST.vars"
      cp "$OVMF/$VARS" "$DEST.tmp"
      mv "$DEST.tmp" "$DEST.vars"
    fi

    if [[ "${BOOT_MODE,,}" == "secure" || "${BOOT_MODE,,}" == "windows_secure" ]]; then