How to do *dpkg-reconfigure dash* as bash automatically

Solution 1:

You can make debconf only ask for high or critical questions[1].

Ex:

dpkg-reconfigure -p critical dash

dpkg-reconfigure will use default answer defined in debconf script. You can also use debconf-get-selections to pick up different answer for noninteractive installation[2].

  1. https://wiki.debian.org/debconf
  2. http://blog.nutsfactory.net/2008/03/06/noninteractive-dpkg-installation-on-debian-system/

Solution 2:

Pasting Daniel's comment as an answer here since it doesn't rely on default settings from dpkg-reconfigure.

To get options:

debconf-show dash

To set this particular option to false:

echo "dash dash/sh boolean false" | debconf-set-selections

and to actually reconfigure the package:

DEBIAN_FRONTEND=noninteractive dpkg-reconfigure dash

This worked for me from a Dockerfile:

# make /bin/sh symlink to bash instead of dash:
RUN echo "dash dash/sh boolean false" | debconf-set-selections
RUN DEBIAN_FRONTEND=noninteractive dpkg-reconfigure dash