made newer installer that does not require tar stuff
This commit is contained in:
1
prod/hysh/bin/userdel
Normal file
1
prod/hysh/bin/userdel
Normal file
@@ -0,0 +1 @@
|
||||
local a={...}local b=false;local c=nil;for d,e in ipairs(a)do if e=="-r"then b=true elseif e:sub(1,1)~="-"then c=e else print("userdel: unknown option: "..e)syscall.exit(1)return end end;if not c then print("Usage: userdel [-r] <username>")syscall.exit(1)return end;local f=syscall.getuid(c)if not f then print("userdel: user '"..c.."' does not exist")syscall.exit(1)return end;local g=syscall.getpasswd(f)local h,i=syscall.deleteuser(f)if not h then print("userdel: "..tostring(i))syscall.exit(1)return end;if b and g and g.homedir then local j=require("fs")local k,l=pcall(function()local function m(n)for d,o in ipairs(j.list(n)or{})do local p=n.."/"..o;if j.isDir(p)then m(p)else syscall.remove(p)end end;syscall.remove(n)end;if j.exists(g.homedir)then m(g.homedir)end end)if not k then print("userdel: warning: could not remove home: "..tostring(l))end end;print("userdel: deleted user '"..c.."'")
|
||||
Reference in New Issue
Block a user