Building deb with dpkg-deb

之前在ubuntu-TW上看到hepha大把剛釋出的pps for linux打包成了deb
很好奇這是如何達成的,之前只聽說過可以用checkinstall從source建立deb
後來終於查到了

主要是利用dpkg-deb這個指令
你必去建立一個資料夾然後將需要的檔案按照檔案系統架構把檔案加入
假設我建立一個資料夾叫做debain
我想將一個程式test封裝進去,而test應該放在/usr/bin/test
所以我就必須建立debian/usr/bin然後把test複製到debian/usr/bin
然後還需要一個control檔

[control]

Package:
Version:
Section:
Priority:
Architecture:
Depends:
Suggests:
Conflicts:
Replaces:
Installed-Size:
Maintainer:
Description:

不需要全部都填
然後放在
debain/DEBIAN裡頭
註:DEBIAN下可包含檔案
control, prerm, postinst
接著

fakeroot dpkg-deb --build debian

然後就產生了一個deb封裝啦!

P.S.可以用ar x *.deb來解開一個封裝

流程from http://tldp.org/HOWTO/html_single/Debian-Binary-Package-Building-HOWTO/
Prerequisite files:

1. one or more binary executable or shell script files
2.a man page for each executable file
3.a 'control' file
4.a 'copyright' file
5. a 'changelog' and 'changelog.Debian' file

Setup temporary 'debian' directories:

1. create 'debian/usr/bin' directory (or wherever you plan to place your executable files)
2. create 'debian/usr/share/man/man1' (or whatever section your man page belongs into)
3. create 'debian/DEBIAN' directory
4.
create 'debian/usr/share/doc/'
5. make sure all sub directories of 'debian' have file permission 0755

Copy files into temporary 'debian' tree:

1.copy executable file into 'debian/usr/bin' directory (or wherever you plan to place your executable files)
2.copy man page file into 'debian/usr/share/man/man1' directory
3.
copy 'control' file into 'debian/DEBIAN' directory
4. copy 'copyright', 'changelog', and 'changelog.Debian' files into 'debian/usr/share/doc/'
5.gzip man page, 'copyright', 'changelog', and 'changelog.Debian' files with option '--best' inside the temporary 'debian' tree

Build and check binary Debian package:

1.invoke 'dpkg-deb --build' using 'fakeroot' on the 'debian' directory
2.rename resulting 'debian.deb' file to its final package name including version and architecture information
3.check resulting .deb package file for Debian policy compliance using 'lintian'

留言

這個網誌中的熱門文章

成功安裝Vista & Ubuntu Linux 8.04 LTS 雙系統!!!