gpt4 book ai didi

shell - 如何在 Debian postinst 脚本中获取新安装的版本?

转载 作者:行者123 更新时间:2023-12-04 01:53:26 24 4
gpt4 key购买 nike

根据 Debian Policy Manual ,我的 postinst 脚本在升级和配置时被调用,作为“postinst configure old-version”,其中 old-version 是以前安装的版本(可能为 null)。我想确定新版本,即当前正在配置(升级到)的版本。

环境变量$DPKG_MAINTSCRIPT_PACKAGE包含包名;似乎没有等效的 _VERSION field 。 /var/lib/dpkg/status在 postinst 运行后更新,所以我似乎也无法从那里解析它。

有任何想法吗?

最佳答案

将以下内容添加到 debian/rules :

override_dh_installdeb:
dh_installdeb
for pkg in $$(dh_listpackages -i); do \
sed -i -e 's/__DEB_VERSION__/$(DEB_VERSION)/' debian/$$pkg/DEBIAN/*; \
done

它将替换任何出现的 __DEB_VERSION__在带有版本号的 debian 脚本中。

关于shell - 如何在 Debian postinst 脚本中获取新安装的版本?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/715313/

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