a Simple Debian package would be created in following steps, the following steps would be tutorial for beginners
将在以下步骤中创建一个简单的Debian包,以下步骤将是初学者的教程
consider i have a file lets say test.sh which would just print test on the screen
考虑我有一个文件让我们说test.sh只会在屏幕上打印测试
#!/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"
安装debian软件包后应该输出什么? A)我想在使用“dpkg -i test-1.0.deb”安装软件包之后将上面的文件放在/ home / bla / Desktop /中,我将其命名为test.sh
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 <test@test.test>
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/
包准备好来自test文件夹并输入dpkg --build test-1.0 /
your package is ready and you can install it by using dpkg -i test-1.0.deb
您的包已准备就绪,您可以使用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
如果我想用dh_make和debuild做同样的过程,我无法添加目录结构,我想在安装后放置test.sh
steps which I followed:
我遵循的步骤:
mkdir test-1.0
-
copy the directory structure as above
如上复制目录结构
cd test-1.0/ && mkdir -p home/bla/Desktop/ cp test.sh home/bla/Desktop/
-
dh_make -n -s -e test@test.com
dh_make -n -s -e test@test.com
cd debian
rm *.ex *.EX
cd ..
debuild -us -uc
rm * .ex * .EX
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
没有什么我的test.sh根本没有包含在包中,我不知道是什么原因是我从debian手册中理解的
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
任何人都知道这样做,请尽快让我...,我只是想知道如何使用debuild / dpkg-buildpackage构建debian包时我可以在包中包含文件,就像我在第一个进程中所做的那样非常简单
1 个解决方案
#1
12
A Q/D example utilizing dh* and dpkg-buildpackage:
使用dh *和dpkg-buildpackage的Q / D示例:
1) Pepare working directory and test file (we are going to package "foo" script which should be installed to "/any/dir") :
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) Create simple Makefile which will handle installation:
2)创建将处理安装的简单Makefile:
binary:
# we are not going to build anything
install:
mkdir -p $(DESTDIR)/any/dir
cp foo $(DESTDIR)/any/dir
3) Generate package skeleton:
3)生成包骨架:
dh_make -i --createorig
3a) Optionally adjust debian control file
3a)可选择调整debian控制文件
4) Build the package:
4)构建包:
dpkg-buildpackage -A -uc
5) Test generated package contents:
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
Edit: Example without using Makefile (if you are not going to build anything):
编辑:不使用Makefile的示例(如果您不打算构建任何东西):
1) Create test data:
1)创建测试数据:
mkdir test-0.0.1
cd test-0.0.1
mkdir contents
touch contents/a
touch contents/b
2) Create package skeleton:
2)创建包骨架:
dh_make -i --createorig
3) Create debian/test.install file with following contents:
3)使用以下内容创建debian / test.install文件:
contents/ /usr/share/mycontents
4) Build package:
4)构建包:
dpkg-buildpackage -A -uc
5) Examine built package:
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
#1
12
A Q/D example utilizing dh* and dpkg-buildpackage:
使用dh *和dpkg-buildpackage的Q / D示例:
1) Pepare working directory and test file (we are going to package "foo" script which should be installed to "/any/dir") :
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) Create simple Makefile which will handle installation:
2)创建将处理安装的简单Makefile:
binary:
# we are not going to build anything
install:
mkdir -p $(DESTDIR)/any/dir
cp foo $(DESTDIR)/any/dir
3) Generate package skeleton:
3)生成包骨架:
dh_make -i --createorig
3a) Optionally adjust debian control file
3a)可选择调整debian控制文件
4) Build the package:
4)构建包:
dpkg-buildpackage -A -uc
5) Test generated package contents:
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
Edit: Example without using Makefile (if you are not going to build anything):
编辑:不使用Makefile的示例(如果您不打算构建任何东西):
1) Create test data:
1)创建测试数据:
mkdir test-0.0.1
cd test-0.0.1
mkdir contents
touch contents/a
touch contents/b
2) Create package skeleton:
2)创建包骨架:
dh_make -i --createorig
3) Create debian/test.install file with following contents:
3)使用以下内容创建debian / test.install文件:
contents/ /usr/share/mycontents
4) Build package:
4)构建包:
dpkg-buildpackage -A -uc
5) Examine built package:
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