Dpkg

為 dpkg 的配置文件提示指定差異選項

  • June 2, 2015

修改 conffile 時,dpkg會提示您如何操作:

Configuration file '/etc/apache2/mods-available/ssl.conf'
==> Modified (by you or by a script) since installation.
==> Package distributor has shipped an updated version.
  What would you like to do about it ?  Your options are:
   Y or I  : install the package maintainer's version
   N or O  : keep your currently-installed version
     D     : show the differences between the versions
     Z     : start a shell to examine the situation
The default action is to keep your current version.
*** ssl.conf (Y/I/N/O/D/Z) [default=N] ? 

當您選擇D時,它將diff -Nu在目前和新的配置文件上執行。

**您如何指定不同的diff選項?**特別是,我經常想指定-b. (顯然,您可以手動重新執行 diff,但這遠不方便。)

看來你不能;diff 選項被硬編碼在dpkg’s 的原始碼中。來自src/configure.c

           /* Child process. */
           char cmdbuf[1024];

           sprintf(cmdbuf, DIFF " -Nu %.250s %.250s | %.250s",
                   str_quote_meta(old), str_quote_meta(new),
                   command_get_pager());

           command_shell(cmdbuf, _("conffile difference visualizer"));

DIFF是一個宏,lib/dpkg/dpkg.h並且被定義為"diff". 所以這是diff -Nu硬編碼的。

這可能是Debian 錯誤 #380332

引用自:https://unix.stackexchange.com/questions/207117