preseed を利用したインストールの自動化 本付録は preseed の説明を行います。 これは &d-i; の質問に回答しておきインストールを自動化するものです。 本付録で使用した設定の断片は、 &urlset-example-preseed; にある事前設定ファイルのサンプルで利用できます。 はじめに preseed は、インストールの実行中に手動で回答を入力せずに、 インストールプロセス中の質問の答を設定する方法を提供します。 これにより、ほとんどの方法のインストールを自動化し、 さらに通常のインストールでは利用できない特徴もあります。 preseed の方法 preseed を利用するには、 initrd, ファイル, ネットワーク と 3 種類の方法があります。 initrd preseed は、いずれのインストール方法でも動作し、 より多くの preseed をサポートしますが、大量の準備が必要です。 ファイル preseed やネットワーク preseed は、 それぞれインストール方法が異なる場合に使用されます。 ファイル preseed やネットワーク preseed では、 事前設定ファイルが読み込まれる前にいくつか質問されてしまうため、 その質問を preseed に含めることができません。 以下の表では、各インストール方法で使用できる preseed 方法を示します。 インストール方法initrd ファイルネットワーク CD/DVD yes yes no netboot yes no yes hd-media (USB スティックを含む) yes yes no フロッピーベース (CD ドライバ) yes yes no フロッピーベース (ネットドライバ) yes no yes generic/tape yes no yes preseed 方法の重要な違いは、事前設定ファイルを読込・処理するポイントです。 initrd preseed では、インストールの始め (最初の質問が行われる前) に読み込まれます。 ファイル preseed では、CD や CD イメージが読み込まれた後です。 ネットワーク preseed では、ネットワークの設定の後でないと読み込まれません。 実際の話をすると、ファイル preseed やネットワーク preseed では、 言語、国、キーボードの選択について質問は、既にされてしまっています。 ネットワーク preseed では、そこにネットワークの設定についても加えてください。 その他、優先度が「中」や「低」でしか表示されない質問 (はじめのハードウェア検出など) は、既に処理されてしまっています。 言うまでもなく、事前設定ファイルが読み込まれる前に処理される質問は、 preseed できません。 では、 そういった質問が出ないようにする方法を提供しています。 制限 &d-i; で行われる質問のほとんどはこの方法で preseed できますが、 いくつか注目すべき例外があります。 ディスク全体を (再度) パーティション分割するか、 ディスクの空き領域を利用しなければなりません。 つまり既存のパーティションを利用できないと言うことです。 また現在、RAID のセットアップに preseed を利用できません。 インストール中でのカスタムコマンドの実行 事前設定ツールで提供される、とても強力で柔軟なオプションに、 インストールの決まった場所でコマンドやスクリプトを実行する機能があります。 詳細は をご覧ください。 preseed/early_command: は、 事前設定ファイルが読み込まれるとすぐに実行します。 preseed/late_command: は、 インストールが終わって再起動する直前、 /target ファイルシステムをアンマウントする前に実行します。 デフォルト値の変更に関する preseed の利用 訊かれる質問に対するデフォルトの回答を変更するのに preseed を利用できます。 これには、質問に値を設定した後で、 seen フラグを false に設定しなければなりません。 d-i foo/bar string value d-i foo/bar seen false preseed の利用 もちろん事前設定ファイルを最初に作成し、使用する場所に配置する必要があります。 事前設定ファイルの作成は本付録で後ほど扱います。 ネットワーク preseed の場合や、 ファイルをフロッピーや USB スティックから読み込む場合、 簡単に正しい位置に事前設定ファイルを配置できます。 CD や DVD にファイルを含めたければ、 ISO イメージを再度マスタリングする必要があります。 initrd に含まれている事前設定ファイルを取り出す方法は、 この文書では扱いません。&d-i; の開発者向け文書を当たってください。 事前設定ファイルの手本にできる事前設定ファイルのサンプルは、 &urlset-example-preseed; から取得できます。 このファイルは、この付録にある設定の断片を元にしています。 事前設定ファイルの読み込み initrd preseed を使用する場合、preseed.cfg というファイルが initrd のルートディレクトリに確実にある必要があります。 インストーラは、このファイルがあるか自動的にチェックし、読み込みます。 他の preseed 方法では、ブート時にどのファイルを読み込むか、 インストーラに指定する必要があります。 通常、カーネルのブートパラメータで渡して行います。 これは起動時に手動で与えるか、 ブートローダ設定ファイル (例: syslinux.cfg) を編集し、 カーネルへの append 行の最後にパラメータを追加して与えます。 ブートローダの設定で事前設定ファイルを指定する場合、 設定を変更すれば、インストーラの起動時に ENTER を押す必要はありません。 syslinux ではこの設定をするのに、 syslinux.cfg でタイムアウトを 1 にします。 インストーラが確実に正しい事前設定ファイルを取得するのに、 このファイルのチェックサムを指定できます。 現在、これには md5sum 値の指定が必要です。 指定した値と事前設定ファイルの値は一致しなければなりません。 一致しない場合は、インストーラは事前設定ファイルを使用しません。 ブートパラメータの設定: - netboot の場合: preseed/url=http://host/path/to/preseed.cfg preseed/url/checksum=5da499872becccfeda2c4872f9171c3d - リマスタリングした CD で起動する場合: preseed/file=/cdrom/preseed.cfg preseed/file/checksum=5da499872becccfeda2c4872f9171c3d - USB メディアで起動する場合 (事前設定ファイルを USB スティックの トップレベルディレクトリに置くこと): preseed/file=/hd-media/preseed.cfg preseed/file/checksum=5da499872becccfeda2c4872f9171c3d ブートパラメータに渡す際に、 preseed/urlurl に、 preseed/filefile に 短縮できることに注意してください。 実行するにあたり、ブートパラメータに debconf/priority=critical を追加したいかもしれません。 preseed でいくつか以下の設定を漏らしても、 ほとんどの質問が表示されなくなります。 事前設定ファイルを指定するための DHCP の利用方法 事前設定ファイルをネットワークからダウンロードするよう指定するのに、 DHCP も使用できます。DHCP はファイル名の指定ができます。 通常これは netboot のファイルですが、URL 形式になっていると、 ネットワーク preseed をサポートするインストールメディアが、 URL からファイルをダウンロードし、事前設定ファイルとして使用します。 以下は、ISC DHCP サーバのバージョン 3 用 dhcpd.conf で設定するサンプルです。 if substring (option vendor-class-identifier, 0, 3) = "d-i" { filename "http://host/preseed.cfg"; } 上記の例は、 "d-i" を名乗る DHCP クライアントにこのファイル名を渡すよう制限されており、 通常の DHCP クライアントではなく、 インストーラにのみ影響を与えることに注意してください。 この文字列で、ネットワーク上の全マシンに preseed でインストールするのではなく、 特定のホストに対して行うようにもできます。 DHCP preseed を使用するよい方法は、自分のネットワークには、 Debian ミラーサイトのような preseed の値のみ指定することです。 自分のネットワークにこの方法でインストールすると、 選択したよいミラーサイトから自動で取得しますが、 インストールの残りのプロセスはインタラクティブに行われます。 DHCP preseed を用いた Debian の完全自動インストールは、 十分注意しなければ行うべきではありません。 preseed を補足するブートパラメータの利用 インストールプロセスのうちのある部分の質問は、 事前設定ファイルが読み込まれる前になされるため自動化できません。 例えば、事前設定ファイルをネットワークからダウンロードする場合、 まずネットワークの設定が完了していなければなりません。 インストールプロセスの早い段階から preseed できるというのが、 initrd preseed を使用する理由のひとつです。 事前設定ファイルを preseed に使用できないステップがあっても、 コマンドラインから preseed の値をカーネルに渡せるので、 まだ完全に自動化できます。 path/to/var=value というように、 サンプルにある preseed 変数を渡してください。 ブートプロンプトによく使用される変数には、 短いエイリアスがあることに注意してください。 有効なエイリアスは、本サンプル内で完全な変数名の代わりに使用しています。 ブートオプションの -- は特別な意味を持ちます。 これに続きカーネルパラメータがあると、 インストール済みのブートローダの設定にコピーされます (インストーラがサポートするブートローダの場合)。 -- は、デフォルトブートパラメータで、 すでに使用されていることに注意してください。 カーネル 2.4 では最大 (インストーラがデフォルトで指定するオプションを含め) コマンドラインオプションを 8 個、環境オプションを 8 個受け取れます。 この数を超えると、カーネル 2.4 では超過したオプションを取りこぼしてしまい、 カーネル 2.6 ではパニックしてしまいます。 カーネル 2.6.9 以降では、コマンドラインオプションを 32 個、 環境オプションを 32 個受け取れます。 ほとんどのインストールでは、ブートローダ設定ファイルにある (vga=normal のような) デフォルトオプションを安全に削除できるかもしれません。 これにより preseed 用にもっとオプションを追加できます。 ブートパラメータに空白を含んだ値を設定するのは、 引用符で区切ったとしてもいつもうまくいくとは限りません。 事前設定ファイルの作成 事前設定ファイルのフォーマットは、debconf-set-selections コマンドで使用されるものと同じです。 事前設定ファイルの行の一般的なフォーマットは以下のようになります。 <所有者> <質問名> <テンプレート型> <値> 事前設定ファイルを記述する際には、 ちょっとした規則があると気に留めておいてください 型と値の間には、空白かタブを 1 つだけおいてください。 空白を追加すると、値の一部として解釈されます。 行継続文字としてバックスラッシュ (\) を付けて複数行に分割できます。 質問名の後で分割するのが適当でしょう。 型と値の間はよくありません。 ほとんどの質問では、訳した値ではなく英語の値を指定する必要がありますが、 (partman など) 訳した値を使用できる質問もあります。 質問の中には、インストール中に表示される英語のテキストの代わりに、 コードを取るものがあります。 事前設定ファイルを作成する簡単な方法は、 にあるサンプルファイルを元にして作業することです。 その他には、手動インストールを行い、再起動してから debconf-utils パッケージの debconf-get-selections を使用します。 以下のように debconf データベースとインストーラの cdebconf データベースを 1 ファイルに出力してください。 $ debconf-get-selections --installer > file $ debconf-get-selections >> file しかし、この方法で生成したファイルでは preseed されない項目があります。 ほとんどのユーザはサンプルファイルから始めるのがよいでしょう。 この方法は、インストーラの cdebconf データベースが、 インストールしたシステムの /var/log/installer/cdebconf に保存されているのを前提にしています。 しかし、データベースに機密情報が含まれる可能性がありますので、 デフォルトでは root にのみ読み込みが許可されています。 /var/log/installer ディレクトリとその中のファイルは、 installation-report パッケージを完全削除することで、 削除されます。 有効な質問の値をチェックするのに、 インストール中に /var/lib/cdebconf のファイルを、 nano を使用して確認できます。 生のテンプレートは templates.dat を、 現在の値や変数に割り当てられた値は questions.dat を確認してください。 インストールを実行する前に、 事前設定ファイルのフォーマットが適切かどうかを調べるには、 debconf-set-selections -c preseed.cfg が使えます。 事前設定ファイルの内容 本付録で使用する設定の断片は、 &urlset-example-preseed; のサンプル事前設定ファイルでも利用できます。 本サンプルは、 Intel x86 アーキテクチャ用インストールを元にしていることに注意してください。 他のアーキテクチャにインストールする場合、 サンプルのいくつか (キーボードの選択やブートローダの選択など) は適切でないかもしれませんので、 そのアーキテクチャ用に適切な debconf 設定で置き換える必要があるでしょう。 地域化 地域化の設定値は initrd preseed を利用しているときのみ動作します。 他のすべての方法では、 この質問をされた後にしか事前設定ファイルを読み込めません。 ロケールは言語と国を両方指定します。 ブートパラメータでロケールを指定するには、 locale=en_US としてください。 # Locale sets language and country. d-i debian-installer/locale string en_US キーボード設定は、 キーボードアーキテクチャとキーマップを選択することから成っています。 ほとんどの場合、正しいキーボードアーキテクチャはデフォルトで選択されています。 そのため、通常 preseed する必要はありません。 キーマップは選択したキーボードアーキテクチャで、有効でなくてはなりません。 # Keyboard selection. #d-i console-tools/archs select at d-i console-keymaps-at/keymap select us # Example for a different keyboard architecture #d-i console-keymaps-usb/keymap select mac-usb-us キーボード設定をスキップするには、 console-tools/archsskip-config と preseed してください。 これにより、カーネルのキーマップが有効になったままとなります。 カーネル 2.6 では入力レイヤが変更され、 キーボードアーキテクチャは事実上時代遅れです。 カーネル 2.6 では通常、PC (at) キーマップが既に選択されています。 ネットワーク設定 もちろん、ネットワークから事前設定ファイルを読み込む場合、 preseed のネットワーク設定は動作しません。 しかし、CD や USB スティックから起動するときには重要です。 ネットワークから事前設定ファイルを読み込む場合、 ネットワーク設定パラメータは、カーネルブートパラメータで渡すことになります。 ネットワークから事前設定ファイルを読み込む前に netboot するとき、 特定のインターフェースを選ぶ必要があるなら、 interface=eth1 のようにブートパラメータを使用してください。 preseed/url でネットワーク preseed を使用する際、 ネットワーク設定の preseed は通常不可能ですが、 例えば、ネットワークインターフェースに静的アドレスを設定するといった、 以下のハックを利用して動作させることができます。 このハックは、以下の行を含む preseed/run スクリプトを作成し、 事前設定ファイルを読み込んだ後でネットワークの設定を強制的に再度行う、 というものです。 killall.sh dhclient netcfg # netcfg will choose an interface that has link if possible. This makes it # skip displaying a list if there is more than one interface. d-i netcfg/choose_interface select auto # To pick a particular interface instead: #d-i netcfg/choose_interface select eth1 # If you have a slow dhcp server and the installer times out waiting for # it, this might be useful. #d-i netcfg/dhcp_timeout string 60 # If you prefer to configure the network manually, uncomment this line and # the static network configuration below. #d-i netcfg/disable_dhcp boolean true # If you want the preconfiguration file to work on systems both with and # without a dhcp server, uncomment these lines and the static network # configuration below. #d-i netcfg/dhcp_failed note #d-i netcfg/dhcp_options select Configure network manually # Static network configuration. #d-i netcfg/get_nameservers string 192.168.1.1 #d-i netcfg/get_ipaddress string 192.168.1.42 #d-i netcfg/get_netmask string 255.255.255.0 #d-i netcfg/get_gateway string 192.168.1.1 #d-i netcfg/confirm_static boolean true # Any hostname and domain names assigned from dhcp take precedence over # values set here. However, setting the values still prevents the questions # from being shown, even if values come from dhcp. d-i netcfg/get_hostname string unassigned-hostname d-i netcfg/get_domain string unassigned-domain # Disable that annoying WEP key dialog. d-i netcfg/wireless_wep string # The wacky dhcp hostname that some ISPs use as a password of sorts. #d-i netcfg/dhcp_hostname string radish ミラー設定 使用するインストール方法に依存しますが、 インストーラの追加コンポーネントのダウンロードや、基本システム、 インストールしたシステムの /etc/apt/sources.list の セットアップにミラーを使用できます。 mirror/suite パラメータでは、 インストールするシステム用の組を設定します。 mirror/udeb/suite パラメータでは、 インストーラの追加コンポーネントの組を設定します。 実際にコンポーネントをネットワークでダウンロードする場合に役立つだけです。 また、インストールで使用するインストール方法のための initrd を生成するには、 この組が一致していなければなりません。 mirror/udeb/suite のデフォルト値は、 mirror/suite と同じです。 d-i mirror/country string enter information manually d-i mirror/http/hostname string http.us.debian.org d-i mirror/http/directory string /debian d-i mirror/http/proxy string # Suite to install. #d-i mirror/suite string testing # Suite to use for loading installer components (optional). #d-i mirror/udeb/suite string testing パーティション分割 ハードディスクのパーティション分割に preseed を使用するのは、 partman-auto でサポートしている機能に限定されています。 パーティションはディスクに既存の空き領域とディスク全体のどちらかから選べます。 ディスクレイアウトは、あらかじめ定義したレシピ、 レシピファイルによるカスタムレシピ、 事前設定ファイルに書いたレシピから選択できます。 現在のところ、パーティションに preseed を用いて複数のディスクを割り当ることや、 RAID の設定することはできません。 ディスクの識別は、ドライバの読み込み順に依存します。 複数のディスクがシステムにある場合、preseed を使用する前に、 正しいディスクを確実に選択できるようにしなければなりません。 # If the system has free space you can choose to only partition that space. # Note: this must be preseeded with a localized (translated) value. #d-i partman-auto/init_automatically_partition \ # select Use the largest continuous free space # Alternatively, you can specify a disk to partition. The device name can # be given in either devfs or traditional non-devfs format. # For example, to use the first disk devfs knows of: d-i partman-auto/disk string /dev/discs/disc0/disc # Or, if you want to use LVM: #d-i partman-auto-lvm/disk string /dev/discs/disc0/disc # You can choose from any of the predefined partitioning recipes. # Note: this must be preseeded with a localized (translated) value. d-i partman-auto/choose_recipe \ select All files in one partition (recommended for new users) #d-i partman-auto/choose_recipe \ # select Separate /home partition #d-i partman-auto/choose_recipe \ # select Separate /home, /usr, /var, and /tmp partitions # Or provide a recipe of your own... # The recipe format is documented in the file devel/partman-auto-recipe.txt. # If you have a way to get a recipe file into the d-i environment, you can # just point at it. #d-i partman-auto/expert_recipe_file string /hd-media/recipe # If not, you can put an entire recipe the preconfiguration file in one # (logical) line. This example creates a small /boot partition, suitable # swap, and uses the rest of the space for the root partition: #d-i partman-auto/expert_recipe string \ # boot-root :: \ # 40 50 100 ext3 \ # $primary{ } $bootable{ } \ # method{ format } format{ } \ # use_filesystem{ } filesystem{ ext3 } \ # mountpoint{ /boot } \ # . \ # 500 10000 1000000000 ext3 \ # method{ format } format{ } \ # use_filesystem{ } filesystem{ ext3 } \ # mountpoint{ / } \ # . \ # 64 512 300% linux-swap \ # method{ swap } format{ } \ # . # This makes partman automatically partition without confirmation. d-i partman/confirm_write_new_label boolean true d-i partman/choose_partition \ select Finish partitioning and write changes to disk d-i partman/confirm boolean true 時計・タイムゾーン設定 # Controls whether or not the hardware clock is set to UTC. d-i clock-setup/utc boolean true # You may set this to any valid setting for $TZ; see the contents of # /usr/share/zoneinfo/ for valid values. d-i time/zone string US/Eastern Apt 設定 /etc/apt/sources.list のセットアップと基本設定オプションは、 インストール方法と初期の質問への回答から、完全に自動的に行われます。 さらに、他の (ローカルな) リポジトリを追加できます。 # You can choose to install non-free and contrib software. #d-i apt-setup/non-free boolean true #d-i apt-setup/contrib boolean true # Uncomment this to avoid adding security sources, or # add a hostname to use a different server than security.debian.org. #d-i apt-setup/security_host string # Additional repositories, local[0-9] available #d-i apt-setup/local0/comment string local server #d-i apt-setup/local0/source string \ # deb http://local.server/debian stable main # URL to the public key of the local repository #d-i apt-setup/local0/key string http://local.server/key アカウント設定 root アカウント用のパスワードや、 最初のユーザアカウントの名前・パスワードは preseed できます。 パスワードには、クリアテキストか MD5 ハッシュのどちらかを 使用できます。 preseed のパスワードは、 パスワードを知っている事前設定ファイルが誰でもアクセスできるために、 完全に安全でないことを知っておいてください。 MD5 ハッシュを使えば、セキュリティ的には多少ましと言えますが、 MD5 ハッシュは総当たり攻撃にかけられることを考えると、 誤った感覚を与えるかもしれません。 # Skip creation of a root account (normal user account will be able to # use sudo). #d-i passwd/root-login boolean false # Alternatively, to skip creation of a normal user account. #d-i passwd/make-user boolean false # Root password, either in clear text #d-i passwd/root-password password r00tme #d-i passwd/root-password-again password r00tme # or encrypted using an MD5 hash. #d-i passwd/root-password-crypted password [MD5 hash] # To create a normal user account. #d-i passwd/user-fullname string Debian User #d-i passwd/username string debian # Normal user's password, either in clear text #d-i passwd/user-password password insecure #d-i passwd/user-password-again password insecure # or encrypted using an MD5 hash. #d-i passwd/user-password-crypted password [MD5 hash] passwd/root-password-crypted 変数や passwd/user-password-crypted 変数では、 preseed で ! という値を取れます。 この場合、そのアカウントは無効となります。 もちろん管理権限での実行や root ログインを許可する代替手段 (例えば SSH キー認証や sudo) を用意しておいた上で、 root アカウントに設定すると便利です。 パスワードの MD5 ハッシュは以下のコマンドで生成できます。 $ echo "r00tme" | mkpasswd -s -H MD5 基本システムのインストール インストールのこの段階では、実際にはうまく preseed できないことがあります。 その唯一のものが、カーネルのインストールについての質問です。 # Select the initramfs generator used to generate the initrd for 2.6 kernels. #d-i base-installer/kernel/linux/initramfs-generators string yaird ブートローダのインストール # Grub is the default boot loader (for x86). If you want lilo installed # instead, uncomment this: #d-i grub-installer/skip boolean true # This is fairly safe to set, it makes grub install automatically to the MBR # if no other operating system is detected on the machine. d-i grub-installer/only_debian boolean true # This one makes grub-installer install to the MBR if if finds some other OS # too, which is less safe as it might not be able to boot that other OS. d-i grub-installer/with_other_os boolean true # Alternatively, if you want to install to a location other than the mbr, # uncomment and edit these lines: #d-i grub-installer/bootdev string (hd0,0) #d-i grub-installer/only_debian boolean false #d-i grub-installer/with_other_os boolean false パッケージ選択 有効なタスクを組み合わせてインストールするものを選ぶことができます。 有効なタスクを以下に書き出します。 standard desktop gnome-desktop kde-desktop web-server print-server dns-server file-server mail-server sql-database laptop タスクをインストールしないこともできますし、 他の方法でパッケージのセットが強制的にインストールされることもあります。 standard タスクは常に含めるのをお奨めします。 tasksel tasksel/first multiselect standard, desktop #tasksel tasksel/first multiselect standard, web-server #tasksel tasksel/first multiselect standard, kde-desktop # Some versions of the installer can report back on what software you have # installed, and what software you use. The default is not to report back, # but sending reports helps the project determine what software is most # popular and include it on CDs. #popularity-contest popularity-contest/participate boolean false インストール第 1 段階の仕上げ # Avoid that last message about the install being complete. d-i finish-install/reboot_in_progress note # This will prevent the installer from ejecting the CD during the reboot, # which is useful in some situations. #d-i cdrom-detect/eject boolean false メール設定 通常のインストールでは、exim は少々質問しますが、 さらにこれを避ける方法もあります。 もっと複雑な preseed も可能です。 exim4-config exim4/dc_eximconfig_configtype \ select no configuration at this time exim4-config exim4/no_config boolean true exim4-config exim4/no_config boolean true exim4-config exim4/dc_postmaster string X 設定 Debian の X 設定を preseed 可能です。 しかし、マシンのビデオハードウェアについて、 詳細を知っている必要があるかもしれません。 Debian の X コンフィグレータはすべてを自動設定するわけには行かないのです。 # X can detect the right driver for some cards, but if you're preseeding, # you override whatever it chooses. Still, vesa will work most places. #xserver-xorg xserver-xorg/config/device/driver select vesa # A caveat with mouse autodetection is that if it fails, X will retry it # over and over. So if it's preseeded to be done, there is a possibility of # an infinite loop if the mouse is not autodetected. #xserver-xorg xserver-xorg/autodetect_mouse boolean true # Monitor autodetection is recommended. xserver-xorg xserver-xorg/autodetect_monitor boolean true # Uncomment if you have an LCD display. #xserver-xorg xserver-xorg/config/monitor/lcd boolean true # X has three configuration paths for the monitor. Here's how to preseed # the "medium" path, which is always available. The "simple" path may not # be available, and the "advanced" path asks too many questions. xserver-xorg xserver-xorg/config/monitor/selection-method \ select medium xserver-xorg xserver-xorg/config/monitor/mode-list \ select 1024x768 @ 60 Hz 他パッケージの preseed # Depending on what software you choose to install, or if things go wrong # during the installation process, it's possible that other questions may # be asked. You can preseed those too, of course. To get a list of every # possible question that could be asked during an install, do an # installation, and then run these commands: # debconf-get-selections --installer > file # debconf-get-selections >> file 高度なオプション シェルコマンド # 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 事前設定ファイルの連鎖読み込み 事前設定ファイルから他の事前設定ファイルを読み込めます。 前に読み込まれたファイルの既存設定を、 後から読み込まれたいずれの設定でも上書きします。 これは例えば、あるファイルに一般的なネットワークの設定を書いておき、 他のファイルでより確かな設定を指定するという使い方ができます。 # More that 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. # 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