安裝程式時如何註冊確認選項的命令?

安裝程式時如何註冊確認選項的命令?

在 Ubuntu 18.04 上透過終端命令安裝 SageMath 時

sudo apt-get install sagemath

我收到一則通知:

Postfix Configuration
---------------------

Please select the mail server configuration type that best meets your needs.

 No configuration:
  Should be chosen to leave the current configuration unchanged.
 Internet site:
  Mail is sent and received directly using SMTP.
 Internet with smarthost:
  Mail is received directly using SMTP or by running a utility such
  as fetchmail. Outgoing mail is sent using a smarthost.
 Satellite system:
  All mail is sent to another machine, called a 'smarthost', for delivery.
 Local only:
  The only delivered mail is the mail for local users. There is no network.

  1. No configuration 3. Internet with smarthost 5. Local only
  2. Internet Site 4. Satellite system
General type of mail configuration:

每次安裝時SageMath,我都必須選擇[1. No configuration] 選項

如何編寫命令並確保在執行 SageMath 安裝命令時選擇並驗證自動機器選項[1. No configuration]?這有點像-y國旗慣例[../YES]

我該怎麼做?只是手動執行此操作對我來說是有問題的,因為我透過 Bash 腳本與其他安裝套件和程式啟動安裝。每次我都必須停在該選項的 SageMath 設定處並"1"手動輸入該數字。在 GNU/Linux 中,是否可以自動驗證指定指令的選項?

答案1

我得到了答案!透過命令安裝:

yes '' | sudo env DEBIAN_FRONTEND=noninteractive apt-get -y -o DPkg::options::="--force-confdef" -o DPkg::options::="--force-confold" install sagemath

相關內容