"how to include a directory in the package debuild" Code Answer

5

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/shnecho "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
By Bookamp on February 25 2022

Answers related to “how to include a directory in the package debuild”

Only authorized users can answer the Search term. Please sign in first, or register a free account.