0

I have build my own .deb package with custom /root/.bashrc file. When I try to install this package, I get the following message:

Configuration file '/root/.bashrc'
 ==> File on system created by you or by a script.
 ==> File also in package provided by package maintainer.
   What would you like to do about it ?  Your options are:
    Y or I  : install the package maintainer's version
    N or O  : keep your currently-installed version
      D     : show the differences between the versions
      Z     : start a shell to examine the situation
 The default action is to keep your current version.
*** .bashrc (Y/I/N/O/D/Z) [default=N] ?

I put this line in DEBIAN/preinst:

export DEBIAN_FRONTEND=noninteractive

but it doesn't make any difference, I'm still getting the message. Is there any mechanism to disable this message inside the .deb package? I need it for automated installs so I need absolutely non-interactive installation.

As a workaround, I can put the export inside the deployment script before apt-get install, but I would rather do it in the package.

Thanks in advance

update: I tried the workaround with export in the deployment script, but it doesn't work correctly. The installation runs non-interactively but it doesn't overwrite the .bashrc file because the default choice is N (keep your currently-installed version).

Another workaround is to remove the config file itself from the package and instead "echo" it from the postinst script. But again, it's just a workaround, I would like to achieve it with some directive in the package.

4
  • You should not silently replace the user's custom configuration files without their consent. They could be modified and it would surely not be appreciated if all changes were lost. What exactly do you need to add/replace there anyway? I'm sure there must be a better way to achieve your goals than replacing any .bashrc. That file would not even run if the user uses anything other than Bash as their login shell btw.
    – Byte Commander
    Jul 19, 2017 at 10:59
  • My goal is not to replace user .bashrc but to install a new server with a custom root .bashrc so there are no changes to be kept and no users to be concerned :-)
    – S3v3ran
    Jul 19, 2017 at 11:11
  • "My goal is not to replace user .bashrc ", but root is a user. If a package messed with my ~root/.bashrc, I'd be strongly tempted to track down the package provider and "reason" with him/her.
    – waltinator
    Jul 19, 2017 at 13:37
  • In this case root is me so I don't need to reason with anyone, I just need to deploy customized servers. Nevertheless, the question was not "why to do something" but "HOW to do something".
    – S3v3ran
    Jul 19, 2017 at 13:46

0

You must log in to answer this question.

Browse other questions tagged .