Ubuntu 18.04 debconfがプロンプトを表示する

Ubuntu 18.04 debconfがプロンプトを表示する

bash スクリプトを使用して、Ubuntu 18.04 に MySQL 8.0 を自動的にインストールしようとしています。debconf プロンプトが要求するすべての変数を設定しましたが、プロンプトはとにかく表示されます。スクリプトの何が間違っているのでしょうか?

#!/bin/bash

export DEBIAN_FRONTEND=noninteractive

MYSQL_APT_FILE_NAME="mysql_apt_repository_tmp.deb"

echo "Installing MySQL Community Server..."

wget "https://dev.mysql.com/get/mysql-apt-config_0.8.14-1_all.deb" -O 
$MYSQL_APT_FILE_NAME &> /dev/null

if [ -z "$(ls | grep $MYSQL_APT_FILE_NAME)" ]; then
    echo "ERROR: Unable to download MySQL APT repository file"
    exit 0
fi

echo mysql-apt-config mysql-apt-config/repo-distro select ubuntu | debconf-set-selections
echo mysql-apt-config mysql-apt-config/repo-codename select trusty | debconf-set-selections
echo mysql-apt-config mysql-apt-config/select-server select mysql-8.0 | debconf-set-selections
echo mysql-apt-config mysql-apt-config/select-tools select Enabled | debconf-set-selections
echo mysql-apt-config mysql-apt-config/select-preview select Disabled | debconf-set-selections
echo mysql-community-server mysql-community-server/root-pass password mystrongpassword | debconf-set-selections
echo mysql-community-server mysql-community-server/re-root-pass password mystrongpassword | debconf-set-selections

sudo dpkg -i $MYSQL_APT_FILE_NAME

答え1

この問題は解決しました。sudoこの行から削除する必要がありました

sudo dpkg -i $MYSQL_APT_FILE_NAME

その後、スクリプト全体を sudo として実行します。

関連情報