我正在尝试配置debian包,以便在安装时执行一些只需要执行一次的操作(更具体地说,我想使用gconftool-2
设置一些应用程序首选项)。我以前从未使用过debian包,我不确定是否有"安装时这样做"属性。感谢您的帮助。
您正在寻找configure
脚本,或者可能是post-install
脚本。您可能应该阅读其中一个打包教程。
在Debian文件夹中,创建一个postinst
shell脚本,并根据该脚本执行修改。如果您有一个不同的工具来修改首选项,那么从脚本中调用该工具。
#!/bin/sh -e
#DEBHELPER#
# Source debconf library.
. /usr/share/debconf/confmodule
if [ "$1" = "configure" ]
then
# Do your work here
# (the following gconftool-2 example is not valid, but it gives an idea)
gconftool-2 mouse swap-buttons
fi
非常重要:#DEBHELPER#
模式将根据需要替换为debian脚本。把它写在你的剧本里是非常重要的。它通常会首先出现,尽管你以前可能有一些代码,但很少看到这样的代码。