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?