Sophie

Sophie

distrib > PLD > th > x86_64 > by-pkgid > fe5c585978e2407818d48dd0b2eb63c1 > scriptlet

dash-0.5.12-1.x86_64.rpm

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