使用 Bash echo 回答 pkgadd 提示

Answer pkgadd prompts using Bash echo

我正在尝试使用 pkgadd 实用程序在 Solaris 10 上静默安装软件包。参见示例:

pkgadd -G -D pkg123_x64.pkg
"Select package(s) you wish to process (or 'all' to process all packages).

这通过管道 echopkgadd:

来解决
echo "all" | pkgadd -G -D pkg123_x64.pkg
"Processing package instance <pkg123>.."
"This package contains scripts which will be executed with super-user permission during the process of installing this package. Do you want to continue with the installation [y,n,?]

一切顺利。但我不确定如何回答第二个问题。我试过:

echo "all y" | pkgadd -G -D pkg123_x64.pkg

但这不起作用。这可能吗?

使用:GNU bash 版本 3.2.51(1) 索拉里斯 10

您可以创建 package response file:

Using a Response File (pkgadd)

A response file contains your answers to specific questions that are asked by an interactive package. An interactive package includes a request script that asks you questions prior to package installation, such as whether optional pieces of the package should be installed.

If you know prior to installation that the package is an interactive package, and you want to store your answers to prevent user interaction during future installations, use the pkgask command to save your response. For more information on this command, see pkgask(1M).

Once you have stored your responses to the questions asked by the request script, you can use the pkgadd -r command to install the package without user interaction.

来自the pkgask man page

Description

pkgask allows the administrator to store answers to an interactive package (one with a request script, that is, a user-created file that must be named request). Invoking this command generates a response file that is then used as input at installation time. The use of this response file prevents any interaction from occurring during installation since the file already contains all of the information the package needs.