网站首页 > 技术文章 正文
簡介
deb檔要包裝前要寫一堆資訊檔才行,其中包括了 像pkgtools一樣的scripts,debian也有像Solaris裡的
postinstall preinstall postremove preremove這些scripts可以用,
其中最重要的資訊檔是一個名叫control的檔
需要的一些工具
dpkg
dpkg-deb 這兩個是最基本的
如果想成為Debian的distribution開發者,因為他們有一些遊戲規矩, 包括source code的改版,必要文件等規則,
下面的套件會幫你,如果不想submit你的deb檔給Debian,就不用裝了
dh-make 製做必要資訊檔的sample檔案這其實還蠻有用的
debhelper dh-make 的dependency
devscripts 一些scripts
fakeroot 假裝是root的工具
lintian 測試與檢查package檔的工具
建立步驟
deb必須先有source tree,站在source tree的最上面, 解開後直接用
$ dh_make
幫你建一個叫debian的目錄及寫一堆sample後再自己改, 我用cscope 15.1 做例子。
- 先去cscope.sourceforge.net捉原始檔.tar.gz回來
- 解開在/home/cyril/cscope-15.1,這邊一定要用 pkgname-version這樣形式的目錄
- 進去cscope-15.1在source code最上層直接執行dh_make,
會創造一個目錄叫debian,然後改這裡面的資訊檔 - 有兩種情況, 想成為Debian的distribution開發者, 如果有configure檔可直接執行
$ dpkg-buildpackage -rfakeroot
,會自己叫configure創造Makefile, 不然必需自己想辦法創造一個Makefile再叫 dpkg-buildpackage
-rfakeroot就會自己創造出xxxx.deb。 只想自己包裝一個套件不把包裝檔送到Debian組織, 只必需把它安裝到一個假的根目錄就好
$ ./configure --prefix=~/fakeroot/usr/
$ make ; make install
在~/fakeroot下建一個叫DEBIAN的目錄, 這裡面要放套件資訊檔control與安裝移除scripts檔。
control
preinst 四個shell script檔會被dpkg自動呼叫做該做的事
postinst 可以看/var/lib/dpkg/info下的範例
prerm
postrm
fakeroot就像一個假的根目錄,想放檔案到/etc/或 /usr/share/doc 下就把它放到 fakeroot/etc/
fakeroot/usr/share/doc下就好。 在fakeroot外
$ dpkg -b fakeroot cscope_15.1.0_i386.deb
創造一個deb檔,有個命名規矩pkgname_version_cpuarch.deb。version 通常有三層level,
ver.patch.sublevel。也不一定要遵守啦。 用
$ dpkg -c cscope_15.1.deb
看有那些檔案,用
$ dpkg -i cscope_15.1.deb
看有那些資訊。
其中資訊檔的意義與使用格式, 兩個方法不一樣, 一般開發者只要在DEBIAN下放control與install/remove
scripts就好, 要送給Debian組織的開發者比較囉唆,進debian這個目錄改一些檔,
注意debian與DEBIAN兩個目錄的意義不同。 在dh_make創造的檔中,
control 這是主要package的資訊檔
copyright 這個檔在很多商用的軟體中也會出現就是你的版權申明
changlog 就是跟上一版的差別
這兩個會放在/usr/share/doc/cscope/
rules 這是主要install script是個Makefile,
會去叫很多dh_xxx command
其中上面四個檔在Debian組織是必需要的 下面的檔案可有可無
READ.Debian 就是readme吧,有什麼跟原始程式不一樣特別為debian的事
conffiles configuration file 的所在,通常是/etc/xxx
有的軟體不用configuration file
例如
init.d
debian是system V style的 initial script 放在/etc/init.d
有的軟體不用initial script,通常是deamon才需要
這些也可以用postinstall script來裝
dirs 真的要裝的目錄
docs 這是除了man page外其它的文件
這會放在/usr/share/doc/pkgname/
manpage.1 manpage.2 .....manpage.9
這是你的man page檔
我們要把manpage的source code改成cscope.1
/usr/share/man/
其實這也不用,只要make install有裝man page
不用寫在這
doc-base 除了man page外的文件說明檔
/usr/share/doc-base/
menu debian有一套為X-window的menu install系統
在/usr/lib/menu
可以寫一些資訊讓menu系統幫user安裝
preinst 四個shell script檔會被dpkg自動呼叫做該做的事
postinst 可以看/var/lib/dpkg/info下的範例
prerm
postrm
自動建立example file 如preinst.ex, ex.doc-base.package等等,把ex拿掉並自己改完即可呼叫,
dpkg-buildpackage -rfakeroot. 這會放一個假根目錄在debian/tmp
其中各檔的格式中最重要的是control這個檔, 即使是自己包裝的在DEBIAN目錄下一定要有此檔, man
deb-control可以有詳細解釋
Package: grep
Essential: yes
Priority: required
Section: base
Maintainer: Wichert Akkerman <wakkerma@debian.org>
Architecture: sparc
Version: 2.4-1
Pre-Depends: libc6 (>= 2.0.105)
Provides: rgrep
Conflicts: rgrep
Description: GNU grep, egrep and fgrep.
The GNU family of grep utilities may be the "fastest grep in the west".
GNU grep is based on a fast lazy-state deterministic matcher (about
twice as fast as stock Unix egrep) hybridized with a Boyer-Moore-Gosper
search for a fixed string that eliminates impossible text from being
considered by the full regexp matcher without necessarily having to
look at every character. The result is typically many times faster
than Unix grep or egrep. (Regular expressions containing backreferencing
will run more slowly, however.)
section 與priority是debian有的定義用dselect可以看出有那些
Section: base
admin
doc
libs
editors
devel
x11 ......
這個可以看debian的CD distribution裡的目錄名就知道了
Priority: Required
Standard
Important
Optional
Extra
猜你喜欢
- 2024-09-10 oracle实用sql分享:杀进程、长时间操作等等
- 2024-09-10 走在前沿的弄潮儿,怎能不会Git的那些奇技淫巧
- 2024-09-10 TCP“三次握手,四次挥手”你真的懂吗?
- 2024-09-10 详解虚拟化之KVM概念、架构、功能、常用工具及部署
- 2024-09-10 Linux find命令一定要知道这些(linux find命令的使用)
- 2024-09-10 inux 文本处理三剑客--grep/sed/awk
- 2024-09-10 db2入门必看命令清单--日常运维必需
- 2024-09-10 浅谈Linux中的&&和ll(linux中atime)
- 2024-09-10 浅谈Linux中的&&和ll,补充&和l
- 2024-09-10 使用grep搜索多个字符串(grep命令查找多个字段)
- 02-21走进git时代, 你该怎么玩?_gits
- 02-21GitHub是什么?它可不仅仅是云中的Git版本控制器
- 02-21Git常用操作总结_git基本用法
- 02-21为什么互联网巨头使用Git而放弃SVN?(含核心命令与原理)
- 02-21Git 高级用法,喜欢就拿去用_git基本用法
- 02-21Git常用命令和Git团队使用规范指南
- 02-21总结几个常用的Git命令的使用方法
- 02-21Git工作原理和常用指令_git原理详解
- 最近发表
- 标签列表
-
- cmd/c (57)
- c++中::是什么意思 (57)
- sqlset (59)
- ps可以打开pdf格式吗 (58)
- phprequire_once (61)
- localstorage.removeitem (74)
- routermode (59)
- vector线程安全吗 (70)
- & (66)
- java (73)
- org.redisson (64)
- log.warn (60)
- cannotinstantiatethetype (62)
- js数组插入 (83)
- resttemplateokhttp (59)
- gormwherein (64)
- linux删除一个文件夹 (65)
- mac安装java (72)
- reader.onload (61)
- outofmemoryerror是什么意思 (64)
- flask文件上传 (63)
- eacces (67)
- 查看mysql是否启动 (70)
- java是值传递还是引用传递 (58)
- 无效的列索引 (74)