如何显示安装 .deb 包将采取的操作?

Sam*_*man 40 aptitude dpkg apt

我希望能够查看与要升级的程序包关联的脚本/触发器,以便我可以判断它是否会导致 Web 服务器重新启动。我找不到一个 aptitude 选项来向我展示(或 apt/dpkg);我能得到的最好的是内容(文件)。是否有一些我错过的模拟/详细/内容开关组合会显示这一点?

此外,如果某个包导致发生某些事情(例如服务重启),而我现在不想发生这种情况,是否有办法在不运行部分或全部脚本的情况下安装该包?

Mik*_*l S 26

您可以使用 打印控制文件和其他一些信息dpkg -I package.deb,或者使用dpkg -e package.deb仅提取控制信息文件。

此外,您可以进行试运行以查看 dpkg 将如何处理--dry-run

dpkg --dry-run -i package.deb
Run Code Online (Sandbox Code Playgroud)

  • -e 选项将创建一个包含 `control` 文件和将运行的各种脚本文件的 `DEBIAN` 目录。`postinst` 通常很有趣,因为它会在软件包安装成功后执行。 (3认同)
  • 注意:您需要在本地拥有可用的包文件。首先通过“aptitude download <packagename>”下载。 (2认同)

sle*_*ske 9

不,我不知道使用 aptitude 有什么方法可以做到这一点。

可以直接看脚本;升级期间运行的脚本包含在包中。使用 ar 解压 deb:

ar -x package.deb
Run Code Online (Sandbox Code Playgroud)

然后查看control.tar.gz,它包含脚本。


小智 9

还有 的--debug选项dpkg,如sudo dpkg --debug=72200 -i package.deb

有多个可用选项用于详细输出,并且可以将它们组合起来。

您可以通过运行以下命令查看所有可用选项dpkg --debug=help

pi@kaldi:~ $ dpkg --debug=help
dpkg debugging option, --debug=<octal> or -D<octal>:

 Number  Ref. in source   Description
      1  general          Generally helpful progress information
      2  scripts          Invocation and status of maintainer scripts
     10  eachfile         Output for each file processed
    100  eachfiledetail   Lots of output for each file processed
     20  conff            Output for each configuration file
    200  conffdetail      Lots of output for each configuration file
     40  depcon           Dependencies and conflicts
    400  depcondetail     Lots of dependencies/conflicts output
  10000  triggers         Trigger activation and processing
  20000  triggersdetail   Lots of output regarding triggers
  40000  triggersstupid   Silly amounts of output regarding triggers
   1000  veryverbose      Lots of drivel about eg the dpkg/info directory
   2000  stupidlyverbose  Insane amounts of drivel

Debugging options can be mixed using bitwise-or.
Note that the meanings and values are subject to change.
Run Code Online (Sandbox Code Playgroud)