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/chattr Normal file
View File

@@ -0,0 +1 @@
local a=syscall.getTask(syscall.getpid()).name;local b={R=false,help=false}local c={}local d=nil;for e,f in ipairs({...})do if f:sub(1,2)=="--"then local g=f:sub(3)if b[g]==nil then print(a..": unrecognized option '"..f.."'")print("try '"..a.." --help' for more information.")syscall.exit(1)return end;b[g]=true elseif f:sub(1,1)=="-"and not f:match("^%-[%+%-]")then local h=true;for i=2,#f do local j=f:sub(i,i)if b[j]~=nil then b[j]=true else h=false;break end end;if not h then d=f end elseif f:sub(1,1)=="+"or f:sub(1,1)=="-"and f:match("^%-[a-zA-Z]")then d=f else table.insert(c,f)end end;if b.help then print("Usage: "..a.." [OPTION]... +-= ATTRS FILE...")print("Change file attributes on a filesystem.")print("")print("Attributes:")print(" i immutable: file cannot be modified, renamed, or deleted")print(" a append-only: file can only be appended to")print("")print("Operators: +attr add, -attr remove")print("Example: "..a.." +i /etc/passwd")print("")print("Options:")print(" -R operate on files and directories recursively")print(" --help display this help and exit")return end;if not d or#c<1 then print(a..": missing operand")print("try '"..a.." --help' for more information.")syscall.exit(1)return end;local k=d:sub(1,1)local l=d:sub(2)if k~="+"and k~="-"then print(a..": invalid operator '"..k.."' (use + or -)")syscall.exit(1)return end;local function m(n)local o=pcall(function()return syscall.stat(n)end)and syscall.stat(n)if o then return o.xattr or""end;return""end;local p="|i"local q="|a"local function r(j)if j=="i"then return p elseif j=="a"then return q else return nil end end;local function s(n)local o=syscall.stat(n)if not o then print(a..": cannot stat '"..n.."': No such file or directory")return false end;if o.etype==0x01 then return true end;if not syscall.setxattr then print(a..": kernel does not expose setxattr syscall; cannot modify attributes")syscall.exit(1)return false end;local t=o.xattr or""for i=1,#l do local j=l:sub(i,i)local u=r(j)if not u then print(a..": unsupported attribute '"..j.."'")syscall.exit(1)return false end;local v=t:find(u,1,true)if k=="+"and not v then t=t..u elseif k=="-"and v then t=t:gsub(u:gsub("|","%%|"),"")end end;local w,x=pcall(syscall.setxattr,n,t)if not w then print(a..": cannot set attributes on '"..n.."': "..tostring(x))return false end;return true end;local function y(n)if not s(n)then return end;if syscall.type(n)=="directory"then local w,z=pcall(syscall.listdir,n)if w then for e,A in ipairs(z)do local B=n;if B:sub(-1)~="/"then B=B.."/"end;y(B..A)end end end end;local C=syscall.getcwd()local function D(E)if E:sub(1,1)~="/"then E=C.."/"..E end;return E end;if not syscall.setxattr then print(a..": kernel does not expose setxattr; attributes cannot be persisted")print(a..": add sys[\"setxattr\"] = vfs.setxattr to 10_vfs.kmod to enable this")syscall.exit(1)return end;local F=0;for i=1,#c do local n=D(c[i])if not syscall.exists(n)then print(a..": cannot access '"..c[i].."': No such file or directory")F=1 elseif b.R then y(n)else if not s(n)then F=1 end end end;syscall.exit(F)