如何在包中包含一个目录debuild [英] how to include a directory in the package debuild
问题描述
一个简单的Debian包将被创建在以下步骤中,以下步骤将是初学者的教程
考虑我有一个文件让我们说test.sh这将只是在屏幕上打印测试
#!/ bin / sh
set -e
echo这是样本debian包创建>& 2
安装debian包后应该输出什么?
A)我想把我命名为test.sh的上述文件放在/ home / bla / Desktop /中,使用dpkg -i test-1.0.deb
为了实现上述过程,请按照以下步骤执行
mkdir test-1.0
cd test-1.0
#in为了将test.sh放在/ home / bla / Desktop中,只需使用该命令在测试文件夹中创建相同的目录结构
mkdir - p home / bla / Desktop /
cp test.sh home / bla / Desktop /
cd ..
cd ..
cd ..
mkdir DEBIAN
cd DEBIAN
添加带有以下内容的控制文件
包:test
版本:1.0
部分:devel
优先级:可选
架构:全部
基本:否
取决于:bash
前提:no
推荐:否
维护者:test< test@test.test>
替换:否
提供:否
说明:为了演示如何创建debian包,示例测试包
包准备就绪到测试文件夹之外,并输入dpkg --build test-1.0 /
您的包准备好了,你可以通过使用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
没有什么我的test.sh没有包含在包中,我不知道是什么原因是我已经明白从debian手册
可以任何人知道这样做,请让我asap ..,我只是想知道我可以包括文件在包中构建debian包使用debuild / dpkg-buildpackage就像我在第一个进程中做的非常简单
AQ / D示例利用 dh * 和dpkg-buildpackage :
em> 1) Pepare工作目录和测试文件(我们将打包foo应该安装到/ any / dir):
mkdir test-0.0。 1
cd test-0.0.1
echo -e#\!/ bin / sh\\\
echo \我是foo\> foo
chmod + x foo
2)创建简单的 Makefile 将处理安装:
binary:
#我们不会建立任何东西
安装:
mkdir -p $(DESTDIR)/ any / dir
cp foo $(DESTDIR)/ any / dir
3)生成包框架:
code> 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
触摸内容/ a
触摸内容/ b
2)创建包装骨架:
dh_make -i --createorig
3)使用以下内容创建 debian / test.install 文件:
内容/ / usr / share / mycontents
4)构建软件包:
dpkg-buildpackage -A - uc
5)检查内置软件包:
dpkg-deb -c ../test_0.0.1-1_all.deb | grep内容
/ pre>
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
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 <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/
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:
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
cd debian
rm *.ex *.EX
cd ..
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
解决方案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
这篇关于如何在包中包含一个目录debuild的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!