1

I work in linux based environment where we also need to access some test servers inside our intranet.

To do it, I updated my /etc/hosts entry to let system know "who is who". Inside our team we got also an idea, that we will "build" our .deb packages to ease life of newbies in the company. Idea is to run the .deb and let it do by yourselves.

My task is to provide a .deb package which will provide the /etc/hosts entry to everyone who will run it.

So far I have found augeas tool to programaticvally change the entry. But now, I am clueless how to actually make it happen during the .deb package install.

I can easily make a sh script to install to everyone, so it would be 2 step: Install my deb package and then write name of shell script and actually do it.

What I would like to do is to actually let user just install the deb package with result that /etc/hosts is changed. Any link to documentation how to do it would be appreciated. Thanks.

  • Have you considered using a configuration management system to manage configurations? – matthias krull Dec 10 '13 at 17:34
0

/var/lib/dpkg/info/.{preinst,postinst,prerm,postrm}

These scripts will be called before/after install/uninstall. Practically, installing a .deb means thw following:

1: running preinst script

2: unpacking the files

3: running postinst script

Uninstalling one means:

1: running prerm script

2: unpacking the files

3: running postrm script


Sometimes debian guidelines and checking scripts make you a lot of warning, because your inst/uninst scripts don't match the dreams of some hardcore debian dpkg finetuner. I suggest to ignore them - your packages are about your dreams, and not about theirs. ;-)

  • The guidelines have nothing to do with dreams and warnings should be cared about. At least in a corporate environment I would strongly suggest to take warnings from the package system seriously. – matthias krull Dec 10 '13 at 17:31
  • If they were rational warnings, I said the same. – peterh Dec 11 '13 at 8:09
  • the postinst - is it a shell script? – Pavel Janicek Dec 11 '13 at 8:36
  • It can be anything. Debian uses mostly, but not always, shellscripts. – peterh Dec 11 '13 at 8:48
  • Those warnings are rational in the context of a stable multiplatform operatingsystem and are explained in the Debian policy manual. If those rules allow for exceptions there are ways to override and remove the warning. The strictness helped keeping debian stable and maintainable for years. Iff you fully understand all the implications that come with warnings and errors you might ignore them but giving the general advice to do that is plain wrong. – matthias krull Dec 11 '13 at 10:01

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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