how to include a directory in the package debuild

陌路散爱 提交于 2019-12-05 08:42:43

A Q/D example utilizing dh* and dpkg-buildpackage:

1) Pepare working directory and test file (we are going to package "foo" script which should be installed to "/any/dir") :

mkdir test-0.0.1
cd test-0.0.1
echo -e "#\!/bin/sh\necho \"hi, i'm foo\"" > foo
chmod +x foo

2) Create simple Makefile which will handle installation:

binary:
    # we are not going to build anything

install:
    mkdir -p $(DESTDIR)/any/dir
    cp foo $(DESTDIR)/any/dir

3) Generate package skeleton:

dh_make -i --createorig

3a) Optionally adjust debian control file

4) Build the package:

dpkg-buildpackage -A -uc

5) Test generated package contents:

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

Edit: Example without using Makefile (if you are not going to build anything):

1) Create test data:

mkdir test-0.0.1
cd test-0.0.1
mkdir contents
touch contents/a
touch contents/b

2) Create package skeleton:

dh_make -i --createorig

3) Create debian/test.install file with following contents:

contents/   /usr/share/mycontents

4) Build package:

dpkg-buildpackage -A -uc

5) Examine built package:

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
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!