(Created page with "= Preamble = /etc/shells is a text file which controls system login shell of users. It contains a set of valid shells which can be used in the system. See: SHELLS(5) = How ...") |
mNo edit summary |
||
Line 6: | Line 6: | ||
= How to handle new shells in Fedora packages = | = How to handle new shells in Fedora packages = | ||
As this file can be edited by any people as default, we need to first determine if relevant lines are already existed. | As this file can be edited by any people as default, we need to first determine if relevant lines are already existed. | ||
If existed already, then just echo relevant binary path to the file. | If existed already, then just echo relevant binary path to the file. Thus, here is an example of package "foo": | ||
<code> | <code> | ||
%post | %post | ||
Line 22: | Line 21: | ||
fi | fi | ||
</code> | </code> | ||
[[Category:Packaging guidelines drafts]] |
Revision as of 12:11, 9 December 2013
Preamble
/etc/shells is a text file which controls system login shell of users. It contains a set of valid shells which can be used in the system.
See: SHELLS(5)
How to handle new shells in Fedora packages
As this file can be edited by any people as default, we need to first determine if relevant lines are already existed. If existed already, then just echo relevant binary path to the file. Thus, here is an example of package "foo":
%post
if [ ! -f %{_sysconfdir}/shells ] ; then
echo "%{_bindir}/foo" > %{_sysconfdir}/shells
else
grep -q "^%{_bindir}/foo$" %{_sysconfdir}/shells || echo "%{_bindir}/foo" >> %{_sysconfdir}/shells
fi
%postun
if [ $1 -eq 0 ] && [ -f %{_sysconfdir}/shells ]; then
sed -i '\!^%{_bindir}/foo$!d' %{_sysconfdir}/shells
fi