Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm creating a debian package and I'm wondering if there's a safe way to modify system files. For example, when postinst executes I want to edit /etc/login.defs to alter a setting. I could use sed to do this, which would leave the rest of the file intact.

I'd like to make this something completely reversible, but I'm not sure what Debian packages typically do in this situation. Do they just create a backup named something like /etc/file.conf.backup?

share|improve this question

2 Answers 2

up vote 1 down vote accepted

Packages should never modify files belonging to other packages.

See http://www.debian.org/doc/debian-policy/ch-files.html at 10.7.4

You can't just edit a configuration file belonging to another package. If that package supports conf.d directory you can put your own configuration file into it.

If the package from where the conffile comes does not provide any tool to edit it, you should ask the question to the debian-devel mailing list.

share|improve this answer
    
This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post. –  Tog Jan 31 '13 at 8:55
    
Better if i explain WHY he can't to that? –  LtWorf Jan 31 '13 at 12:35
    
Yes, sorry for the brevity –  Tog Feb 6 '13 at 11:59

I think dpkg-divert might be a good solution to my problem: http://www.debian.org/doc/debian-policy/ap-pkg-diversions.html

share|improve this answer

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.