自定义重新配置的debian包的清除错误

时间:2015-09-08 14:07:09

标签: linux debian

我尝试构建一个debian包来替换lirc初始脚本

我被引用Building a preconfigured debian packageHow to use dpkg-divert to temporarily remove/replace symlink when package is installed?Debian Policy Manual Appendix G

但它有移除包的问题。

这是安装提示,可以成功安装

设置mylirctest(0.0.1)......

Configuration file '/etc/init.d/lirc'
==> Deleted (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.
*** lirc (Y/I/N/O/D/Z) [default=N] ? Y
Installing new version of config file /etc/init.d/lirc ...
Processing triggers for ureadahead (0.100.0-16) ...

进展我的包

时出现问题
(Reading database ... 148259 files and directories currently installed.)
Removing mylirctest (0.0.1) ...
Removing 'diversion of /etc/init.d/lirc to /etc/init.d/lirc.disable by      mylirctest'
dpkg-divert: error: rename involves overwriting `/etc/init.d/lirc' with
different file `/etc/init.d/lirc.disable', not allowed
dpkg: error processing package hdstation (--purge):
subprocess installed post-removal script returned error exit status 2
Errors were encountered while processing:
mylirctest

这是我的preinst文件:

#/bin/sh
set -e
dpkg-divert --package mylirctest --add --rename --divert /etc/init.d/lirc.disable /etc/init.d/lirc

后台

#!/bin/sh
set -e
dpkg-divert --package mylirctest --remove --rename --divert /etc/init.d/lirc.disable /etc/init.d/lirc

我的postrm有什么问题吗? 如何在安装我的deb软件包时禁用提示信息?

非常感谢

2 个答案:

答案 0 :(得分:0)

这是一个有问题的问题,但我已经遇到了同样的问题并修复了问题,所以如果有人需要,我们会给出答案:

要在postrm中使用dpkg-divert正确恢复文件,您必须先删除当前文件,如下所示:

#!/bin/sh
set -e
rm /etc/init.d/lirc
dpkg-divert --package mylirctest --remove --rename --divert /etc/init.d/lirc.disable /etc/init.d/lirc

答案 1 :(得分:0)

Debian实验频道有一个重要的更新。这是一个全新配置的重大更新。也就是说,这里暴露的旧lirc包装错误应该在更新的包中修复(0.9.4b)