PREUN
<lua>
if arg[2] == 0 then
t = {}
f = io.open("/etc/shells", "r")
if f then
for l in f:lines() do t[l]=l; end
f:close()
end
for _, l in pairs({"/bin/dash"}) do
print("Removing "..l.." from /etc/shells")
t[l] = nil
end
s=""
for _, l in pairs(t) do
s=s..l.."\n"
end
f = io.open("/etc/shells", "w")
if f then
f:write(s)
f:close()
end
end
POSTIN
<lua>
t = {}
f = io.open("/etc/shells", "r")
if f then
for l in f:lines() do t[l]=l; end
f:close()
end
for _, s in ipairs({"/bin/dash"}) do
if not t[s] then
print("Adding "..s.." to /etc/shells")
f = io.open("/etc/shells", "a")
if f then
f:write(s.."\n")
f:close()
end
end
end