gpt4 book ai didi

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

转载 作者:太空宇宙 更新时间:2023-11-04 03:33:24 25 4
gpt4 key购买 nike

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

我已被引用Building a preconfigured debian package , How 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

这是我的预安装文件:

#/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 包时禁用提示消息?

非常感谢

最佳答案

这是一个一年前的问题,但我遇到了同样的问题并解决了它,所以这里是答案,以防有人需要它:

要在 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

关于linux - 自定义重新配置的 debian 包的清除错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32459988/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com