github.com/goreleaser/goreleaser@v1.25.1/www/docs/cookbooks/debconf-templates.md (about)

     1  # Use debconf and templates
     2  
     3  Deb installation format has a support for user input during installation using [debconf](https://manpages.debian.org/testing/debconf-doc/debconf-devel.7.en.html).
     4  
     5  To enable it inside `goreleaser` you need:
     6  
     7  `templates` file, what to ask (all templates go into single file):
     8  
     9  ```none
    10  Template: foo/like_debian
    11  Type: boolean
    12  Description: Do you like Debian?
    13   We'd like to know if you like the Debian GNU/Linux system.
    14  
    15  Template: foo/why_debian_is_great
    16  Type: note
    17  Description: Poor misguided one. Why are you installing this package?
    18   Debian is great. As you continue using Debian, we hope you will
    19   discover the error in your ways.
    20  ```
    21  
    22  Maintainer script file that will trigger questions, usually its `postinst` because all package files are already installed:
    23  
    24  ```sh
    25  #!/bin/sh -e
    26  
    27  # Source debconf library.
    28  . /usr/share/debconf/confmodule
    29  
    30  # Do you like debian?
    31  db_input high foo/like_debian || true
    32  db_go || true
    33  
    34  # Check their answer.
    35  # with db_get you load value into $RET env variable.
    36  db_get foo/like_debian
    37  if [ "$RET" = "false" ]; then
    38      # Poor misguided one...
    39      db_input high foo/why_debian_is_great || true
    40      db_go || true
    41  fi
    42  ```
    43  
    44  Include `templates` and `postinst` in `.goreleaser.yaml`:
    45  
    46  ```yaml
    47      overrides:
    48        deb:
    49          scripts:
    50            postinstall: ./deb/postinst
    51      deb:
    52        scripts:
    53          templates: ./deb/templates
    54  ```
    55  
    56  Useful tutorial: [Debconf Programmer's Tutorial](http://www.fifi.org/doc/debconf-doc/tutorial.html)