分页: 1 / 1

用dpkg-deb修改deb包

发表于 : 2009-06-18 12:07
syrano
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 <[email protected]>
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 <[email protected]>
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

Re: 用dpkg-deb修改deb包

发表于 : 2009-08-23 16:34
swifer
8错,要好好的学习一下

Re: 用dpkg-deb修改deb包

发表于 : 2009-08-23 16:37
wangdu2002
向爱因斯坦学习,长点见识。 :em03

Re: 用dpkg-deb修改deb包

发表于 : 2009-08-23 16:39
HuntXu
用过这个,还是挺方便的

Re: 用dpkg-deb修改deb包

发表于 : 2009-09-05 15:49
careone
自动生成 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 行两个 >> 代表附加到文件末尾

Re: 用dpkg-deb修改deb包

发表于 : 2009-09-11 22:16
guishugan
晕了 还是从简单做起吧 :em06