fos*_*dom 23 package-management deb
我想创建一个全新的 deb 包来安装一系列文件。如果可能的话,我想将包含这些文件的文件夹作为安装的一部分解压缩到一个已知的文件夹位置。否则,一些如何打包源文件夹和文件的知识将非常有用。
问题是 - 这是否可能,如果可以 - 如何?
让我们举个例子:
~/mypluginfolder/包含文件x, y,一个名为 的子文件夹abc,在另一个名为z.
我想tar这个文件夹: tar -cvf myfiles.tar ~/mypluginfolder
我想我的 debian 包看起来像
myfiles.tar.gz
myfiles+ppafoss_0.1-1/
myfiles.tar
DEBIAN
changelog, compat, control, install, rules source
Run Code Online (Sandbox Code Playgroud)
例如,是否可以以某种方式解压myfiles.tar到已知文件夹位置
/usr/share/rhythmbox/plugins/
Run Code Online (Sandbox Code Playgroud)
因此最终的结果将是:
/usr/share/rhythmbox/plugins/mypluginfolder
/usr/share/rhythmbox/plugins/mypluginfolder\x
/usr/share/rhythmbox/plugins/mypluginfolder\y
/usr/share/rhythmbox/plugins/mypluginfolder\abc\z
Run Code Online (Sandbox Code Playgroud)
如果 - 假设启动板需要源代码,我会寻求有关将源文件夹和文件放入 deb 包结构的位置的建议。
这最终将成为一系列单独的启动板 PPA 包。
我更喜欢(但可能无法实现......)是将我的包装保持在最低限度 - 从模板创建一系列包并调整最低限度(变更日志等 + tar 文件/文件和文件夹结构) .
Lek*_*eyn 31
下面,我假设源代码是开放的(例如 Python 脚本),因此不受任何架构(例如 amd64 或 i386)的约束,因此是“全部”。如果您有一些 C 源代码,则需要Architecture: amd64 i386在源control文件中使用。
这最终将成为一系列单独的启动板 PPA 包。
我更喜欢(但可能无法实现......)是将我的包装保持在最低限度 - 从模板创建一系列包并调整最低限度(变更日志等 + tar 文件)。
Launchpad 只接受源包,因此创建一个rules将文件安装在正确位置的文件。为方便起见,我将使用debhelper。包含您的文件的目录应如下所示:
debian/changelog
debian/control
debian/rules
debian/compat
mypluginfolder/...
Run Code Online (Sandbox Code Playgroud)
甲debian/copyright文件也可以是用于通知与所述包相关联的许可证的用户是有用的。我认为您不需要postinst脚本,因为您只需要提取一些文件。compat应该包含 debhelper 兼容性级别,比如“8”。(更多细节请参考debhelper 的手册页)
changelog可以使用dch命令编辑该文件,该命令可从devscripts包中获得。在rules(使用debhelper的)应包含以下内容:
#!/usr/bin/make -f
%:
dh $@
override_dh_install:
dh_install mypluginfolder/ /usr/share/rhythmbox/plugins
Run Code Online (Sandbox Code Playgroud)
使用chmod 755 debian/rules. 可以使用debuild -S. 确保位于名为<package-name>-<version>. 有关override_行为和dh命令的更多信息可以在其手册页上找到。
在Debian新维护人员手册是非常有价值的,我理解这一点,推荐阅读。示例包装可以在https://github.com/Bumblebee-Project/bumblebee-ppa上找到。
dpkg-deb -b可用于从现有文件树创建 tarball。首先,首先创建一个应以您的包命名的目录。我假设你想给它命名myplugin,然后把它放在/usr/share/rhythmbox/plugins/mypluginfolder. 此外,创建DEBIAN用于存储包信息的目录(大写!):
mkdir -p myplugin/usr/share/rhythmbox/plugins/mypluginfolder
mkdir myplugin/DEBIAN
Run Code Online (Sandbox Code Playgroud)
复制您的文件:
cp -r ~/mypluginsfolder myplugin/usr/share/rhythmbox/plugins
Run Code Online (Sandbox Code Playgroud)
接下来,您将需要一个所谓的控制文件,myplugin/DEBIAN/control该文件位于描述该包的位置。此类文件的内容如下:
Package: myplugin
Version: 1.0-1
Maintainer: You <whatever@contact.address>
Architecture: all
Description: plugins for Rhythmbox
Longer description here
.
As you can see, new paragraph are split by a single dot,
and lines have to be indented by one space.
Run Code Online (Sandbox Code Playgroud)
现在,您可以选择验证包的内容。下一个命令列出了以下文件和目录条目的内容myplugin:
find myplugin -ls
Run Code Online (Sandbox Code Playgroud)
如果满意,请在当前目录中构建包:
dpkg-deb -b myplugin .
Run Code Online (Sandbox Code Playgroud)
将出现一个新文件,名称类似于<package>_<version>_<architecture>.deb本示例中的myplugin_1.0-1_all.deb. 您可以使用该less程序查看文件。例如,less myplugin_1.0-1_all.deb。
| 归档时间: |
|
| 查看次数: |
20746 次 |
| 最近记录: |