How to include a directory in a debuild package

A simple Debian package will be created in the next steps, the next steps are a tutorial for beginners

assume that I have a file, say test.sh, that just prints the test on screen

#!/bin/sh
set -e
echo "this is sample debian package created " >&2

What should be the result after installing the debian package? A) I want to place the above file, which I named test.sh in / home / bla / Desktop / after installing the package using "dpkg -i test-1.0.deb"

To achieve the above process, follow the steps below as it

mkdir test-1.0
cd test-1.0
#in order to place test.sh in /home/bla/Desktop, simply create the same directory structure in the test folder using this command

mkdir -p home/bla/Desktop/
cp test.sh home/bla/Desktop/
cd ..
cd ..
cd ..
mkdir DEBIAN
cd DEBIAN

add a control file with the following contents

Package: test
Version: 1.0
Section: devel 
Priority: optional
Architecture: all
Essential: no
Depends:  bash
Pre-Depends: no
Recommends: no
Maintainer: test <test@test.test>
Replaces: no
Provides: no
Description: A sample testpackage in order to demonstrate how to create debian packages

The package is ready to go beyond the test folder and enter dpkg -build test-1.0 /

your package is ready and can be installed using dpkg -i test-1.0.deb

dh_make debuild, , , test.sh

:

  • mkdir test-1.0
  • ,

    cd test-1.0/ && mkdir -p home/bla/Desktop/
    cp test.sh home/bla/Desktop/
    
  • dh_make -n -s -e test@test.com

  • cd debian
  • rm *.ex *.EX
  • cd ..
  • debuild -us -uc

no mater, test.sh , , , debian manual

- , , .., , debian, debuild/dpkg-buildpackage,

+5
1

Q/D dh * dpkg-buildpackage:

1) Pepare ( "foo" script, "/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) 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
+11

All Articles