TASIOMIND.DEV — OPERATIONAL▸▸▸FULL STACK DEVELOPER @ GWQ SERVICEPLUS AG▸▸▸FOUNDER — K8SGPT.AI▸▸▸OPEN SOURCE: ACTIVE▸▸▸DISTRIBUTED SYSTEMS / KUBERNETES / AI▸▸▸RUST + GO + PYTHON▸▸▸FIELD TESTED / STATUS — NOMINAL▸▸▸LOCATION: EUROPE/BERLIN▸▸▸TASIOMIND.DEV — OPERATIONAL▸▸▸FULL STACK DEVELOPER @ GWQ SERVICEPLUS AG▸▸▸FOUNDER — K8SGPT.AI▸▸▸OPEN SOURCE: ACTIVE▸▸▸DISTRIBUTED SYSTEMS / KUBERNETES / AI▸▸▸RUST + GO + PYTHON▸▸▸FIELD TESTED / STATUS — NOMINAL▸▸▸LOCATION: EUROPE/BERLIN▸▸▸

Taking care of prompt imputs from a script with Debconf

August 12, 2017

code
sudo apt install debconf-utils -y

see what possible selections a package may have

code
sudo debconf-get-selections | grep mysql
code
mysql-server-5.7	mysql-server/root_password	password
mysql-server-5.7	mysql-server/root_password_again	password
mysql-server-5.7	mysql-server/no_upgrade_when_using_ndb	error
mysql-server-5.7	mysql-server/password_mismatch	error
mysql-server-5.7	mysql-server-5.7/start_on_boot	boolean	true
mysql-server-5.7	mysql-server-5.7/postrm_remove_databases	boolean	false
mysql-server-5.7	mysql-server-5.7/nis_warning	note
mysql-server-5.7	mysql-server-5.7/really_downgrade	boolean	false

set those selections

code
MYSQL_PASS='your_password'

sudo debconf-set-selections <<< "mysql-server mysql-server/root_password password ${MYSQL_PASS}"
sudo debconf-set-selections <<< "mysql-server mysql-server/root_password_again password ${MYSQL_PASS}"