PKGBUILD 究竟是什么,我应该在安装软件包时编辑它吗?

aht*_*rix 6 compiling arch-linux pacman package-management

每当我yaourt -Syua在 Manjaro Linux 系统中使用时,它都会给我

Edit PKGBUILD ? [Y/n] ("A" to abort)
Run Code Online (Sandbox Code Playgroud)

而有时

Edit chromium-pepper-flash.install ? [Y/n] ("A" to abort)
Run Code Online (Sandbox Code Playgroud)

在某处我读到只是说不编辑这些文件。

维基:https : //wiki.archlinux.org/index.php/PKGBUILD

PKGBUILD只是在安装时需要更改一些开关,所以保留默认值可以吗?

我没有找到有关.install文件的信息,它们是什么?

don*_*sti 10

你为什么不彻底阅读你链接的维基页面:

Arch Linux 中的软件包是使用makepkg实用程序和存储在 PKGBUILD 中的信息构建的。当makepkg运行时,它会 在当前目录中搜索 PKGBUILD按照其中的说明编译或以其他方式获取文件以构建包文件

因此,PKGBUILD是一个“配方”用于创建包(类似于RPM specgentoo ebuild等等)。有时,当安装/删除/升级包时,可能需要在将包文件写入磁盘/从磁盘删除之前/之后自动执行一些脚本/程序,因此需要额外的“配方”,即.install (摘自相同的链接):

安装

要包含在包中的.install脚本的名称。pacman 能够在安装、删除或升级包时存储和执行特定于包的脚本。该脚本包含以下在不同时间运行的函数

pre_install - The script is run right before files are extracted. One argument is passed: new package version.
post_install - The script is run right after files are extracted. One argument is passed: new package version.
pre_upgrade - The script is run right before files are extracted. Two arguments are passed in the following order: new package version, old package version.
post_upgrade - The script is run after files are extracted. Two arguments are passed in the following order: new package version, old package version.
pre_remove - The script is run right before files are removed. One argument is passed: old package version.
post_remove - The script is run right after files are removed. One argument is passed: old package version.
Run Code Online (Sandbox Code Playgroud)

通常,您编辑PKGBUILD以自定义构建包的方式(例如添加/删除--configure选项、更改安装前缀、修补源代码、从包中排除文件等)。同样,您编辑.install以添加或删除应在软件包安装/升级/删除之前/之后自动执行的命令。
我会说在提示时打开这些文件并阅读它们的内容是一种很好的做法,以确保一切正常。