Scroll to navigation

DH_INSTALLINIT(1) Debhelper DH_INSTALLINIT(1)

名前

dh_installinit - ビルドディレクトリに service init ファイルをインストールする

書式

dh_installinit [debhelper options] [--name=name] [-n] [-R] [-r] [-d] [-- params]

説明

dh_installinit is a debhelper program that is responsible for installing init scripts with associated defaults files, as well as upstart job files, and systemd service files into package build directories.

このコマンドは、/etc/rc*.d/ 以下にシンボリックリンクを張り、start と stop 手続きを持つような init スクリプトをセットアップするのに必要な postinst, postrm, prerm コマンドを自動的に生成します。

ファイル

debian/package.init
もし本ファイルが存在すれば、パッケージビルドディレクトリ以下の etc/init/package ディレクトリにインストールされます。
debian/package.default
もしこちらが存在すれば、パッケージビルドディレクトリ内の etc/default/package へこのファイルをインストールします。
debian/package.upstart
もし本ファイルが存在すれば、パッケージビルドディレクトリ以下に etc/init/package.conf ファイルとしてインストールされます。
debian/package.service
If this exists, it is installed into lib/systemd/system/package.service in the package build directory. Only used in compat levels 10 and below.
debian/package.tmpfile
If this exists, it is installed into usr/lib/tmpfiles.d/package.conf in the package build directory. (The tmpfiles.d mechanism is currently only used by systemd.) Only used in compat levels 10 and below.

オプション

-n, --no-scripts
postinst/postrm/prerm スクリプトは変更しないでください。
-o, --only-scripts
Only modify postinst/postrm/prerm scripts, do not actually install any init script, default files, upstart job or systemd service file. May be useful if the file is shipped and/or installed by upstream in a way that doesn't make it easy to let dh_installinit find it.

Caveat: This will bypass all the regular checks and unconditionally modify the scripts. You will almost certainly want to use this with -p to limit, which packages are affected by the call. Example:

 override_dh_installinit:
        dh_installinit -pfoo --only-scripts
        dh_installinit --remaining
    
-R, --restart-after-upgrade
Do not stop the init script until after the package upgrade has been completed. This is the default behaviour in compat 10.

In early compat levels, the default was to stop the script in the prerm, and starts it again in the postinst.

このオプションは、アップグレード中に長く動作が停止してはいけないような daemon を扱う際に便利です。しかしながら、このオプションを利用して dh_installinit が処理をしている間のアップグレード途中のパッケージを daemon が参照して混乱しないことを保証する必要があります。

--no-restart-after-upgrade
Undo a previous --restart-after-upgrade (or the default of compat 10). If no other options are given, this will cause the service to be stopped in the prerm script and started again in the postinst script.
-r, --no-stop-on-upgrade, --no-restart-on-upgrade
init スクリプトをアップグレード中には停止させません。
--no-start
インストール時、あるいはアップグレード時に init スクリプトを start させません。あるいは、パッケージを削除する時にも stop 手続きが呼ばれなくなります。その一方で、update-rc.d のみ呼び出されます。本オプションは rcS スクリプトをインストールする際に便利です。
-d, --remove-d
Remove trailing d from the name of the package, and use the result for the filename the upstart job file is installed as in etc/init/ , and for the filename the init script is installed as in etc/init.d and the default file is installed as in etc/default/. This may be useful for daemons with names ending in d. (Note: this takes precedence over the --init-script parameter described below.)
-uparams --update-rcd-params=params
-- params
paramsupdate-rc.d(8) へ渡します。もし指定されていなければ、defaults パラメータが update-rc.d(8) へ渡されます。
--name=name
パッケージ名の代わりに、name をファイル名とするファイルを、upstart 用 job ファイルや、init スクリプト (あるいはデフォルトのファイル) として利用します。このパラメータが利用されると、dh_installinitdebian/package.name.upstartdebian/package.name.initdebian/package.name.default を探し、インストールを行います。この場合、通常使われる debian/package.upstartdebian/package.initdebian/package.default は利用されません。
--init-script=scriptname
scriptnameetc/init.d/ 以下にインストールする init スクリプトのファイル名として利用します (デフォルトのファイルがインストールされるなら、その時の名前として利用する場合もあります) 。もしこのパラメータを利用すると、dh_installinitdebian/ ディレクトリ以下に package.scriptname のような名前のファイルがあるかどうかを探し、通常インストールするファイルよりも、優先してこのような名前を持つファイルを init スクリプトとして扱うようになります。

このパラメータは廃止されています。代わりに --name パラメータを利用ください。なお、--init-script=scriptname では upstart 用 job ファイルを扱うようには出来ていません。

--error-handler=function
もしinitスクリプトの動作が失敗に終わった時、シェル関数の function を呼び出すようにします。この関数は、prermpostinst の中で定義されていなければならず、また、#DEBHELPER# 句が現れるよりも前に定義されている必要があります。

付記

このコマンドは複数回実行しても安全なコマンドではありません。このコマンドを複数回呼び出す際には必ず間に dh_prep(1) を挿入してください。さもないと、メンテナスクリプト中に同じ内容のコードを繰り返し挿入してしまいます。

参照

debhelper(7)

このプログラムは debhelper の一部です。

作者

Joey Hess <joeyh@debian.org>

Steve Langasek <steve.langasek@canonical.com>

Michael Stapelberg <stapelberg@debian.org>

2017-01-25 10.2.5