diff --git a/src/main/resources/assets/opencomputers/loot/openloader/.install b/src/main/resources/assets/opencomputers/loot/openloader/.install new file mode 100644 index 000000000..a2fc18674 --- /dev/null +++ b/src/main/resources/assets/opencomputers/loot/openloader/.install @@ -0,0 +1 @@ +os.execute(install.from .. "/bin/opl-flash.lua") diff --git a/src/main/resources/assets/opencomputers/loot/openloader/bin/opl-flash.lua b/src/main/resources/assets/opencomputers/loot/openloader/bin/opl-flash.lua index a8de2204e..9ed64f54d 100644 --- a/src/main/resources/assets/opencomputers/loot/openloader/bin/opl-flash.lua +++ b/src/main/resources/assets/opencomputers/loot/openloader/bin/opl-flash.lua @@ -142,25 +142,25 @@ local term = require "term" local args, options = shell.parse(...) if options.h or options.help then - print("opl-flash [-hqr] [--label=EEPROMLabel]") - print(" --label= Set specified label for the EEPROM") - print(" -q --quiet Do not output anything, and don't ask if sure") - print(" -r --reboot Reboot after installing") - print(" -h --help Display this help") - return + print("opl-flash [-hqr] [--label=EEPROMLabel]") + print(" --label= Set specified label for the EEPROM") + print(" -q --quiet Do not output anything, and don't ask if sure") + print(" -r --reboot Reboot after installing") + print(" -h --help Display this help") + return end local say = not (options.q or options.quiet) and print or function()end say ("Do you really want to flash openloader to EEPROM("..tostring(#eeprom).." bytes)[Y/n]") -if options.q or options.quiet or io.read():lower() == "y" then - say("Flashing... Do not reboot now!") - component.eeprom.set(eeprom) - component.eeprom.setLabel((type(options.label) == "string" and options.label) or version) - if options.r or options.reboot then - computer.shutdown(true) - else - say("Done. you can reboot now") - end +if options.q or options.quiet or ((io.read() or "n").."y"):match("^%s*[Yy]") then + say("Flashing... Do not reboot now!") + component.eeprom.set(eeprom) + component.eeprom.setLabel((type(options.label) == "string" and options.label) or version) + if options.r or options.reboot then + computer.shutdown(true) + else + say("Done. you can reboot now") + end end