3

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

krissi
  • 3,317
  • 1
  • 18
  • 22
  • Are you building a package for internal use only, or are you trying to build something that you will share with the public? – Zoredache May 21 '12 at 23:42
  • currently I am building a package to install (by Dependencies) and start integration tests at tty1. In this case the system will be dedicated for this. The package is internal use only. But I hit the problem with my last package, too, which may be for external use in the future – krissi May 22 '12 at 09:12

1 Answers1

3

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, the sysvinit 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.

stew
  • 9,263
  • 1
  • 28
  • 43