package.init 未安装

发布于 2024-07-21 11:35:54 字数 1704 浏览 10 评论 0原文

我在 debian 目录中有一个 project.init 文件(以及 rulescontrol 等),并且我有 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

凉城已无爱 2024-07-28 11:35:54

您的软件包在 /var/lib/dpkg/statusConffiles 块下是否有初始化脚本的条目,例如

Package: <project>
...
Conffiles:
 /etc/init.d/<project> d41d8cd98f00b204e9800998ecf8427e

/var/lib/dpkg /info/.conffiles 包含 /etc/init.d/

这是发生的事情...

默认情况下,init 脚本被标记为配置文件,因为它们位于 /etc 下。1

我猜您安装了该软件包,删除了 init文件,然后重新安装该软件包。

在这种情况下,删除 init 文件算作修改它2,并且 dpkg 拒绝“覆盖”“配置文件”。

您应该能够通过从 /var/lib/dpkg/status 中删除 Conffiles 部分来解决该问题。

  1. conffiles - Debian 新维护者指南
  2. 注意 空文件具有 MD5sum d41d8cd98f00b204e9800998ecf8427e,但任何不匹配的校验和都会导致相同的行为

Does your package have an entry for your init script under the Conffiles block in /var/lib/dpkg/status, e.g.

Package: <project>
...
Conffiles:
 /etc/init.d/<project> d41d8cd98f00b204e9800998ecf8427e

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.1

I'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:

  1. conffiles - Debian New Maintainer's Guide
  2. An empty file has MD5sum d41d8cd98f00b204e9800998ecf8427e, but any non-matching checksum will cause the same behavior
青春如此纠结 2024-07-28 11:35:54

我相信您应该查看实用程序脚本“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

原谅我要高飞 2024-07-28 11:35:54

此时,我将检查创建的 .deb 文件的内容。 您可以使用 dpkg-deb -c 来实现此目的。

如果 init 脚本位于 .deb 中,则应将其安装在 /etc/init.d 中,如下所示:

...
drwxr-xr-x root/root         0 2009-06-03 14:01 ./etc/
drwxr-xr-x root/root         0 2009-06-03 14:01 ./etc/init.d/
-rwxr-xr-x root/root      2558 2009-02-13 11:27 ./etc/init.d/balance
...

如果您运行最新版本的 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:

...
drwxr-xr-x root/root         0 2009-06-03 14:01 ./etc/
drwxr-xr-x root/root         0 2009-06-03 14:01 ./etc/init.d/
-rwxr-xr-x root/root      2558 2009-02-13 11:27 ./etc/init.d/balance
...

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.

在风中等你 2024-07-28 11:35:54

只是猜测,您是否对其他 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.

抚笙 2024-07-28 11:35:54

当我只将 project.init 文件放入 debian-folder 并且向规则文件添加任何特殊约束时,我取得了成功。 此步骤生效后,请测试添加您的特殊约束。

要控制 debian-folder cat *.postinst.debhelper 中的成功,包含:

# Automatically added by dh_installinit
if [ -x "/etc/init.d/<packagename>" ]; then
    if [ ! -e "/etc/init/<packagename>.conf" ]; then
        update-rc.d <packagename> defaults >/dev/null
    fi
    invoke-rc.d <packagename> start || exit $?
fi

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:

# Automatically added by dh_installinit
if [ -x "/etc/init.d/<packagename>" ]; then
    if [ ! -e "/etc/init/<packagename>.conf" ]; then
        update-rc.d <packagename> defaults >/dev/null
    fi
    invoke-rc.d <packagename> start || exit $?
fi
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文