这里我用是nexenta. 这些系统默认装好了deb包制作需要工具如dpkg-dev devscripts等如果没有你也可以在制作过程中用apt-get <packagename>来手动安装
1. 创建个简单源码包
aubrey@aubrey-nexenta:~/deb$ ls -l hellodeb/
total 2
-rw-r--r-- 1 aubrey staff 203 Feb 16 12:50 Makefile
-rw-r--r-- 1 aubrey staff 73 Feb 16 12:46 hellodeb.c
C code和制作deb包关系不大也不需要修改我们主要看下Makefile文件我们在制作deb包时候这个文件是需要修改
PROG=hellodeb
CC=gcc
BINDIR=/usr/bin
INSTALL=cp
$(PROG): hellodeb.c
$(CC) -o $(PROG) hellodeb.c
clean:
rm -rf $(PROG)
:
$(INSTALL) $(PROG) $(BINDIR)
un:
rm -rf $(BINDIR)/$(PROG)
2. 创建GPG keyGPG key在build包时候需要用到创建思路方法参见GPG使用指南 创建完后检查下:
aubrey@aubrey-nexenta:~/deb/hellodeb$ gpg --list-keys
/export/home/aubrey/.gnupg/pubring.gpg
--------------------------------------
pub 1024D/7F8F1E57 2008-01-29
uid Aubrey Li <[email protected]>
sub 2048g/6AF6581E 2008-01-29
3. 要开始对这个包进行deb化了首先确保源代码目录绝对干净为了让软件Software包能够正确地制作必须把源代码目录名字改成小写并且符合<packagename>-<version>形式
aubrey@aubrey-nexenta:~/deb$ ls
hellodeb
aubrey@aubrey-nexenta:~/deb$ mv hellodeb/ hellodeb-1.0
aubrey@aubrey-nexenta:~/deb$ ls
hellodeb-1.0
4. 在正式deb化的前我们先要export两个环境变量:
aubrey@aubrey-nexenta:~/deb$ export DEBEMAIL="[email protected]"
aubrey@aubrey-nexenta:~/deb$ export DEBFULLNAME="Aubrey Li"
注意这里name和email必须和你生成GPG钥匙时候完全样这两个变量值也会在deb包changelog等多个文件里被用到
5. 现在可以对源码包进行deb化了
aubrey@aubrey-nexenta:~/deb/hellodeb-1.0$ dh_make
Type of package: single binary, multiple binary, library, kernel module or cdbs?
[s/m/l/k/b] s
Maainer name : Aubrey Li
Email-Address : [email protected]
Date : Sat, 16 Feb 2008 13:19:46 +0800
Package Name : hellodeb
Version : 1.0
License : blank
Type of Package : Single
Hit <enter> to confirm:
Done. Please edit the files in the debian/ subdirectory now. You should also
check that the hellodeb Makefiles o $DESTDIR and not in / .
aubrey@aubrey-nexenta:~/deb/hellodeb-1.0$
这里询问包类型这里我们是单个可执行文件所以我选了s
还有两个重要提示:
- Please edit the files in the debian/ subdirector
延伸阅读
最新评论