Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/shell/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Shell 在debian maintainer脚本中寻找通用函数_Shell_Debian_Dpkg_Post Install - Fatal编程技术网

Shell 在debian maintainer脚本中寻找通用函数

Shell 在debian maintainer脚本中寻找通用函数,shell,debian,dpkg,post-install,Shell,Debian,Dpkg,Post Install,我有许多常用函数,我想从中获取它们,因此可以在debian maintainer脚本(preinst/postinst/prerm/postrm)中找到它们,称之为common.sh 如果我将“common.sh”添加到DEBIAN目录,dpkg会抱怨: dpkg-deb: warning: conffile '' is not a plain file dpkg-deb: warning: ignoring 1 warning about the control file(s) 但是,包的构

我有许多常用函数,我想从中获取它们,因此可以在debian maintainer脚本(preinst/postinst/prerm/postrm)中找到它们,称之为common.sh

如果我将“common.sh”添加到DEBIAN目录,dpkg会抱怨:

dpkg-deb: warning: conffile '' is not a plain file
dpkg-deb: warning: ignoring 1 warning about the control file(s)
但是,包的构建是正确的

安装时,很难找到common.sh所在的正确目录。在安装前,它似乎在寻找
/var/lib/dpkg/tmp.ci
,而在安装后,它似乎在寻找
/var/lib/dpkg/info

我可以将common.sh粘贴到tmp目录中,稍后再将其删除,但我感觉安装到操作系统上的文件应该保持不变,直到dpkg可以删除它们


无论如何,我想知道真正的“debian”方法是什么?

preinst是从某个实现定义的目录运行的,因为包尚未解压缩到文件系统中的正确位置

我很确定,标准软件包不允许在DEBIAN部分强制添加额外的文件。您可以将common.sh安装到文件系统中,通常在/usr/share/yourpackagename/下,并从postinst和prerm脚本中使用它


它不适用于preinst和postrm,因为当时包的内容不可用。

好吧,我算出了第一部分。。。conffile“”不是普通文件是因为我在其中有一个字节“\n”。一旦它完全干净,警告就消失了。。。因此,这只是在安装前和安装后脚本之间实现通用功能的标准方式……感谢Andreas。是的,这就是我最后做的。如果我需要这个功能,我会等待postinst。