使用dh *和dpkg-buildpackage的Q / D示例:
1)Pepare工作目录和测试文件(我们将打包应该安装到“/ any / dir”的“foo”脚本):
mkdir test-0.0.1
cd test-0.0.1
echo -e "#\!/bin/sh\necho \"hi,i'm foo\"" > foo
chmod +x foo
2)创建将处理安装的简单Makefile:
binary:
# we are not going to build anything
install:
mkdir -p $(DESTDIR)/any/dir
cp foo $(DESTDIR)/any/dir
3)生成包骨架:
dh_make -i --createorig
3a)可选择调整debian控制文件
4)构建包:
dpkg-buildpackage -A -uc
5)测试生成的包内容:
dpkg-deb -c ../test_0.0.1-1_all.deb | grep any
drwxr-xr-x root/root 0 2012-06-12 20:54 ./any/
drwxr-xr-x root/root 0 2012-06-12 20:54 ./any/dir/
-rwxr-xr-x root/root 30 2012-06-12 20:54 ./any/dir/foo
编辑:不使用Makefile的示例(如果您不打算构建任何内容):
1)创建测试数据:
mkdir test-0.0.1
cd test-0.0.1
mkdir contents
touch contents/a
touch contents/b
2)创建包骨架:
dh_make -i --createorig
3)使用以下内容创建debian / test.install文件:
contents/ /usr/share/mycontents
4)构建包:
dpkg-buildpackage -A -uc
5)检查内置包装:
dpkg-deb -c ../test_0.0.1-1_all.deb | grep contents
drwxr-xr-x root/root 0 2012-06-13 11:44 ./usr/share/mycontents/
drwxr-xr-x root/root 0 2012-06-13 11:38 ./usr/share/mycontents/contents/
-rw-r--r-- root/root 0 2012-06-13 11:37 ./usr/share/mycontents/contents/a
-rw-r--r-- root/root 0 2012-06-13 11:38 ./usr/share/mycontents/contents/b