Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to include a directory in the package debuild

a Simple Debian package would be created in following steps, the following steps would be tutorial for beginners

consider i have a file lets say test.sh which would just print test on the screen

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

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

In order to achieve above process follow the below mentioned steps 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 the control file with following contents

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

Package is ready come outside of test folder and enter dpkg --build test-1.0/

your package is ready and you can install it by using dpkg -i test-1.0.deb

If i want to do the same process with dh_make and debuild, i was unable to add the directory structure where i wanted my test.sh to be placed after installation

steps which I followed:

  1. mkdir test-1.0
  2. copy the directory structure as above

    cd test-1.0/ && mkdir -p home/bla/Desktop/
    cp test.sh home/bla/Desktop/
    
  3. dh_make -n -s -e [email protected]

  4. cd debian
  5. rm *.ex *.EX
  6. cd ..
  7. debuild -us -uc

no mater what my test.sh is not at all included in the package after, i donot know what is the reason that is what i have understood from debian manual

can any one know to do it, please let me asap.., i just want to know how i can include the files in the package when building debian package using debuild/dpkg-buildpackage like i have done in the first process which is very simple

like image 635
forum.test17 Avatar asked Jun 12 '12 15:06

forum.test17


People also ask

How do I list the contents of a Debian package?

On Debian/Ubuntu distributions, you can use the dpkg command with the -L flag to list files installed to your Debian system or its derivatives, from a given .

What does dpkg Buildpackage do?

dpkg-buildpackage is a program that automates the process of building a Debian package. It consists of the following steps: 1. It prepares the build environment by setting various environment variables (see ENVIRONMENT), runs the init hook, and calls dpkg-source --before-build (unless -T or --target has been used).

What is Dh_make?

dh_make is a tool that adds necessary files for making Debian source package from upstream source according to the requirements of the Debian Policy. dh_make must be invoked within a directory containing the source code, which must be named <packagename>-<version>.


1 Answers

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
like image 150
barti_ddu Avatar answered Nov 15 '22 07:11

barti_ddu