made newer installer that does not require tar stuff

This commit is contained in:
2026-03-21 00:54:39 -04:00
parent df62414229
commit 7deefc83ca
107 changed files with 648 additions and 353 deletions

1
prod/hysh/bin/login Normal file
View File

@@ -0,0 +1 @@
syscall.open("/dev/tty/1","r")syscall.open("/dev/tty/1","w")syscall.open("/dev/null","w")local a=3;local function b(c)local d=""while true do local e=syscall.read(0)if not e or e==""then elseif e=="\n"then syscall.write(1,"\n")return d elseif e=="\b"then if#d>0 then d=d:sub(1,-2)syscall.write(1,"\b \b")end else d=d..e;syscall.write(1,c or e)end end end;local function f()local g=""local h,i=pcall(function()local j=syscall.open("/etc/shadow","r")g=syscall.read(j,65535)or""syscall.close(j)end)if g:match("%S")then return end;syscall.devctl(1,"clear")syscall.devctl(1,"spos",1,1)syscall.devctl(1,"sfgc",0x00FF00)syscall.write(1,"HyperionOS First Boot Setup\n")syscall.devctl(1,"sfgc",0xFFFFFF)syscall.write(1,"No root password is set. Please create one now.\n\n")while true do syscall.write(1,"New root password: ")local k=b("*")syscall.write(1,"Confirm password: ")local l=b("*")if k~=l then syscall.devctl(1,"sfgc",0xFF0000)syscall.write(1,"Passwords do not match. Try again.\n\n")syscall.devctl(1,"sfgc",0xFFFFFF)elseif#k<6 then syscall.devctl(1,"sfgc",0xFF0000)syscall.write(1,"Password too short (minimum 6 characters).\n\n")syscall.devctl(1,"sfgc",0xFFFFFF)else local m,n=syscall.setpassword(0,k)if m then syscall.devctl(1,"sfgc",0x00FF00)syscall.write(1,"Root password set.\n\n")syscall.devctl(1,"sfgc",0xFFFFFF)sleep(0.5)break else syscall.devctl(1,"sfgc",0xFF0000)syscall.write(1,"Error: "..tostring(n).."\n")syscall.devctl(1,"sfgc",0xFFFFFF)end end end end;local function o(p,q,r,s)local t,u=pcall(syscall.exists,r)if not t or not u then syscall.write(1,"login: shell not found: "..r.."\n")sleep(2)return false end;local v,w=pcall(syscall.access,r,"rx")syscall.setEnviron("HOME",s)syscall.setEnviron("USER",p)syscall.setEnviron("SHELL",r)syscall.setEnviron("PATH","/bin/")local x,y=pcall(syscall.setuid,q)if not x then syscall.write(1,"login: setuid failed: "..tostring(y).."\n")sleep(2)return false end;local z,A=pcall(syscall.chdir,s)if not z then pcall(syscall.chdir,"/")end;local m,n=pcall(syscall.execspawn,r,p..":shell")if not m then syscall.write(1,"login: failed to launch shell: "..tostring(n).."\n")sleep(2)return false end;syscall.exit(0)end;local function B()syscall.devctl(1,"clear")syscall.devctl(1,"sfgc",0xFFFFFF)syscall.devctl(1,"sbgc",0x000000)syscall.devctl(1,"spos",1,1)local C=syscall.getHostname()or"hyperion"syscall.write(1,"HyperionOS\n")syscall.write(1,C.." login\n\n")local D=0;while D<a do syscall.devctl(1,"sfgc",0xFFFFFF)syscall.write(1,"Username: ")local p=b(nil)if p~=""then syscall.write(1,"Password: ")local E=b("*")local q=syscall.getuidbyname(p)local m,n=syscall.login(q,E)if m then local q=syscall.getuid()local F=syscall.getpasswd(q)local r=F and F.shell or"/bin/hysh"local s=F and F.homedir or"/"syscall.devctl(1,"sfgc",0x00FF00)syscall.write(1,"\nWelcome, "..p.."!\n")syscall.devctl(1,"sfgc",0xFFFFFF)sleep(0.3)o(p,q,r,s)return else D=D+1;sleep(1)syscall.devctl(1,"sfgc",0xFF0000)syscall.write(1,"Login incorrect.\n\n")syscall.devctl(1,"sfgc",0xFFFFFF)end end end;syscall.devctl(1,"sfgc",0xFF0000)syscall.write(1,"Maximum login attempts exceeded.\n")syscall.devctl(1,"sfgc",0xFFFFFF)sleep(5)end;f()while true do B()end