
私は個人プロジェクト用のdebファイルを生成しようとしました。このプロジェクトはsbtとsbt-native-packagerを使用してサーバーにインストールされたdebファイルを生成します。
templates
、config
およびスクリプトを私の制御アーカイブに追加しましたがpostinst
(そして解凍されたことを確認しました)、debconfが新しいテンプレートを検出しないようです。 sudo debconf-show t-budget
空白が表示され、毎回db_input
返されます10 "t-budget/<template>" doesn't exist
。
私の制御アーカイブにファイルを配置することに加えて、これらのテンプレートをデータベースに追加するために実行する必要がある他の作業はありますか?
注:Deb生成ツールを直接使用しないため、sbt-native-packagerに言及しました。関連性があるかもしれませんが、これがツールの制限である場合はうまくいくはずです。問題が何であるかを知ることで解決できます。
私が使用したい設定ファイルは次のとおりです。
$ ls -lht /var/lib/dpkg/info/t-budget.*
-rw-r--r-- 1 root root 27K Sep 4 21:54 /var/lib/dpkg/info/t-budget.md5sums
-rw-r--r-- 1 root root 20K Sep 4 21:54 /var/lib/dpkg/info/t-budget.list
-rw-r--r-- 1 root root 1.1K Sep 4 20:51 /var/lib/dpkg/info/t-budget.conffiles
-rwxr-xr-x 1 root root 815 Sep 4 20:51 /var/lib/dpkg/info/t-budget.config
-rwxr-xr-x 1 root root 2.9K Sep 4 20:51 /var/lib/dpkg/info/t-budget.postinst
-rwxr-xr-x 1 root root 100 Sep 4 20:51 /var/lib/dpkg/info/t-budget.postrm
-rwxr-xr-x 1 root root 1.9K Sep 4 20:51 /var/lib/dpkg/info/t-budget.preinst
-rwxr-xr-x 1 root root 2.9K Sep 4 20:51 /var/lib/dpkg/info/t-budget.prerm
-rwxr-xr-x 1 root root 1.6K Sep 4 20:51 /var/lib/dpkg/info/t-budget.templates
/var/lib/dpkg/info/t-budget.templates
:
Template: t-budget/database/ip
Type: string
Default: localhost
Description: What is the host of your PostgreSQL server?
T-Budget needs a postgresql server to store it's data.
You can host one locally or have it connect over the network.
Enter the host's domain name or IP address.
Note: If the database is not the localhost, the install script will not be able to configure it automatically.
Template: t-budget/database/name
Type: string
Default: budget
Description: What is the name of your database?
A single postgres server can host several isolated databases.
It is recommended that T-Budget run on it's own database to maximize security and data integrity.
Template: t-budget/database/username
Type: string
Default: t-budget
Description: What is the PostgreSQL username?
T-Budget should use an isolated username with limited permissions to the rest of the system.
To create a new user, enter a username which is not yet in use.
Template: t-budget/database/password
Type: password
Description: What is the PostgreSQL password?
If creating a new user, it will be created with this password.
If using an existing user, this password will need to match the current password of that user.
Template: t-budget/hostnames
Type: string
Description: What is the hostname of your server?
What is the domain name of the server users will use to access T-Budget?
Used for security protocols.
You can input multiple hostnames seperated by a space.
You can also prefix your hostname with a '.' to include all subdomains in addition to the hostname.
/var/lib/dpkg/info/t-budget.config
:
#!/bin/sh
set -e
# Source debconf library.
. /usr/share/debconf/confmodule
db_version 2.0
echo "configuring..." 1>&2
db_clear
echo "CLEAR: $RET" 1>&2
db_purge
echo "PRUGE: $RET" 1>&2
db_input high t-budget/database/ip || true
echo "INPUT high t-budget/database/ip: $RET" 1>&2
db_input high t-budget/database/name || true
echo "INPUT high t-budget/database/name: $RET" 1>&2
db_input high t-budget/database/username || true
echo "INPUT high t-budget/database/username: $RET" 1>&2
db_input critical t-budget/database/password || true
echo "INPUT critical t-budget/database/password: $RET" 1>&2
db_go
echo "GO: $RET" 1>&2
db_input critical t-budget/hostnames || true
echo "INPUT critical t-budget/hostnames: $RET" 1>&2
db_go
echo "GO: $RET" 1>&2
# TODO: validate input
/var/lib/dpkg/info/t-budget.postinst
:
#!/bin/sh
# Source debconf library.
. /usr/share/debconf/confmodule
# generate config files...
答え1
そのため、公式リポジトリの作業例を見て、1つずつ一致させるようにした後に問題を発見しました。
db_purge
この行はデータベースからすべてのテンプレートを削除します。他の例をコピーしてこれがどのように機能するかわからなかったので、これを追加していますが、この行を削除すると問題が解決しました。