![postinst 脚本在安装后不运行](https://linux22.com/image/107997/postinst%20%E8%84%9A%E6%9C%AC%E5%9C%A8%E5%AE%89%E8%A3%85%E5%90%8E%E4%B8%8D%E8%BF%90%E8%A1%8C.png)
我有一个具有以下文件夹结构的文件夹:
total 8
drwxr-xr-x 2 pi pi 4096 mar 21 19:08 DEBIAN
drwxr-xr-x 6 pi pi 4096 mar 21 18:02 usr
里面的DEBIAN
文件夹:
-rw-r--r-- 1 pi pi 150 mar 21 18:05 changelog
-rw-r--r-- 1 pi pi 2 mar 21 18:05 compat
-rw-r--r-- 1 pi pi 516 mar 21 18:05 control
-rw-r--r-- 1 pi pi 13774 mar 21 18:05 copyright
-rwxr-xr-x 1 pi pi 1396 mar 21 20:45 postinst
-rwxr-xr-x 1 pi pi 919 mar 21 19:08 postrm
-rwxr-xr-x 1 pi pi 679 mar 21 19:08 preinst
-rwxr-xr-x 1 pi pi 866 mar 21 19:08 prerm
文件postinst
内容如下:
#!/bin/sh
# postinst script for cpython
#
# see: dh_installdeb(1)
set -e
# summary of how this script can be called:
# * <postinst> `configure' <most-recently-configured-version>
# * <old-postinst> `abort-upgrade' <new version>
# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
# <new-version>
# * <postinst> `abort-remove'
# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
# <failed-install-package> <version> `removing'
# <conflicting-package> <version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
case "$1" in
configure)
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
#echo "postinst called with unknown argument \`$1'" >&2
#exit 1
;;
esac
ln -sf XXX YYY
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
exit 0
使用、、、dh_installdeb
的命令将脚本复制到该文件夹中。 (这些文件是用命令生成的)。package.postinst
package.postrm
package.preinst
package.prerm
dh_make -f
当我运行fakeroot dpkg-deb --build python3.6
创建时.deb
,它会创建.deb
,但是当我尝试安装它时,它不会运行postinst
(它不会创建脚本中出现的符号链接)。
一件奇怪的事情是,在该DEBIAN
文件夹中,脚本包含以下内容:
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
如果我提取生成的内容.deb
并检查postinst
文件,我会观察到相同的消息:
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
这句话让我觉得我忘记了什么或者做错了什么。
postinst
为什么我的脚本在sudo dpkg -i xxx.deb
命令之后不运行?