mirror of
https://github.com/IgorTimofeev/MineOS.git
synced 2026-09-14 11:06:16 +05:00
1 line
3.8 KiB
Lua
1 line
3.8 KiB
Lua
local a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r="MineOS EFI","Change label","key_down","filesystem",0x2D2D2D,0xE1E1E1,0x878787,0x878787,0xE1E1E1,component.proxy,component.list,computer.pullSignal,computer.uptime,table.insert,math.max,math.min,math.huge,math.floor;local s,t,u=j(k("eeprom")()),j(k("gpu")()),k("internet")()local v,w,x,y,z,A,B,C,D=computer.shutdown,t.set,t.setBackground,t.setForeground,t.fill,s.setData,s.getData,t.getResolution()local E,F,G,H,I={{"/OS.lua",function()end},{"/init.lua",function()computer.getBootAddress,computer.setBootAddress=B,A end}},function(J,K,L)if#J<K then J=J..string.rep(" ",K-#J)else J=J:sub(1,K)end;return J..(L and""or" ")end,function(M,N,O,P,Q)x(Q)z(M,N,O,P," ")end,function(N,R,J)local M=r(C/2-#J/2)y(R)w(M,N,J)end,function(J,S,T)return{s=J,c=S,b=T}end;local function U(N,V)N=r(D/2-N/2)G(1,1,C,D,f)H(N,e,V)return N+2 end;local function W(V,X,Y)local Z={}for _ in X:gmatch("[^\r\n]+")do Z[#Z+1]=_:gsub("\t"," ")end;local N=U(#Z,V)for a0=1,#Z do H(N,g,Z[a0])N=N+1 end;if Y then repeat Y=l()until Y==c or Y=="touch"end end;local function a1(...)local a2,a3=load(...)if a2 then a2,a3=xpcall(a2,debug.traceback)if a2 then return end end;W(a,a3,1)end;local a4,a5,a6,a7=function(a8)for a0=1,#E do if a8.exists(E[a0][1])then W(a,"Booting from "..a8.address)if B()~=a8.address then A(a8.address)end;E[a0][2]()local a9,aa,ab,ac,a3=a8.open(E[a0][1],"rb"),""repeat ab=a8.read(a9,q)aa=aa..(ab or"")until not ab;a8.close(a9)a1(aa,"="..E[a0][1])return 1 end end end,function()return I("Back",nil,1)end,function(V,ad)local ae,af=1,0;for a0=1,#ad do af=math.max(af,#ad[a0].s)end;while 1 do local N,M,ag=U(#ad+2,V)for a0=1,#ad do M=r(C/2-#ad[a0].s/2)if a0==ae then G(r(C/2-af/2)-2,N,af+4,1,h)y(i)w(M,N,ad[a0].s)x(f)else y(g)w(M,N,ad[a0].s)end;N=N+1 end;ag={l()}if ag[1]==c then if ag[4]==200 and ae>1 then ae=ae-1 elseif ag[4]==208 and ae<#ad then ae=ae+1 elseif ag[4]==28 then if ad[ae].c then ad[ae].c()end;if ad[ae].b then return end end end end end,function(N,ah)local J,ai,aj,ag,ak="",true;while 1 do aj=ah..J;z(1,N,C,1," ")y(g)w(r(C/2-#aj/2),N,aj..(ai and"█"or""))ag={l(0.5)}if ag[1]==c then if ag[4]==28 then return J elseif ag[4]==14 then J=J:sub(1,-2)else ak=unicode.char(ag[3])if ak:match("^[%w%d%p%s]+")then J=J..ak end end;ai=true elseif ag[1]=="clipboard"then J=J..ag[3]elseif not ag[1]then ai=not ai end end end;t.bind(k("screen")(),true)W(a,"Hold Alt to show boot options")local al,ag=m()+1;while m()<al do ag={l(al-m())}if ag[1]==c and ag[4]==56 then local am={I("Disk management",function()local an,ao={a5()},B()for ap in k(d)do local a8=j(ap)local aq,ar=a8.getLabel()or"Unnamed",a8.isReadOnly()n(an,1,I((ap==ao and"> "or" ")..F(aq,10)..F(a8.spaceTotal()>1048576 and"HDD"or a8.spaceTotal()>65536 and"FDD"or"SYS",3)..F(ar and"R"or"R/W",3)..ap:sub(1,8).." "..F(string.format("%.2f",a8.spaceUsed()/a8.spaceTotal()*100).."%",6,1),function()local as={a5()}if not ar then n(as,1,I(b,function()a8.setLabel(a7(U(2,b),"Enter new name: "))end,1))n(as,2,I("Format",function()W(a,"Formatting filesystem "..ap)for at,au in ipairs(a8.list("/"))do a8.remove(au)end;W(a,"Formatting finished",1)end,1))end;n(as,1,I("Set as bootable",function()A(ap)end,1))a6(aq.." ("..ap..")",as)end,1))end;a6("Select filesystem",an)end),I("Shutdown",function()v()end),a5()}if u then n(am,2,I("Internet recovery",function()local a9,aa,a2,a3=j(u).request("https://raw.githubusercontent.com/IgorTimofeev/MineOS/master/Installer/Main.lua"),""if a9 then W(a,"Downloading recovery script")while 1 do a2,a3=a9.read(q)if a2 then aa=aa..a2 else a9.close()if a3 then W(a,a3,1)else a1(aa,"=string")end;break end end else W(a,"invalid URL-address",1)end end))end;a6(a,am)end end;local a8=j(B())if not(a8 and a4(a8))then for ap in k(d)do a8=j(ap)if a4(a8)then break else a8=nil end end;if not a8 then W(a,"No bootable mediums found",1)end end;v() |