made newer installer that does not require tar stuff
This commit is contained in:
1
prod/hysh/bin/ln
Normal file
1
prod/hysh/bin/ln
Normal file
@@ -0,0 +1 @@
|
||||
local a=syscall.getTask(syscall.getpid()).name;local b={s=false,f=false,help=false}local c={}for d,e in ipairs({...})do if e:sub(1,2)=="--"then local f=e:sub(3)if b[f]==nil then print(a..": unrecognized option '"..e.."'")print("try '"..a.." --help' for more information.")syscall.exit(1)return end;b[f]=true elseif e:sub(1,1)=="-"then for g=2,#e do local f=e:sub(g,g)if b[f]==nil then print(a..": invalid option '-"..f.."'")print("try '"..a.." --help' for more information.")syscall.exit(1)return end;b[f]=true end else table.insert(c,e)end end;if b.help then print("Usage: "..a.." [OPTION]... TARGET LINK_NAME")print(" "..a.." [OPTION]... TARGET... DIRECTORY")print("Create links between files.")print("")print("Options:")print(" -s make symbolic links instead of hard links")print(" -f remove existing destination files")print(" --help display this help and exit")print("")print("With no -s, hard links are not supported (filesystem limitation).")print("Use -s for symbolic links.")return end;if#c<2 then print(a..": missing operand")print("try '"..a.." --help' for more information.")syscall.exit(1)return end;if not b.s then print(a..": hard links are not supported; use -s for symbolic links")syscall.exit(1)return end;local h=c[#c]local i=syscall.type(h)=="directory"local function j()local k=syscall.getcwd()if k:sub(-1)~="/"then k=k.."/"end;return k end;local function l(m)if m:sub(1,1)~="/"then m=j()..m end;return m end;for g=1,#c-1 do local n=c[g]local o;if i then local p=n:match("[^/]+$")or n;o=l(h)if o:sub(-1)~="/"then o=o.."/"end;o=o..p else o=l(h)end;if b.f and syscall.exists(o)then local q,r=pcall(syscall.remove,o)if not q then print(a..": cannot remove '"..o.."': "..tostring(r))syscall.exit(1)return end end;local q,r=pcall(syscall.symlink,n,o)if not q then print(a..": failed to create symlink '"..o.."' -> '"..n.."': "..tostring(r))syscall.exit(1)return end end
|
||||
Reference in New Issue
Block a user