I am creating a debian package. This will have to alter /etc/inittab
to switch tty1
from /sbin/getty
to /sbin/rungetty
.
Of course I can alter the line with an sed
in the postinst. Is this the best way to do it or is there any debianish way to do it?
Thanks in advance
the Debianish way to handle this is documented in the Debian Policy Manual in section 10.7.4 "Sharing Configuration Files". The difficulty is that Debian policy dictates that no package should be directly modifying a configuration file from another package, Instead the owning package should provide helpers which other packages can use to modify configuration.
On most systems,
/etc/inittab
would be provided by the sysvinit package, so to be compliant with Debian policy, thesysvinit
package would have to be modified to give your package a mechanism to change inittab. sysvinit is not the only package which might be providing/etc/inittab
, It could also come from upstart, so upstart would also have to change. others might not have an/etc/inittab
. If you software depends on one particular implementation, or will malfunction without any/etc/inittab
present, you need your package to explicitly depend on a package providing/etc/inittab
.This is not something likely to happen. Other things to take into consideration is that changes made to configuration files by a system administrator should never be overwritten by a package, so if you make some change, the administrator undoes or modifies the thing you changed, you should not be changing it back on him if your package is reconfigured or upgraded (without perhaps prompting the administrator for permission).
Besides these rules about when you can modify files, there is nothing in policy or convention which dictates which tools to use to do this.
sed
is one of many tools commonly used.