当前,我正在开发一个自定义的debian软件包,以将一些文件安装到目标。在安装过程中,我想向用户询问数据库凭据以构建配置文件。我当前的方法是使用debconf。但是基于以下模板,在通过apt-get install进行软件包安装期间不会出现任何问题。其余安装将按预期进行。
我的debian软件包文件夹的当前树
+---DEBIAN
| config
| control
| postinst
| rules
| templates
|
+---etc
| +---lighttpd
| | +---conf-available
| | | 99-webinterface.conf
| | |
| | \---conf-enabled
| | 99-webinterface.conf
| |
| \---systemd
| \---system
| sir_dbservice.service
|
\---var
\---www
\---html
| somefiles
config
#!/bin/sh
set -e
. /usr/share/debconf/confmodule
# Ask questions.
db_input critical webdb/dbuser || true
db_input critical webdb/dbpassword || true
db_go
模板
Template: webdb/dbuser
Type: string
Default: postgres
Description: Which postgres db user?
Template: webdb/dbpassword
Type: password
Description: Please type in the password for the chosen user.
感谢您的帮助:)
bg 塞巴斯蒂安