mirror of
https://github.com/IgorTimofeev/MineOS.git
synced 2026-09-12 19:51:02 +05:00
Фиксанул setLabel на tmpfs
This commit is contained in:
parent
24c9cffe32
commit
68690b5bfc
562
EFI/Full.lua
562
EFI/Full.lua
@ -21,7 +21,23 @@ local
|
||||
colorsBackground,
|
||||
colorsText,
|
||||
colorsSelectionBackground,
|
||||
colorsSelectionText =
|
||||
colorsSelectionText,
|
||||
|
||||
OSList,
|
||||
bindGPUToScreen,
|
||||
drawRectangle,
|
||||
drawText,
|
||||
newMenuElement,
|
||||
runLoop,
|
||||
drawCentrizedText,
|
||||
drawTitle,
|
||||
status,
|
||||
executeString,
|
||||
boot,
|
||||
newMenuBackElement,
|
||||
menu,
|
||||
input,
|
||||
internetExecute =
|
||||
|
||||
"MineOS EFI",
|
||||
"Change label",
|
||||
@ -58,7 +74,6 @@ local
|
||||
local
|
||||
gpuSet,
|
||||
gpuSetBackground,
|
||||
gpuSetForeground,
|
||||
gpuFill,
|
||||
eepromSetData,
|
||||
eepromGetData,
|
||||
@ -67,73 +82,84 @@ local
|
||||
|
||||
gpu.set,
|
||||
gpu.setBackground,
|
||||
gpu.setForeground,
|
||||
gpu.fill,
|
||||
eeprom.setData,
|
||||
eeprom.getData,
|
||||
gpu.getResolution()
|
||||
|
||||
local
|
||||
OSList,
|
||||
bindGPUToScreen,
|
||||
rectangle,
|
||||
centrizedText,
|
||||
menuElement,
|
||||
runLoop =
|
||||
OSList,
|
||||
bindGPUToScreen,
|
||||
drawRectangle,
|
||||
drawText,
|
||||
newMenuElement,
|
||||
runLoop,
|
||||
drawCentrizedText,
|
||||
drawTitle,
|
||||
status,
|
||||
executeString,
|
||||
boot,
|
||||
newMenuBackElement,
|
||||
menu,
|
||||
input,
|
||||
internetExecute =
|
||||
|
||||
{
|
||||
{
|
||||
{
|
||||
"/OS.lua"
|
||||
},
|
||||
{
|
||||
"/init.lua",
|
||||
function()
|
||||
computer.getBootAddress, computer.setBootAddress = eepromGetData, eepromSetData
|
||||
end
|
||||
}
|
||||
"/OS.lua"
|
||||
},
|
||||
|
||||
function()
|
||||
local screenAddress = componentList("screen")()
|
||||
|
||||
if screenAddress then
|
||||
gpu.bind(screenAddress, true)
|
||||
{
|
||||
"/init.lua",
|
||||
function()
|
||||
computer.getBootAddress, computer.setBootAddress = eepromGetData, eepromSetData
|
||||
end
|
||||
end,
|
||||
}
|
||||
},
|
||||
|
||||
function(x, y, width, height, color)
|
||||
gpuSetBackground(color)
|
||||
gpuFill(x, y, width, height, " ")
|
||||
end,
|
||||
|
||||
function(y, foreground, text)
|
||||
gpuSetForeground(foreground)
|
||||
gpuSet(mathFloor(screenWidth / 2 - #text / 2), y, text)
|
||||
end,
|
||||
|
||||
function(text, callback, breakLoop)
|
||||
return {
|
||||
s = text,
|
||||
c = callback,
|
||||
b = breakLoop
|
||||
}
|
||||
end,
|
||||
|
||||
function(func, ...)
|
||||
while func({ pullSignal(...) }) == nil do
|
||||
|
||||
end
|
||||
function()
|
||||
local screenAddress = componentList("screen")()
|
||||
|
||||
if screenAddress then
|
||||
gpu.bind(screenAddress, true)
|
||||
end
|
||||
end,
|
||||
|
||||
local function drawTitle(y, title)
|
||||
function(x, y, width, height, color)
|
||||
gpuSetBackground(color)
|
||||
gpuFill(x, y, width, height, " ")
|
||||
end,
|
||||
|
||||
function(x, y, foreground, text)
|
||||
gpu.setForeground(foreground)
|
||||
gpuSet(x, y, text)
|
||||
end,
|
||||
|
||||
function(text, callback, breakLoop)
|
||||
return {
|
||||
s = text,
|
||||
c = callback,
|
||||
b = breakLoop
|
||||
}
|
||||
end,
|
||||
|
||||
function(func, ...)
|
||||
while func({ pullSignal(...) }) == nil do
|
||||
|
||||
end
|
||||
end,
|
||||
|
||||
function(y, foreground, text)
|
||||
drawText(mathFloor(screenWidth / 2 - #text / 2), y, foreground, text)
|
||||
end,
|
||||
|
||||
function(y, title)
|
||||
y = mathFloor(screenHeight / 2 - y / 2)
|
||||
rectangle(1, 1, screenWidth, screenHeight, colorsBackground)
|
||||
centrizedText(y, colorsTitle, title)
|
||||
drawRectangle(1, 1, screenWidth, screenHeight, colorsBackground)
|
||||
drawCentrizedText(y, colorsTitle, title)
|
||||
|
||||
return y + 2
|
||||
end
|
||||
end,
|
||||
|
||||
local function status(statusText, needWait)
|
||||
function(statusText, needWait)
|
||||
local lines = {}
|
||||
|
||||
for line in statusText:gmatch("[^\r\n]+") do
|
||||
@ -143,7 +169,7 @@ local function status(statusText, needWait)
|
||||
local y = drawTitle(#lines, stringsMineOSEFI)
|
||||
|
||||
for i = 1, #lines do
|
||||
centrizedText(y, colorsText, lines[i])
|
||||
drawCentrizedText(y, colorsText, lines[i])
|
||||
y = y + 1
|
||||
end
|
||||
|
||||
@ -152,9 +178,9 @@ local function status(statusText, needWait)
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end,
|
||||
|
||||
local function executeString(...)
|
||||
function(...)
|
||||
local result, reason = load(...)
|
||||
|
||||
if result then
|
||||
@ -166,212 +192,207 @@ local function executeString(...)
|
||||
end
|
||||
|
||||
status(reason, 1)
|
||||
end
|
||||
end,
|
||||
|
||||
local
|
||||
boot,
|
||||
menuBack,
|
||||
menu,
|
||||
input,
|
||||
internetExecute =
|
||||
function(proxy)
|
||||
local OS
|
||||
|
||||
function(proxy)
|
||||
local OS
|
||||
for i = 1, #OSList do
|
||||
OS = OSList[i]
|
||||
|
||||
for i = 1, #OSList do
|
||||
OS = OSList[i]
|
||||
if proxy.exists(OS[1]) then
|
||||
status("Booting from " .. (proxy.getLabel() or proxy.address))
|
||||
|
||||
if proxy.exists(OS[1]) then
|
||||
status("Booting from " .. (proxy.getLabel() or proxy.address))
|
||||
|
||||
-- Updating current EEPROM boot address if it's differs from given proxy address
|
||||
if eepromGetData() ~= proxy.address then
|
||||
eepromSetData(proxy.address)
|
||||
end
|
||||
|
||||
-- Running OS pre-boot function
|
||||
if OS[2] then
|
||||
OS[2]()
|
||||
end
|
||||
|
||||
-- Reading boot file
|
||||
local handle, data, chunk, success, reason = proxy.open(OS[1], "rb"), ""
|
||||
|
||||
repeat
|
||||
chunk = proxy.read(handle, mathHuge)
|
||||
data = data .. (chunk or "")
|
||||
until not chunk
|
||||
|
||||
proxy.close(handle)
|
||||
|
||||
-- Running boot file
|
||||
executeString(data, "=" .. OS[1])
|
||||
|
||||
return 1
|
||||
end
|
||||
end
|
||||
end,
|
||||
|
||||
function(f)
|
||||
return menuElement("Back", f, 1)
|
||||
end,
|
||||
|
||||
function(title, elements)
|
||||
local selectedElement, maxLength = 1, 0
|
||||
|
||||
for i = 1, #elements do
|
||||
maxLength = math.max(maxLength, #elements[i].s)
|
||||
end
|
||||
|
||||
runLoop(function(e)
|
||||
local y, x = drawTitle(#elements + 2, title)
|
||||
|
||||
for i = 1, #elements do
|
||||
x = mathFloor(screenWidth / 2 - #elements[i].s / 2)
|
||||
|
||||
if i == selectedElement then
|
||||
rectangle(mathFloor(screenWidth / 2 - maxLength / 2) - 2, y, maxLength + 4, 1, colorsSelectionBackground)
|
||||
gpuSetForeground(colorsSelectionText)
|
||||
gpuSet(x, y, elements[i].s)
|
||||
gpuSetBackground(colorsBackground)
|
||||
else
|
||||
gpuSetForeground(colorsText)
|
||||
gpuSet(x, y, elements[i].s)
|
||||
end
|
||||
|
||||
y = y + 1
|
||||
-- Updating current EEPROM boot address if it's differs from given proxy address
|
||||
if eepromGetData() ~= proxy.address then
|
||||
eepromSetData(proxy.address)
|
||||
end
|
||||
|
||||
if e[1] == stringsKeyDown then
|
||||
if e[4] == 200 and selectedElement > 1 then
|
||||
selectedElement = selectedElement - 1
|
||||
|
||||
elseif e[4] == 208 and selectedElement < #elements then
|
||||
selectedElement = selectedElement + 1
|
||||
|
||||
elseif e[4] == 28 then
|
||||
if elements[selectedElement].c then
|
||||
elements[selectedElement].c()
|
||||
end
|
||||
|
||||
if elements[selectedElement].b then
|
||||
return 1
|
||||
end
|
||||
end
|
||||
|
||||
elseif e[1] == stringsComponentAdded and e[3] == "screen" then
|
||||
bindGPUToScreen()
|
||||
-- Running OS pre-boot function
|
||||
if OS[2] then
|
||||
OS[2]()
|
||||
end
|
||||
end)
|
||||
end,
|
||||
|
||||
function(title, prefix)
|
||||
local
|
||||
y,
|
||||
text,
|
||||
state,
|
||||
eblo,
|
||||
char =
|
||||
-- Reading boot file
|
||||
local handle, data, chunk, success, reason = proxy.open(OS[1], "rb"), ""
|
||||
|
||||
drawTitle(2, title),
|
||||
"",
|
||||
true
|
||||
repeat
|
||||
chunk = proxy.read(handle, mathHuge)
|
||||
data = data .. (chunk or "")
|
||||
until not chunk
|
||||
|
||||
local function draw()
|
||||
eblo = prefix .. text
|
||||
proxy.close(handle)
|
||||
|
||||
gpuFill(1, y, screenWidth, 1, " ")
|
||||
gpuSetForeground(colorsText)
|
||||
gpuSet(mathFloor(screenWidth / 2 - #eblo / 2), y, eblo .. (state and "█" or ""))
|
||||
end
|
||||
-- Running boot file
|
||||
executeString(data, "=" .. OS[1])
|
||||
|
||||
draw()
|
||||
|
||||
runLoop(
|
||||
function(e)
|
||||
if e[1] == stringsKeyDown then
|
||||
if e[4] == 28 then
|
||||
return 1
|
||||
|
||||
elseif e[4] == 14 then
|
||||
text = text:sub(1, -2)
|
||||
|
||||
else
|
||||
char = unicode.char(e[3])
|
||||
|
||||
if char:match("^[%w%d%p%s]+") then
|
||||
text = text .. char
|
||||
end
|
||||
end
|
||||
|
||||
state = true
|
||||
|
||||
elseif e[1] == "clipboard" then
|
||||
text = text .. e[3]
|
||||
|
||||
elseif not e[1] then
|
||||
state = not state
|
||||
end
|
||||
|
||||
draw()
|
||||
end,
|
||||
0.5
|
||||
)
|
||||
end,
|
||||
|
||||
function(url)
|
||||
local
|
||||
connection,
|
||||
data,
|
||||
result,
|
||||
reason =
|
||||
|
||||
componentProxy(internetAddress).request(url),
|
||||
""
|
||||
|
||||
if connection then
|
||||
status("Downloading script")
|
||||
|
||||
while 1 do
|
||||
result, reason = connection.read(mathHuge)
|
||||
|
||||
if result then
|
||||
data = data .. result
|
||||
else
|
||||
connection.close()
|
||||
|
||||
if reason then
|
||||
status(reason, 1)
|
||||
else
|
||||
executeString(data, "=url")
|
||||
end
|
||||
|
||||
break
|
||||
end
|
||||
end
|
||||
else
|
||||
status("Invalid URL", 1)
|
||||
return 1
|
||||
end
|
||||
end
|
||||
end,
|
||||
|
||||
function(f)
|
||||
return newMenuElement("Back", f, 1)
|
||||
end,
|
||||
|
||||
function(title, elements)
|
||||
local selectedElement, maxLength = 1, 0
|
||||
|
||||
for i = 1, #elements do
|
||||
maxLength = math.max(maxLength, #elements[i].s)
|
||||
end
|
||||
|
||||
runLoop(function(e)
|
||||
local y, x, text = drawTitle(#elements + 2, title)
|
||||
|
||||
for i = 1, #elements do
|
||||
text = " " .. elements[i].s .. " "
|
||||
x = mathFloor(screenWidth / 2 - #text / 2)
|
||||
|
||||
if i == selectedElement then
|
||||
gpuSetBackground(colorsSelectionBackground)
|
||||
drawText(x, y, colorsSelectionText, text)
|
||||
gpuSetBackground(colorsBackground)
|
||||
else
|
||||
drawText(x, y, colorsText, text)
|
||||
end
|
||||
|
||||
y = y + 1
|
||||
end
|
||||
|
||||
if e[1] == stringsKeyDown then
|
||||
if e[4] == 200 and selectedElement > 1 then
|
||||
selectedElement = selectedElement - 1
|
||||
|
||||
elseif e[4] == 208 and selectedElement < #elements then
|
||||
selectedElement = selectedElement + 1
|
||||
|
||||
elseif e[4] == 28 then
|
||||
if elements[selectedElement].c then
|
||||
elements[selectedElement].c()
|
||||
end
|
||||
|
||||
if elements[selectedElement].b then
|
||||
return 1
|
||||
end
|
||||
end
|
||||
|
||||
elseif e[1] == stringsComponentAdded and e[3] == "screen" then
|
||||
bindGPUToScreen()
|
||||
end
|
||||
end)
|
||||
end,
|
||||
|
||||
function(title, prefix)
|
||||
local
|
||||
y,
|
||||
text,
|
||||
state,
|
||||
eblo,
|
||||
char =
|
||||
|
||||
drawTitle(2, title),
|
||||
"",
|
||||
1
|
||||
|
||||
local function draw()
|
||||
eblo = prefix .. text
|
||||
|
||||
gpuFill(1, y, screenWidth, 1, " ")
|
||||
drawCentrizedText(y, colorsText, eblo .. (state and "_" or ""))
|
||||
end
|
||||
|
||||
draw()
|
||||
|
||||
runLoop(
|
||||
function(e)
|
||||
if e[1] == stringsKeyDown then
|
||||
if e[4] == 28 then
|
||||
return 1
|
||||
|
||||
elseif e[4] == 14 then
|
||||
text = text:sub(1, -2)
|
||||
|
||||
else
|
||||
char = unicode.char(e[3])
|
||||
|
||||
if char:match("^[%w%d%p%s]+") then
|
||||
text = text .. char
|
||||
end
|
||||
end
|
||||
|
||||
state = 1
|
||||
|
||||
elseif e[1] == "clipboard" then
|
||||
text = text .. e[3]
|
||||
|
||||
elseif not e[1] then
|
||||
state = not state
|
||||
end
|
||||
|
||||
draw()
|
||||
end,
|
||||
0.5
|
||||
)
|
||||
|
||||
return text
|
||||
end,
|
||||
|
||||
function(url)
|
||||
local
|
||||
connection,
|
||||
data,
|
||||
result,
|
||||
reason =
|
||||
|
||||
componentProxy(internetAddress).request(url),
|
||||
""
|
||||
|
||||
if connection then
|
||||
status("Downloading script")
|
||||
|
||||
while 1 do
|
||||
result, reason = connection.read(mathHuge)
|
||||
|
||||
if result then
|
||||
data = data .. result
|
||||
else
|
||||
connection.close()
|
||||
|
||||
if reason then
|
||||
status(reason, 1)
|
||||
else
|
||||
executeString(data, "=url")
|
||||
end
|
||||
|
||||
break
|
||||
end
|
||||
end
|
||||
else
|
||||
status("Invalid URL", 1)
|
||||
end
|
||||
end
|
||||
|
||||
bindGPUToScreen()
|
||||
status("Hold Alt to show boot options")
|
||||
|
||||
-- Waiting 1 sec for user to press Alt key
|
||||
local deadline, e = uptime() + 1
|
||||
local deadline, eventData = uptime() + 1
|
||||
|
||||
while uptime() < deadline do
|
||||
e = { pullSignal(deadline - uptime()) }
|
||||
eventData = { pullSignal(deadline - uptime()) }
|
||||
|
||||
if e[1] == stringsKeyDown and e[4] == 56 then
|
||||
if eventData[1] == stringsKeyDown and eventData[4] == 56 then
|
||||
local utilities = {
|
||||
menuElement("Disk utility", function()
|
||||
local restrict, filesystems, filesystemOptions =
|
||||
newMenuElement("Disk utility", function()
|
||||
local
|
||||
restrict,
|
||||
filesystems =
|
||||
|
||||
function(text, limit)
|
||||
return (#text < limit and text .. string.rep(" ", limit - #text) or text:sub(1, limit)) .. " "
|
||||
end,
|
||||
{ menuBack() }
|
||||
{ newMenuBackElement() }
|
||||
|
||||
local function updateFilesystems()
|
||||
for i = 2, #filesystems do
|
||||
@ -383,35 +404,13 @@ while uptime() < deadline do
|
||||
|
||||
local
|
||||
label,
|
||||
isReadOnly,
|
||||
filesystemOptions =
|
||||
isReadOnly =
|
||||
|
||||
proxy.getLabel() or "Unnamed",
|
||||
proxy.isReadOnly(),
|
||||
{
|
||||
menuElement("Set as bootable", function()
|
||||
eepromSetData(address)
|
||||
updateFilesystems()
|
||||
end, 1)
|
||||
}
|
||||
|
||||
if not isReadOnly then
|
||||
tableInsert(filesystemOptions, menuElement(stringsChangeLabel, function()
|
||||
proxy.setLabel(input(stringsChangeLabel, "New value: "))
|
||||
updateFilesystems()
|
||||
end, 1))
|
||||
|
||||
tableInsert(filesystemOptions, menuElement("Erase", function()
|
||||
status("Erasing " .. address)
|
||||
proxy.remove("")
|
||||
updateFilesystems()
|
||||
end, 1))
|
||||
end
|
||||
|
||||
tableInsert(filesystemOptions, menuBack())
|
||||
proxy.isReadOnly()
|
||||
|
||||
tableInsert(filesystems, 1,
|
||||
menuElement(
|
||||
newMenuElement(
|
||||
(address == eepromGetData() and "> " or " ") ..
|
||||
restrict(label, 10) ..
|
||||
restrict(proxy.spaceTotal() > 1048575 and "HDD" or proxy.spaceTotal() > 65535 and "FDD" or "SYS", 3) ..
|
||||
@ -420,7 +419,41 @@ while uptime() < deadline do
|
||||
address:sub(1, 8) .. "…",
|
||||
|
||||
function()
|
||||
menu(label .. " (" .. address .. ")", filesystemOptions)
|
||||
local elements = {
|
||||
newMenuElement(
|
||||
"Set as bootable",
|
||||
function()
|
||||
eepromSetData(address)
|
||||
updateFilesystems()
|
||||
end,
|
||||
1
|
||||
),
|
||||
|
||||
newMenuBackElement()
|
||||
}
|
||||
|
||||
if not isReadOnly then
|
||||
tableInsert(elements, 2, newMenuElement(
|
||||
stringsChangeLabel,
|
||||
function()
|
||||
pcall(proxy.setLabel, input(stringsChangeLabel, "New value: "))
|
||||
updateFilesystems()
|
||||
end,
|
||||
1
|
||||
))
|
||||
|
||||
tableInsert(elements, 3, newMenuElement(
|
||||
"Erase",
|
||||
function()
|
||||
status("Erasing " .. address)
|
||||
proxy.remove("")
|
||||
updateFilesystems()
|
||||
end,
|
||||
1
|
||||
))
|
||||
end
|
||||
|
||||
menu(label .. " (" .. address .. ")", elements)
|
||||
end
|
||||
)
|
||||
)
|
||||
@ -431,15 +464,15 @@ while uptime() < deadline do
|
||||
menu("Select filesystem", filesystems)
|
||||
end),
|
||||
|
||||
menuBack()
|
||||
newMenuBackElement()
|
||||
}
|
||||
|
||||
if internetAddress then
|
||||
tableInsert(utilities, 2, menuElement("System recovery", function()
|
||||
tableInsert(utilities, 2, newMenuElement("System recovery", function()
|
||||
internetExecute("https://tinyurl.com/29urhz7z")
|
||||
end))
|
||||
|
||||
tableInsert(utilities, 3, menuElement(stringsURLBoot, function()
|
||||
tableInsert(utilities, 3, newMenuElement(stringsURLBoot, function()
|
||||
internetExecute(input(stringsURLBoot, "Address: "))
|
||||
end))
|
||||
end
|
||||
@ -470,6 +503,7 @@ if not (bootProxy and boot(bootProxy)) then
|
||||
|
||||
tryBootFromAny()
|
||||
|
||||
-- Waiting for any fs component available
|
||||
runLoop(function(e)
|
||||
if e[1] == stringsComponentAdded then
|
||||
tryBootFromAny()
|
||||
|
||||
@ -1 +1 @@
|
||||
local a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t="MineOS EFI","Change label","key_down","component_added","filesystem","URL boot",component.proxy,component.list,computer.pullSignal,computer.uptime,table.insert,math.max,math.min,math.huge,math.floor,0x2D2D2D,0xE1E1E1,0x878787,0x878787,0xE1E1E1;local u,v,w=g(h("eeprom")()),g(h("gpu")()),h("internet")()local x,y,z,A,B,C,D,E=v.set,v.setBackground,v.setForeground,v.fill,u.setData,u.getData,v.getResolution()local F,G,H,I,J,K={{"/OS.lua"},{"/init.lua",function()computer.getBootAddress,computer.setBootAddress=C,B end}},function()local L=h("screen")()if L then v.bind(L,true)end end,function(M,N,O,P,Q)y(Q)A(M,N,O,P," ")end,function(N,R,S)z(R)x(o(D/2-#S/2),N,S)end,function(S,T,U)return{s=S,c=T,b=U}end,function(V,...)while V({i(...)})==nil do end end;local function W(N,X)N=o(E/2-N/2)H(1,1,D,E,q)I(N,p,X)return N+2 end;local function Y(Z,_)local a0={}for a1 in Z:gmatch("[^\r\n]+")do a0[#a0+1]=a1:gsub("\t"," ")end;local N=W(#a0,a)for a2=1,#a0 do I(N,r,a0[a2])N=N+1 end;if _ then while i()~=c do end end end;local function a3(...)local a4,a5=load(...)if a4 then a4,a5=xpcall(a4,debug.traceback)if a4 then return end end;Y(a5,1)end;local a6,a7,a8,a9,aa=function(ab)local ac;for a2=1,#F do ac=F[a2]if ab.exists(ac[1])then Y("Booting from "..(ab.getLabel()or ab.address))if C()~=ab.address then B(ab.address)end;if ac[2]then ac[2]()end;local ad,ae,af,ag,a5=ab.open(ac[1],"rb"),""repeat af=ab.read(ad,n)ae=ae..(af or"")until not af;ab.close(ad)a3(ae,"="..ac[1])return 1 end end end,function(ah)return J("Back",ah,1)end,function(X,ai)local aj,ak=1,0;for a2=1,#ai do ak=math.max(ak,#ai[a2].s)end;K(function(al)local N,M=W(#ai+2,X)for a2=1,#ai do M=o(D/2-#ai[a2].s/2)if a2==aj then H(o(D/2-ak/2)-2,N,ak+4,1,s)z(t)x(M,N,ai[a2].s)y(q)else z(r)x(M,N,ai[a2].s)end;N=N+1 end;if al[1]==c then if al[4]==200 and aj>1 then aj=aj-1 elseif al[4]==208 and aj<#ai then aj=aj+1 elseif al[4]==28 then if ai[aj].c then ai[aj].c()end;if ai[aj].b then return 1 end end elseif al[1]==d and al[3]=="screen"then G()end end)end,function(X,am)local N,S,an,ao,ap=W(2,X),"",true;local function aq()ao=am..S;A(1,N,D,1," ")z(r)x(o(D/2-#ao/2),N,ao..(an and"█"or""))end;aq()K(function(al)if al[1]==c then if al[4]==28 then return 1 elseif al[4]==14 then S=S:sub(1,-2)else ap=unicode.char(al[3])if ap:match("^[%w%d%p%s]+")then S=S..ap end end;an=true elseif al[1]=="clipboard"then S=S..al[3]elseif not al[1]then an=not an end;aq()end,0.5)end,function(ar)local as,ae,a4,a5=g(w).request(ar),""if as then Y("Downloading script")while 1 do a4,a5=as.read(n)if a4 then ae=ae..a4 else as.close()if a5 then Y(a5,1)else a3(ae,"=url")end;break end end else Y("Invalid URL",1)end end;G()Y("Hold Alt to show boot options")local at,al=j()+1;while j()<at do al={i(at-j())}if al[1]==c and al[4]==56 then local au={J("Disk utility",function()local av,aw,ax=function(S,ay)return(#S<ay and S..string.rep(" ",ay-#S)or S:sub(1,ay)).." "end,{a7()}local function az()for a2=2,#aw do table.remove(aw,1)end;for aA in h(e)do local ab=g(aA)local aB,aC,ax=ab.getLabel()or"Unnamed",ab.isReadOnly(),{J("Set as bootable",function()B(aA)az()end,1)}if not aC then k(ax,J(b,function()ab.setLabel(a9(b,"New value: "))az()end,1))k(ax,J("Erase",function()Y("Erasing "..aA)ab.remove("")az()end,1))end;k(ax,a7())k(aw,1,J((aA==C()and"> "or" ")..av(aB,10)..av(ab.spaceTotal()>1048575 and"HDD"or ab.spaceTotal()>65535 and"FDD"or"SYS",3)..av(aC and"R "or"R/W",3)..av(math.ceil(ab.spaceUsed()/ab.spaceTotal()*100).."%",4)..aA:sub(1,8).."…",function()a8(aB.." ("..aA..")",ax)end))end end;az()a8("Select filesystem",aw)end),a7()}if w then k(au,2,J("System recovery",function()aa("https://tinyurl.com/29urhz7z")end))k(au,3,J(f,function()aa(a9(f,"Address: "))end))end;a8(a,au)end end;local aD=g(C())if not(aD and a6(aD))then local function aE()for aA in h(e)do aD=g(aA)if a6(aD)then computer.shutdown()else aD=nil end end;if not aD then Y("Not boot sources found")end end;aE()K(function(al)if al[1]==d then aE()end end)end
|
||||
local a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I="MineOS EFI","Change label","key_down","component_added","filesystem","URL boot",component.proxy,component.list,computer.pullSignal,computer.uptime,table.insert,math.max,math.min,math.huge,math.floor,0x2D2D2D,0xE1E1E1,0x878787,0x878787,0xE1E1E1;local J,K,L=g(h("eeprom")()),g(h("gpu")()),h("internet")()local M,N,O,P,Q,R,S=K.set,K.setBackground,K.fill,J.setData,J.getData,K.getResolution()u,v,w,x,y,z,A,B,C,D,E,F,G,H,I={{"/OS.lua"},{"/init.lua",function()computer.getBootAddress,computer.setBootAddress=Q,P end}},function()local T=h("screen")()if T then K.bind(T,true)end end,function(U,V,W,X,Y)N(Y)O(U,V,W,X," ")end,function(U,V,Z,_)K.setForeground(Z)M(U,V,_)end,function(_,a0,a1)return{s=_,c=a0,b=a1}end,function(a2,...)while a2({i(...)})==nil do end end,function(V,Z,_)x(o(R/2-#_/2),V,Z,_)end,function(V,a3)V=o(S/2-V/2)w(1,1,R,S,q)A(V,p,a3)return V+2 end,function(a4,a5)local a6={}for a7 in a4:gmatch("[^\r\n]+")do a6[#a6+1]=a7:gsub("\t"," ")end;local V=B(#a6,a)for a8=1,#a6 do A(V,r,a6[a8])V=V+1 end;if a5 then while i()~=c do end end end,function(...)local a9,aa=load(...)if a9 then a9,aa=xpcall(a9,debug.traceback)if a9 then return end end;C(aa,1)end,function(ab)local ac;for a8=1,#u do ac=u[a8]if ab.exists(ac[1])then C("Booting from "..(ab.getLabel()or ab.address))if Q()~=ab.address then P(ab.address)end;if ac[2]then ac[2]()end;local ad,ae,af,ag,aa=ab.open(ac[1],"rb"),""repeat af=ab.read(ad,n)ae=ae..(af or"")until not af;ab.close(ad)D(ae,"="..ac[1])return 1 end end end,function(ah)return y("Back",ah,1)end,function(a3,ai)local aj,ak=1,0;for a8=1,#ai do ak=math.max(ak,#ai[a8].s)end;z(function(al)local V,U,_=B(#ai+2,a3)for a8=1,#ai do _=" "..ai[a8].s.." "U=o(R/2-#_/2)if a8==aj then N(s)x(U,V,t,_)N(q)else x(U,V,r,_)end;V=V+1 end;if al[1]==c then if al[4]==200 and aj>1 then aj=aj-1 elseif al[4]==208 and aj<#ai then aj=aj+1 elseif al[4]==28 then if ai[aj].c then ai[aj].c()end;if ai[aj].b then return 1 end end elseif al[1]==d and al[3]=="screen"then v()end end)end,function(a3,am)local V,_,an,ao,ap=B(2,a3),"",1;local function aq()ao=am.._;O(1,V,R,1," ")A(V,r,ao..(an and"_"or""))end;aq()z(function(al)if al[1]==c then if al[4]==28 then return 1 elseif al[4]==14 then _=_:sub(1,-2)else ap=unicode.char(al[3])if ap:match("^[%w%d%p%s]+")then _=_..ap end end;an=1 elseif al[1]=="clipboard"then _=_..al[3]elseif not al[1]then an=not an end;aq()end,0.5)return _ end,function(ar)local as,ae,a9,aa=g(L).request(ar),""if as then C("Downloading script")while 1 do a9,aa=as.read(n)if a9 then ae=ae..a9 else as.close()if aa then C(aa,1)else D(ae,"=url")end;break end end else C("Invalid URL",1)end end;v()C("Hold Alt to show boot options")local at,au=j()+1;while j()<at do au={i(at-j())}if au[1]==c and au[4]==56 then local av={y("Disk utility",function()local aw,ax=function(_,ay)return(#_<ay and _..string.rep(" ",ay-#_)or _:sub(1,ay)).." "end,{F()}local function az()for a8=2,#ax do table.remove(ax,1)end;for aA in h(e)do local ab=g(aA)local aB,aC=ab.getLabel()or"Unnamed",ab.isReadOnly()k(ax,1,y((aA==Q()and"> "or" ")..aw(aB,10)..aw(ab.spaceTotal()>1048575 and"HDD"or ab.spaceTotal()>65535 and"FDD"or"SYS",3)..aw(aC and"R "or"R/W",3)..aw(math.ceil(ab.spaceUsed()/ab.spaceTotal()*100).."%",4)..aA:sub(1,8).."…",function()local ai={y("Set as bootable",function()P(aA)az()end,1),F()}if not aC then k(ai,2,y(b,function()pcall(ab.setLabel,H(b,"New value: "))az()end,1))k(ai,3,y("Erase",function()C("Erasing "..aA)ab.remove("")az()end,1))end;G(aB.." ("..aA..")",ai)end))end end;az()G("Select filesystem",ax)end),F()}if L then k(av,2,y("System recovery",function()I("https://tinyurl.com/29urhz7z")end))k(av,3,y(f,function()I(H(f,"Address: "))end))end;G(a,av)end end;local aD=g(Q())if not(aD and E(aD))then local function aE()for aA in h(e)do aD=g(aA)if E(aD)then computer.shutdown()else aD=nil end end;if not aD then C("Not boot sources found")end end;aE()z(function(al)if al[1]==d then aE()end end)end
|
||||
Loading…
Reference in New Issue
Block a user