POSTIN
<lua>
bashfound = false;
shfound = false;
f = io.open("/etc/shells", "r");
if f == nil
then
f = io.open("/etc/shells", "w");
else
repeat
t = f:read();
if t == "/bin/bash"
then
bashfound = true;
end
if t == "/bin/sh"
then
shfound = true;
end
until t == nil;
end
f:close()
f = io.open("/etc/shells", "a");
if not bashfound
then
f:write("/bin/bash\n")
end
if not shfound
then
f:write("/bin/sh\n")
end
f:close()
POSTUN
/bin/sh
if [ "$1" = 0 ]; then
/bin/grep -v '^/bin/bash$' < /etc/shells | \
/bin/grep -v '^/bin/sh$' > /etc/shells.new
/bin/mv /etc/shells.new /etc/shells
fi