【问题标题】:Setup a debian package to perform actions on install设置一个 debian 包以执行安装操作
【发布时间】:2012-02-01 00:55:53
【问题描述】:

我正在尝试配置一个 debian 包以在安装时执行一些操作(更具体地说,我想使用 gconftool-2 设置一些应用程序首选项),这些操作只需要执行一次。我以前从未使用过 debian 软件包,我不确定是否有“安装时执行此操作”属性。任何帮助表示赞赏。

【问题讨论】:

  • 作为旁注,我不认为我想要一个包 breaks 我的 Gnome 配置本身...我了解您的应用程序。如果没有这些更改,可能无法正常工作或无法正常工作,但这是我愿意在我的应用程序中做的事情,并清楚地解释为什么它是必要的。

标签: ubuntu installation debian pkg-config


【解决方案1】:

您正在寻找configure 脚本,或者可能是post-install 脚本。您可能应该正在阅读其中的打包教程。

【讨论】:

    【解决方案2】:

    在 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 脚本。将它包含在您的脚本中非常重要。虽然之前可能有一些代码,但通常预计会首先出现,但这种情况很少见。

    【讨论】:

      猜你喜欢
      • 2019-08-20
      • 2020-01-29
      • 2013-06-02
      • 1970-01-01
      • 2014-06-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多