Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

share|improve this question
    
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 9:12

1 Answer 1

up vote 3 down vote accepted

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.

share|improve this answer
    
Thanks for clarification, great answer –  krissi May 22 '12 at 9:10

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.