2007年2月14日星期三

对现有文件打包:

对现有文件打包:

  • 创建工作目录

    构建模拟根目录, 比如 fakeroot :

    $ mkdir fakeroot 

  • 部署文件

    在 fakeroot 下构建模拟文件系统, 将欲打包文件放置到对应目录

    形如:

    tony@tony:~$ tree fakeroot/ fakeroot/ |-- DEBIAN |   |-- control |   `-- preinst `-- usr     `-- share         `-- doc             `-- securing-debian-howto.zh-cn                 |-- ap-bind-chuser.zh-cn.html                 |-- ap-bridge-fw.zh-cn.html                 |-- ap-checklist.zh-cn.html ... ... 

  • 创建配置文件

    在 fakeroot 下创建DEBIAN目录用于放置控制文件比如:

    control preinst postinst prerm postrm 等, 只有 control 是必须的, 其他为可选.

    可以在 /var/lib/dpkg/info 目录下找到这些脚本的范例

    比如

    tony@tony:~/fakeroot/DEBIAN$ cat control  Package: securing-debian-howto.zh-cn Priority: extra Section: doc Maintainer: tony <etony@tom.com> Architecture: all Version: 3.0 Description: Securing Debian Manual This manual describes the security of the Debian GNU/Linux operating system and within the Debian project. It covers some of the common tasks involved in setting up a secure user and network environment, gives information on the security tools available, steps to take before and after a compromise and also describes how security is enforced in Debian by the security team. The document includes a step by step hardening guide and within the appendix there is detailed information on how to setup an intrusion detection system and a bridge firewall with Debian GNU/Linux.  tony@tony:~/fakeroot/DEBIAN$ cat preinst #! /bin/sh  echo "." echo "."  echo "Welcome to install Securing Debian HOWTO. " echo "press any key to continue... " read exit 0 

  • 生成 .deb 包

    在 fakeroot 目录外执行:

    $ dpkg -b fakeroot securing-debian-howto-zh-cn.deb  dpkg-deb: building package `securing-debian-howto.zh-cn' in `securing-debian-howto-zh-cn.deb'. 

    将会在当前目录下生成 securing-debian-howto-zh-cn.deb 包

  • 检查包内容

    可是用以下命令检查:

    $ dpkg -c securing-debian-howto-zh-cn.deb  $ dpkg -I securing-debian-howto-zh-cn.deb 



--
一步一步教你从互联网赚钱
http://www.zqzn.com/index.asp?rid=key480769

没有评论: