注意:文章只有很简单的介绍。
拿 fastfetch 做例子,发现结构是:
./fastfetch
├── control.tar.gz
├── data.tar.gz
└── debian-binary
debian-binary
是遵循的 Debian 包格式版本,control.tar.gz
里面是包信息,发现里面有两个文件:分别是 control
和 md5sum
,control
是包的信息(配置),貌似通过 apt-cache show
可以看到(?。md5sum
是文件的 md5
值,应该是使用了 md5sum
得到的。
Architecture: amd64
Depends: libc6 (>= 2.31)
Description: Fast neofetch-like system information toolfastfetch is a neofetch-like tool for fetching system information and displaying them in a pretty way. It is written mostly in C to achieve much better performance.
Homepage: https://github.com/fastfetch-cli/fastfetch
Maintainer: Linus Dierheimer <Linus@Dierheimer.de>
Package: fastfetch
Priority: optional
Section: devel
Version: 2.38.0
Installed-Size: 28791
Architecture
:架构Depends
:依赖(版本要求)Description
:描述Homepage
:显而易见(其实我不知道该怎么说)Maintainer
:维护者Package
:包名称Priority
:优先级Section
:分类Version
:版本号Installed-Size
:包大小
在 data
里的就是包的内容了。还是以 fastfetch 为例子(因为篇幅删掉了很多):
./data.tar.gz
└── usr├── bin│ ├── fastfetch│ └── flashfetch└── share├── bash-completion├── fastfetch├── fish├── licenses├── man└── zsh
它们会对应解压到这些地方。最后我做出了这个(功能为计算 \(A + B\)):
./twoplus
├── DEBIAN
│ ├── control
│ └── md5sum
├── debian-binary
└── usr└── bin└── twoplus
然后使用 dpkg-deb
得到了 deb
包。