package.init 未安装
我在 debian 目录中有一个 project.init
文件(以及 rules
、control
等),并且我有 dh_installinit< /code> 在我的
rules
文件中(在 binary-arch
规则中)。
当dpkg-buildpackage
完成时,init脚本已被复制到debian/project/etc/init.d/project
,并且各种前/后脚本已被创建。
但是,当我实际安装 .deb(使用 dpkg -i )时,init.d 脚本没有安装,所以我一定错过了这个过程的一部分。 “新维护者指南”在 init.d 细节上非常稀疏(它基本上说不要使用它们,因为它们太先进了)。
dh_installinit 命令的详细输出为:
dh_installinit
install -p -m755 debian/project.init debian/project/etc/init.d/project
echo "# Automatically added by dh_installinit">> debian/project.postinst.debhelper
sed "s/#SCRIPT#/project/;s/#INITPARMS#/defaults/;s/#ERROR_HANDLER#/exit \$?/" /usr/share/debhelper/autoscripts/postinst-init >> debian/project.postinst.debhelper
echo '# End automatically added section' >> debian/project.postinst.debhelper
echo "# Automatically added by dh_installinit">> debian/project.prerm.debhelper
sed "s/#SCRIPT#/project/;s/#INITPARMS#/defaults/;s/#ERROR_HANDLER#/exit \$?/" /usr/share/debhelper/autoscripts/prerm-init >> debian/project.prerm.debhelper
echo '# End automatically added section' >> debian/project.prerm.debhelper
echo "# Automatically added by dh_installinit">> debian/project.postrm.debhelper
sed "s/#SCRIPT#/project/;s/#INITPARMS#/defaults/;s/#ERROR_HANDLER#/exit \$?/" /usr/share/debhelper/autoscripts/postrm-init >> debian/project.postrm.debhelper
echo '# End automatically added section' >> debian/project.postrm.debhelper
I have a project.init
file in the debian directory (along with rules
, control
, etc), and I have dh_installinit
in my rules
file (in the binary-arch
rule).
When dpkg-buildpackage
completes, the init script has been copied to debian/project/etc/init.d/project
, and the various pre/post scripts have been created.
However, when I actually install the .deb (with dpkg -i
), the init.d script does not get installed, so I must be missing part of this process. The "New Maintainer's Guide" is pretty sparse on init.d details (it basically says not to use them, because they are too advanced).
The verbose output of the dh_installinit command is:
dh_installinit
install -p -m755 debian/project.init debian/project/etc/init.d/project
echo "# Automatically added by dh_installinit">> debian/project.postinst.debhelper
sed "s/#SCRIPT#/project/;s/#INITPARMS#/defaults/;s/#ERROR_HANDLER#/exit \$?/" /usr/share/debhelper/autoscripts/postinst-init >> debian/project.postinst.debhelper
echo '# End automatically added section' >> debian/project.postinst.debhelper
echo "# Automatically added by dh_installinit">> debian/project.prerm.debhelper
sed "s/#SCRIPT#/project/;s/#INITPARMS#/defaults/;s/#ERROR_HANDLER#/exit \$?/" /usr/share/debhelper/autoscripts/prerm-init >> debian/project.prerm.debhelper
echo '# End automatically added section' >> debian/project.prerm.debhelper
echo "# Automatically added by dh_installinit">> debian/project.postrm.debhelper
sed "s/#SCRIPT#/project/;s/#INITPARMS#/defaults/;s/#ERROR_HANDLER#/exit \$?/" /usr/share/debhelper/autoscripts/postrm-init >> debian/project.postrm.debhelper
echo '# End automatically added section' >> debian/project.postrm.debhelper
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
您的软件包在
/var/lib/dpkg/status
的Conffiles
块下是否有初始化脚本的条目,例如/var/lib/dpkg /info/.conffiles
包含/etc/init.d/
?这是发生的事情...
默认情况下,init 脚本被标记为配置文件,因为它们位于
/etc
下。1我猜您安装了该软件包,删除了 init文件,然后重新安装该软件包。
在这种情况下,删除 init 文件算作修改它2,并且
dpkg
拒绝“覆盖”“配置文件”。您应该能够通过从
/var/lib/dpkg/status
中删除Conffiles
部分来解决该问题。:
d41d8cd98f00b204e9800998ecf8427e
,但任何不匹配的校验和都会导致相同的行为Does your package have an entry for your init script under the
Conffiles
block in/var/lib/dpkg/status
, e.g.and does
/var/lib/dpkg/info/<project>.conffiles
contain/etc/init.d/<project>
?Here's what's happening...
init scripts are marked as configuration files by default, since they live under
/etc
.1I'm guessing you installed the package, removed the init file, then reinstalled the package.
In this case, removing the init file counts as modifying it2, and
dpkg
refuses to "overwrite" the "configuration file".You should be able to fix the problem by removing the
Conffiles
section from/var/lib/dpkg/status
.Notes:
d41d8cd98f00b204e9800998ecf8427e
, but any non-matching checksum will cause the same behavior我相信您应该查看实用程序脚本“update-rc.d”,它负责在 /etc/init.d/ 中创建/删除符号链接。
在 DEBIAN 控制文件“postinst”和“postinst”中使用此脚本 “postrm”。
例如“postinst”:
update-rc.d mswitch start 20 2 3 4 5 。 停止 0 1 6 。
例如“postrm”:
update-rc.d mswitch 删除
I believe you should be looking at the utility script "update-rc.d" which takes care of creating / removing symlinks in /etc/init.d/ .
Use this script in the DEBIAN control files "postinst" & "postrm".
E.g. for 'postinst':
update-rc.d mswitch start 20 2 3 4 5 . stop 0 1 6 .
E.g. for 'postrm':
update-rc.d mswitch remove
此时,我将检查创建的 .deb 文件的内容。 您可以使用 dpkg-deb -c 来实现此目的。
如果 init 脚本位于 .deb 中,则应将其安装在 /etc/init.d 中,如下所示:
如果您运行最新版本的 Debian,则软件包的内容可能是从 debian/tmp 而不是 debian 生成的/project 正如你所期望的那样。 您可以使用 dh_install 将文件从 debian/projet 移动到 debian/tmp。
At this point I would check the content of the .deb file that is created. You can use dpkg-deb -c for that purpose.
If the init script is in the .deb, it should get installed in /etc/init.d, just like this:
If your run a recent version of Debian, the content of your package may be generate from debian/tmp instead of debian/project as you seem to expect. You can move the files from debian/projet to debian/tmp using dh_install.
只是猜测,您是否对其他 dh_* 脚本使用了 -P 选项,但没有对这个脚本使用? 如果您使用该选项,则需要在所有 dh_* 脚本上使用它。
Just a guess, are you using a -P option to other dh_* scripts but not this one? If you use that option, you need to use it on all the dh_* scripts.
当我只将 project.init 文件放入 debian-folder 并且不向规则文件添加任何特殊约束时,我取得了成功。 此步骤生效后,请测试添加您的特殊约束。
要控制 debian-folder
cat *.postinst.debhelper
中的成功,包含:I had success, when i only put the project.init file into debian-folder and do not add any special constraints to the rules-file. After this step is working, test to add you're special constraints.
To control the success in debian-folder
cat *.postinst.debhelper
contains: