我一直坚持这个小问题(我敢肯定),所以任何帮助都会非常感激。我用dh_make创建了一个标准的ubuntu包。此程序包的目的是创建一个程序包,该程序包将设置系统所需的所有ldap相关程序包,包括其配置。我尝试做的其中一个步骤是复制/etc/ldap.conf文件,同时备份现有文件。我该怎么做呢?我试图创建一个看起来基本上类似于以下内容的postinst脚本,但我不清楚软件包如何存储文件,我得到一个错误说缺少etc / ldap.conf文件。最好的方法是什么?这是我的postinst脚本:
#!/bin/bash -xv
install -v -b etc/ldap.conf /etc/ldap.conf > /tmp/tst 2>&1
这是我的骨架结构:
root@hqd-clientb-16:~/navldapubuntu-0.1/debian# tree ├── changelog ├── compat ├── control ├── copyright ├── docs ├── etc └── ldap.conf ├── install ├── postinst ├── README.Debian ├── README.source ├── rules ├── source └── format ├── navldapubuntu └── etc ├── navldapubuntu.debhelper.log ├── navldapubuntu.dirs └── navldapubuntu.doc-base.EX
这是我创建的包的一些其他信息。
dpkg --contents tnoldapubuntu_0.1-1_all.deb (truncated output) ./usr/ ./usr/share/ ./usr/share/doc
./usr/share/doc/navldapubuntu/ ./usr/share/doc/navldapubuntu/copyright ./usr/share/doc/navldapubuntu/README.Debian ./usr/share/doc/navldapubuntu/changelog.Debian.gz ./etc/ldap.conf
答案 0 :(得分:7)
有一个专门用于创建配置包的工具:http://debathena.mit.edu/config-packages
这是一个简单的模板,可以帮助您快速启动。
文件列表
内容
模板/ Debian的/控制:
Source: PACKAGE_NAME
Section: morpho/misc
Priority: optional
Maintainer: MAINTAINER
Build-Depends: debhelper, config-package-dev (>= 5.0~)
Package: PACKAGE_NAME
Architecture: all
Depends: ${misc:Depends}, DEPENDENCY [, DEPENDENCY ...]
Provides: ${diverted-files}
Conflicts: ${diverted-files}
Description: PACKAGE_DESCRIPTION_SHORT
PACKAGE_DESCRIPTION_LONG.
模板/的Debian /位移
/etc/ldap/ldap.conf.mycompanyname
模板/ Debian的/安装
files/* /
模板/ Debian的/的postinst
#!/bin/sh
set -e
#DEBHELPER#
POSTINST_SCRIPT
模板/的Debian /规则
#!/usr/bin/make -f
# Exclude *.svn* from building
# you probably don't need this if don't use SVN
export DH_ALWAYS_EXCLUDE=.svn
# Core (check http://debathena.mit.edu/config-packages for more information)
%:
dh $@ --with=config-package
# Prevent dh_installdeb of treating files in /etc as configuration files
# you need this if need configuration files been always rewritten
# even if changed
override_dh_installdeb:
dh_installdeb
rm debian/*/DEBIAN/conffiles
模板/的Debian /文档
README
BUILD
最后,您可以使用以下命令构建此程序包:
dpkg-buildpackage -us -uc -I.svn
答案 1 :(得分:3)
您需要在“控制”文件旁边的DEBIAN目录中创建一个“conffiles”文件,并在其中声明/etc/ldap.conf。因此,此文件将自动被视为配置文件,对其进行更改将提示“新配置文件,是否要覆盖,yadda yadda”。