事前設定ツールには、 インストール中の一定の箇所でコマンドやスクリプトを実行するといった、 とても強力で柔軟なオプションが存在します。
# d-i preseeding is inherently not secure. Nothing in the installer checks # for attempts at buffer overflows or other exploits of the values of a # preconfiguration file like this one. Only use preconfiguration files from # trusted locations! To drive that home, and because it's generally useful, # here's a way to run any shell command you'd like inside the installer, # automatically. # This first command is run as early as possible, just after # preseeding is read. #d-i preseed/early_command string anna-install some-udeb # This command is run just before the install finishes, but when there is # still a usable /target directory. You can chroot to /target and use it # directly, or use the apt-install and in-target commands to easily install # packages and run commands in the target system. #d-i preseed/late_command string apt-install zsh; in-target chsh -s /bin/zsh
preseed を用いて、質問へのデフォルトの回答を変更できます。 この場合でも質問は行われます。 これには、質問への回答を設定した後で、 seen フラグを 「false」 にリセットしなければなりません。
d-i foo/bar string value d-i foo/bar seen false
ブートプロンプトで preseed/interactive=true
パラメータを設定し、すべて
の質問に対して同じ効果を及ぼすこともできます。
これは事前設定ファイルのテストやデバッグにも便利です。
ブートパラメータを利用して preseed を行う場合、
質問に対して 「?=」 演算子を使用して回答できます。
例:
これはもちろん、
インストール中に実際に表示される質問に対応するパラメータにのみ効果を及ぼし、
「内部」パラメータには効果を及ぼしません。
foo
/bar
?=value
事前設定ファイルから他の事前設定ファイルを読み込めます。 前に読み込まれたファイルの既存設定を、 後から読み込まれたいずれの設定でも上書きします。 これは例えば、あるファイルに一般的なネットワークの設定を書いておき、 他のファイルでより確かな設定を指定するという使い方ができます。
# More than one file can be listed, separated by spaces; all will be # loaded. The included files can have preseed/include directives of their # own as well. Note that if the filenames are relative, they are taken from # the same directory as the preconfiguration file that includes them. #d-i preseed/include string x.cfg # The installer can optionally verify checksums of preconfiguration files # before using them. Currently only md5sums are supported, list the md5sums # in the same order as the list of files to include. #d-i preseed/include/checksum string 5da499872becccfeda2c4872f9171c3d # More flexibly, this runs a shell command and if it outputs the names of # preconfiguration files, includes those files. #d-i preseed/include_command \ # string echo if [ "`hostname`" = bob ]; then echo bob.cfg; fi # Most flexibly of all, this downloads a program and runs it. The program # can use commands such as debconf-set to manipulate the debconf database. # More than one script can be listed, separated by spaces. # Note that if the filenames are relative, they are taken from the same # directory as the preconfiguration file that runs them. #d-i preseed/run string foo.sh
また、 あらかじめ用意したファイルの preseed/url で設定したネットワーク preseed へ、 initrd やファイル preseed の段階で、多重読み込みを行うことができます。 これにより、ネットワークに接続した時点でネットワーク preseed を行えます。 この場合、2 種類の異なる preseed が実行されることに注意してください。 例えば、preseed/early コマンドを実行する機会が 2 度あり、 2 回目はネットワークに接続した時に発生するということです。