made newer installer that does not require tar stuff

This commit is contained in:
Astronand committed 2026-03-21 00:54:39 -04:00
1 parent df62414229
commit 7deefc83ca
107 files changed
+648 -353

No files matched your search

+1
View File
@@ -0,0 +1 @@
local a=syscall.getTask(syscall.getpid()).name;local b={}local c={}local d=false;local e=false;local f={...}local g=1;while g<=#f do local h=f[g]if h=="-n"then d=true elseif h=="-i"then e=true elseif h=="-e"then g=g+1;if not f[g]then print(a..": option -e requires an argument")syscall.exit(1)return end;table.insert(b,f[g])elseif h:sub(1,2)=="-e"then table.insert(b,h:sub(3))elseif h=="--help"then print("Usage: "..a.." [OPTION]... SCRIPT [FILE...]")print(" "..a.." [OPTION]... -e SCRIPT... [FILE...]")print("Stream editor. Reads FILE(s) (or stdin) line by line,")print("applies SCRIPT, and writes results to stdout.")print("")print("Commands:")print(" s/REGEX/REPL/[flags] substitute (flags: g global, i ignore-case, p print)")print(" d delete line (skip to next)")print(" p print current line")print(" q quit")print(" = print current line number")print(" y/src/dst/ transliterate characters")print("")print("Addressing (prefix any command):")print(" N line number N")print(" $ last line")print(" /REGEX/ lines matching regex")print(" N,M line range")print(" N,/REGEX/ from line N until regex match")print("")print("Options:")print(" -n suppress default output")print(" -e SCRIPT add script expression")print(" -i edit file in-place")print(" --help display this help and exit")return elseif h:sub(1,1)=="-"then print(a..": unknown option: "..h)syscall.exit(1)return else if#b==0 then table.insert(b,h)else table.insert(c,h)end end;g=g+1 end;if#b==0 then print(a..": no script specified")syscall.exit(1)return end;local i=table.concat(b,"\n")local function j(k)return k:gsub("([%(%)%.%%%+%-%*%?%[%^%$])","%%%1")end;local function l(m,n)m=m:gsub("\\%(","("):gsub("\\%)",")")m=m:gsub("\\1","%%1"):gsub("\\2","%%2")return m end;local function o(k,p,q)local r={}while p<=#k do local s=k:sub(p,p)if s=="\\"and p<#k then p=p+1;local t=k:sub(p,p)if t==q then table.insert(r,q)elseif t=="n"then table.insert(r,"\n")else table.insert(r,"\\"..t)end elseif s==q then return table.concat(r),p+1 else table.insert(r,s)end;p=p+1 end;return table.concat(r),p end;local function u(k,p)local s=k:sub(p,p)if s==""then return nil,p end;if s:match("%d")then local v=k:match("^(%d+)",p)return{type="line",n=tonumber(v)},p+#v elseif s=="$"then return{type="last"},p+1 elseif s=="/"then local m,w=o(k,p+1,"/")return{type="regex",pat=m},w end;return nil,p end;local function x(y)local z={}local p=1;local A=#y;local function B()while p<=A and(y:sub(p,p)==" "or y:sub(p,p)=="\t")do p=p+1 end end;while p<=A do B()if p>A then break end;local s=y:sub(p,p)if s=="\n"or s==";"then p=p+1 elseif s=="#"then while p<=A and y:sub(p,p)~="\n"do p=p+1 end else local C,D;C,p=u(y,p)B()if C and p<=A and y:sub(p,p)==","then p=p+1;B()D,p=u(y,p)end;B()if p>A then break end;local E=y:sub(p,p)p=p+1;if E=="s"then local q=y:sub(p,p)p=p+1;local m,F=o(y,p,q)p=F;local G,H=o(y,p,q)p=H;local I=""while p<=A and y:sub(p,p):match("[giIp]")do I=I..y:sub(p,p)p=p+1 end;table.insert(z,{addr1=C,addr2=D,cmd="s",pat=m,repl=G,flags=I})elseif E=="y"then local q=y:sub(p,p)p=p+1;local J,F=o(y,p,q)p=F;local K,H=o(y,p,q)p=H;table.insert(z,{addr1=C,addr2=D,cmd="y",src=J,dst=K})elseif E=="d"or E=="p"or E=="q"or E=="="then table.insert(z,{addr1=C,addr2=D,cmd=E})elseif E=="{"then local L=1;local M=p;while p<=A and L>0 do local N=y:sub(p,p)if N=="{"then L=L+1 elseif N=="}"then L=L-1 end;p=p+1 end;local O=y:sub(M,p-2)local P=x(O)for Q,R in ipairs(P)do R.addr1=R.addr1 or C;R.addr2=R.addr2 or D end;for Q,R in ipairs(P)do table.insert(z,R)end elseif E=="\n"or E==";"then else end end end;return z end;local z=x(i)local S={}local function T(E,U,V,W,X)local Y=E.addr1;local Z=E.addr2;if not Y then return true end;local function _(a0,a1,a2)if a0.type=="line"then return a1==a0.n elseif a0.type=="last"then return W elseif a0.type=="regex"then return a2:find(l(a0.pat))~=nil end;return false end;if not Z then return _(Y,U,V)end;if S[X]then local a3;if Z.type=="line"then a3=U>=Z.n elseif Z.type=="last"then a3=W elseif Z.type=="regex"then a3=V:find(l(Z.pat))~=nil end;if a3 then S[X]=false end;return true else if _(Y,U,V)then if Z.type=="line"and Z.n<=U then else S[X]=true end;return true end;return false end end;local function a4(V,m,G,I)local a5=I:find("g")~=nil;local n=I:find("[iI]")~=nil;local a6=l(m,n)local function a7(a8,...)local a9={...}local r={}local aa=G;local ab=1;while ab<=#aa do local ac=aa:sub(ab,ab)if ac=="&"then table.insert(r,a8)elseif ac=="\\"and ab<#aa then ab=ab+1;local t=aa:sub(ab,ab)if t:match("%d")then local ad=tonumber(t)table.insert(r,a9[ad]or"")elseif t=="n"then table.insert(r,"\n")else table.insert(r,t)end else table.insert(r,ac)end;ab=ab+1 end;return table.concat(r)end;local ae;local af=false;if a5 then ae=V:gsub(a6,a7)af=ae~=V else local k,ag,a8;local ah={V:find(a6)}if ah[1]then k=ah[1]ag=ah[2]local a9={}for X=3,#ah do a9[#a9+1]=ah[X]end;local aLine truncated