datasone / setup_var.efi

UEFI command-line tool for read/write access of variables
Apache License 2.0
239 stars 9 forks source link

Feature request: Only write value if necessary #6

Closed cosmicdan closed 1 year ago

cosmicdan commented 1 year ago

G'day and thank you very much for this. For my laptop which randomly likes to reset CFG Lock and such, this has been a lifesaver - my rEFInd bootloader entries are now using .nsh scripts that perform my desired setup_var calls then load a Linux kernel/Windows bootmgr/whatever, ensuring that every boot will have my ideal UEFI vars set.

I am worried, however, that these values are being written on every boot, even if it's not necessary. I can't imagine UEFI storage (nvram?) is designed to be especially durable....

...so, with that said, it would be really great if the tool could read the existing value, and ONLY write your value if it's actually different. Just to save unnecessary writes.

Thanks for your consideration!

datasone commented 1 year ago

I think flash ROMs being used nowadays could handle much writes... Anyway, an option named --write_on_demand has been added in 0.2.0.