I’m writing a snap and during the install I want to ask the user a no. of questions.
My first thought was to put some ‘read’ statements in the install hook but I’ve since found this doesn’t work/isn’t allowed.
So the question is, how do you get data from a user during the install process?
e.g. database password…
Probably not possible, best bet is to write a script that you can execute after installation as part of an app.
Or use snap config.
Indeed, this is explicitly not allowed because it opens a number of corner cases that we know too well from our experience with other package managers.
We intend to support the ability to express the fact a snap is not yet ready for use after installed, pending an interface or a configuration option.
With that said, the best alternative is to give people working software out of the box with sane defaults, when that’s possible. For example, if a database needs a password, set a random one up during install and store it in the snap configuration via
snapctl set default-password="..."
That may be queried by the user with:
$ snap get yoursnap default-password