如何修改 Debian 源代码包以包含额外的可执行脚本?

How to modify a Debian source package to include an additional executable script?

目标: 我想创建一个修改过的Debian源码包,即官方的rrdtool package + "some changes"。其中一项更改是添加了可执行脚本。


我已经使用了多年的补丁包秘诀:

dget http://bla/bla/bla.dsc
cd bla-1.0
(hack hack hack...)
dpkg-source -b .

如果补丁不对任何文件进行 chmod,但使用引入可执行文件的补丁,按照上面的配方会产生此消息:

dpkg-source: warning: executable mode 0755 of 'foobar' will not be represented in diff

果然,当我解压我的新源包时 foobar 存在但不可执行。


据我了解,quilt 处理基于 GNU diff+patch 的补丁。 GNU diff+patch 不处理文件权限。嗯...

那么如何在被子维护的源码包中引入可执行脚本呢?

Googling 没有帮助。好像其他人问过,但是没有回复。

我知道我可以简单地对 *.orig.tar.gz 存档进行修改,但我想尽可能避免这种情况。我只是很惊讶这竟然如此困难...

与涉及 Debian 打包的大多数事情一样,我相信很可能有几种方法可以用来实现您的目标。由于我在这个过程中还是一个新手,所以我要建议的是相当不优雅,但也很容易实现。

Debian Maintainers' Guide 告诉我们 debian/install 文件...

has one line per file installed, with the name of the file (relative to the top build directory) then a space then the installation directory (relative to the install directory). One example of where this is used is if a binary src/bar is left uninstalled; the install file might look like:

src/bar usr/bin

This means when this package is installed, there will be an executable command /usr/bin/bar.

这让我想到,如果您为被子补丁生成的包的新可执行脚本创建了这样一个 debian/install 文件,列出了它相对于构建目录根目录和您希望它的 bindir 的路径驻留在其中,您将根据需要执行程序包。

另一种方法可能是使用 DMM this section 中概述的 postinst 脚本。