Skip to content

Commit

Permalink
luci-app-attendedsysupgrade: Fix logic error in EFI image selection
Browse files Browse the repository at this point in the history
If a non-EFI image comes first in the list of images, it would have
been selected even on an EFI system.

Signed-off-by: Jakob Haufe <sur5r@sur5r.net>
  • Loading branch information
sur5r authored and aparcar committed Feb 5, 2024
1 parent 1e1c6b8 commit cb45737
Showing 1 changed file with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,24 +85,24 @@ return view.extend({
},

selectImage: function (images) {
let image;
for (image of images) {
if (this.firmware.filesystem == image.filesystem) {
let firmware = this.firmware;
let data = this.data;
var filesystemFilter = function(e) {
return (e.filesystem == firmware.filesystem);
}
var typeFilter = function(e) {
if (firmware.target.indexOf("x86") != -1) {
// x86 images can be combined-efi (EFI) or combined (BIOS)
if(this.firmware.target.indexOf("x86") != -1) {
if (this.data.efi && image.type == 'combined-efi') {
return image;
} else if (image.type == 'combined') {
return image;
}
if (data.efi) {
return (e.type == 'combined-efi');
} else {
if (image.type == 'sysupgrade' || image.type == 'combined') {
return image;
}
return (e.type == 'combined');
}
} else {
return (e.type == 'sysupgrade' || e.type == 'combined');
}
}
return null;
return images.filter(filesystemFilter).filter(typeFilter)[0];
},

handle200: function (response) {
Expand Down

0 comments on commit cb45737

Please sign in to comment.