mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-13 01:10:19 -04:00
Merge pull request #2118 from payonel/openloader-installer
make openloader installer compatable with openos install tool
This commit is contained in:
commit
1d5c69924f
@ -0,0 +1 @@
|
|||||||
|
os.execute(install.from .. "/bin/opl-flash.lua")
|
@ -142,25 +142,25 @@ local term = require "term"
|
|||||||
local args, options = shell.parse(...)
|
local args, options = shell.parse(...)
|
||||||
|
|
||||||
if options.h or options.help then
|
if options.h or options.help then
|
||||||
print("opl-flash [-hqr] [--label=EEPROMLabel]")
|
print("opl-flash [-hqr] [--label=EEPROMLabel]")
|
||||||
print(" --label= Set specified label for the EEPROM")
|
print(" --label= Set specified label for the EEPROM")
|
||||||
print(" -q --quiet Do not output anything, and don't ask if sure")
|
print(" -q --quiet Do not output anything, and don't ask if sure")
|
||||||
print(" -r --reboot Reboot after installing")
|
print(" -r --reboot Reboot after installing")
|
||||||
print(" -h --help Display this help")
|
print(" -h --help Display this help")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local say = not (options.q or options.quiet) and print or function()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]")
|
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
|
if options.q or options.quiet or ((io.read() or "n").."y"):match("^%s*[Yy]") then
|
||||||
say("Flashing... Do not reboot now!")
|
say("Flashing... Do not reboot now!")
|
||||||
component.eeprom.set(eeprom)
|
component.eeprom.set(eeprom)
|
||||||
component.eeprom.setLabel((type(options.label) == "string" and options.label) or version)
|
component.eeprom.setLabel((type(options.label) == "string" and options.label) or version)
|
||||||
if options.r or options.reboot then
|
if options.r or options.reboot then
|
||||||
computer.shutdown(true)
|
computer.shutdown(true)
|
||||||
else
|
else
|
||||||
say("Done. you can reboot now")
|
say("Done. you can reboot now")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user