用dpkg-deb修改deb包

编译打包和其他
回复
头像
syrano
帖子: 4313
注册时间: 2007-10-06 18:40

用dpkg-deb修改deb包

#1

帖子 syrano » 2009-06-18 12:07

drcom-pum的deb包, 可以开机自动装载drcom.ko模块, 还可以每次更新内核自动重新编译drcom.ko模块.
但我更喜欢用命令行的drcom, 所以我把drcom-pum修改成命令行的drcom
把drcom-pum的deb包和drcom源码放到同一目录
进入drcom-pum的deb包所在的目录

代码: 全选

#创建目录
mkdir drcom
#解压程序文件
dpkg-deb -x drcom-pum_1.0-0ubuntu1~ppa1~jaunty1_i386.deb drcom
#解压控制文件
dpkg-deb -e drcom-pum_1.0-0ubuntu1~ppa1~jaunty1_i386.deb drcom/DEBIAN #注意DEBIAN必需是大写
#解压源码
tar xf drcom-1.4.8.2.tar.gz
#进入源码目录
cd drcom-1.4.8.2/
#编译
make
#退回原目录
cd ..
#删除不需要的图形界面程序
rm -r drcom/usr/bin/drcomclient
rm -r drcom/usr/share/applications/
rm -r drcom/usr/share/doc/
rm -r drcom/usr/share/drcom/resource/
rm -r drcom/usr/share/drcom/src/python-user-mode/
#复制编译好的drcomd, drcomc, 和配置文件
cp drcom-1.4.8.2/drcomd/drcomd drcom/usr/bin/
cp drcom-1.4.8.2/drcomc/drcomc drcom/usr/bin/
cp drcom-1.4.8.2/drcom.conf drcom/etc/
修改文件drcom/DEBIAN/md5sums
删除被删除了的文件的md5值, 添加drcomd, drcomc的md5值
查看md5值的方法
#进入drcom目录

代码: 全选

$ cd drcom
$ md5sum usr/bin/drcomd 
276387431a9a1c092d7873faa73ef781  usr/bin/drcomd
$ md5sum usr/bin/drcomc
05876fef6d57482e5fd73a1a1174a005  usr/bin/drcomc
最终md5sums修改为

代码: 全选

75038b444d53936ac6863f36294a0557  usr/bin/mkdrcom
2478117d25f24107651cfd89be7fe8d3  usr/bin/drunlevel
979276274bcf0de81cdf7bc78acf4ca6  usr/bin/drcom
2c3e9bea08c3b3e6d71bee1b01ddc375  usr/share/drcom/src/kmod/daemon_kernel.h
9cebd0877a1f56633db30f87b0270493  usr/share/drcom/src/kmod/drcom.c
7d1579e7d5e9db19b9697559b9cae1f9  usr/share/drcom/src/kmod/Makefile
276387431a9a1c092d7873faa73ef781  usr/bin/drcomd
05876fef6d57482e5fd73a1a1174a005  usr/bin/drcomc
修改文件drcom/DEBIAN/control
原文件

代码: 全选

Package: drcom-pum
Version: 1.0-0ubuntu1~ppa1~jaunty1
Architecture: i386
Maintainer: Henry Huang <henry.s.huang@gmail.com>
Installed-Size: 380
Depends: python (>= 2.4), python-gtk2 (>= 2.12), python-notify
Recommends: bash, gcc, make, linux-headers-generic
Conflicts: python3 (>= 3.0)
Section: misc
Priority: optional
Homepage: http://www.drcom-client.org/
Description: fully GUI configurable X drcom-client using GTK+
 drcom-client is an open source ISP client for Dr.COM networks, used in
 many universities in China.
 .
 drcom-client pum is a branch of drcom-client for Linux development.
 It is a fully GUI configurable X drcom-client for Linux, written from
 scratch in pure Python. It uses the GTK+ toolkit for all of its
 interface needs. drcom-client pum provides 100% GUI configurability;
 no need to edit config files by hand and re-start the program.
修改后

代码: 全选

Package: drcom
Version: 1.4.8.2
Architecture: i386
Maintainer: Henry Huang <henry.s.huang@gmail.com>
Installed-Size: 220
Depends: gcc, make
Recommends: bash, linux-headers-generic
Section: misc
Priority: optional
Homepage: http://www.drcom-client.org/
Description: DrCom is a client authentication system used by several
 universities and companies for client login, billing etc.  A windows
 version is available from the drcom company itself, but no versions for
 linux is available from them. This is a linux version developed under the
 GNU license.
注意Description: 后每一行前有一个空格
#重新打包

代码: 全选

dpkg-deb -b drcom drcom_1.4.8.2_i386.deb
附件
drcom_1.4.8.2_i386.deb
(58.65 KiB) 已下载 177 次
drcom-1.4.8.2.tar.gz
(45.12 KiB) 已下载 107 次
drcom-pum_1.0-0ubuntu1~ppa1~jaunty1_i386.deb
(104.23 KiB) 已下载 129 次
E=m c^2
swifer
帖子: 1
注册时间: 2009-08-22 9:29

Re: 用dpkg-deb修改deb包

#2

帖子 swifer » 2009-08-23 16:34

8错,要好好的学习一下
头像
wangdu2002
帖子: 13284
注册时间: 2008-12-13 19:39
来自: 物华天宝人杰地灵

Re: 用dpkg-deb修改deb包

#3

帖子 wangdu2002 » 2009-08-23 16:37

向爱因斯坦学习,长点见识。 :em03
行到水穷处,坐看云起时。
海内生明月,天涯共此夕。
--------------------吾本独!
头像
HuntXu
帖子: 5776
注册时间: 2007-09-29 3:09

Re: 用dpkg-deb修改deb包

#4

帖子 HuntXu » 2009-08-23 16:39

用过这个,还是挺方便的
HUNT Unfortunately No Talent...
头像
careone
帖子: 839
注册时间: 2007-12-17 21:41

Re: 用dpkg-deb修改deb包

#5

帖子 careone » 2009-09-05 15:49

自动生成 md5sums 的简单方法:

代码: 全选

cd drcom
md5sum `find usr/bin -type f` > DEBIAN/md5sums
md5sum `find usr/share/drcom/src/kmod -type f` >> DEBIAN/md5sums
或者

代码: 全选

cd drcom
find usr/bin/ -type f -exec md5sum {} + > DEBIAN/md5sums
find usr/share/drcom/src/kmod/ -type f -exec md5sum {} + >> DEBIAN/md5sums 
如果目录少,也可以用下面更简单直接的方法:

代码: 全选

cd drcom
md5sum usr/bin/* > DEBIAN/md5sums
md5sum usr/share/drcom/src/kmod/* >> DEBIAN/md5sums 
注意:
第 2 行一个 代表替换原文件
第 3 行两个 >> 代表附加到文件末尾
魁拔不死,天下不宁。
魁拔既死,天下不平。
--------------
Careone <emacslocale^126.com>
https://sourceforge.net/projects/emacslocale/files/
头像
guishugan
帖子: 379
注册时间: 2009-03-02 19:30
来自: 河北石家庄

Re: 用dpkg-deb修改deb包

#6

帖子 guishugan » 2009-09-11 22:16

晕了 还是从简单做起吧 :em06
除了真相,女人也是赤裸裸的
回复