首页 > 其他分享 >关于dpkg打包成deb格式的安装包

关于dpkg打包成deb格式的安装包

时间:2024-12-24 11:32:02浏览次数:7  
标签:package field myApp deb packages 安装包 dpkg

deb格式适用于Ubuntu、deepin、UOS等操作系统,适用于各种架构mips64el,amd64、X86等架构的服务器。
Ubuntu用dpkg将qt可执行程序制作成deb安装包
一、用linuxdeployqt工具打包可执行程序
此步骤可将可执行程序依赖的动态库等打包,过程点击此处查看。
二、dpkg打包前的准备
用dpkg打包前需要“映射”的把你要在目的计算机上安装的东西放在一个目录树结构中。
首先建立一个文件夹myApp(可自定义),如你想把程序安装在opt目录下的demo文件夹内(可自定义安装路径),就在myApp内建立一个文件夹opt文件夹,在opt下建立demo文件夹,再把第一步打包好的所有文件拷贝到demo内。
需要完整建立如下的目录树结构:

说明:
control文件在dpkg打包时需要。desktop文件会出现在系统的菜单中,方便启动程序 。
control文件的内容如下:
参考官方文献

package: myApp #安装包的名称 version: 1.0.0 #版本 architecture: amd64 #平台 maintainer: young #维护者 description: you can description the deb #描述安装包的信息

desktop文件的内容如下(可在applications目录下打开已安装程序的desktop文件做参考):

[Desktop Entry] Name=myApp #这个是程序名称 Comment=制作deb的工具 #注释 Exec=/opt/demo/demo #可执行文件存放的位置 Icon=/usr/share/icons/icon.png #图标存放的位置 Terminal=false #是否使用终端 Type=Application #应用类型 X-Ubuntu-Touch=true Categories=Development #分类的位置 Name[zh_CN]=安装测试 #显示中文名称

注意:在实际的文件中记得将#注释的内容都要删除。
三、dpkg命令制作deb包
在myApp的同级目录下,运行如下命令:
sudo dpkg -b myApp myApp_1.0.0_amd64.deb
打包完成即生成了myApp_1.0.0_amd64.deb 的deb包
四、dpkg的其他使用方法
安装:
sudo dpkg -i myApp_1.0.0_amd64.deb
卸载:
sudo dpkg -r myApp
查看软件信息:
sudo dpkg -l myApp
查看安装位置:
sudo dpkg -L myApp

官方参考

NAME deb-control - Debian packages' master control file format SYNOPSIS control DESCRIPTION Each Debian package contains the master `control' file, which contains a number of fields, or comments when the line starts with '#'. Each field begins with a tag, such as Package or Version (case insensitive), followed by a colon, and the body of the field. Fields are delimited only by field tags. In other words, field text may be multiple lines in length, but the installation tools will generally join lines when processing the body of the field (except in the case of the Description field, see below). REQUIRED FIELDS Package: package-name The value of this field determines the package name, and is used to generate file names by most installation tools. Version: version-string Typically, this is the original package's version number in whatever form the program's author uses. It may also include a Debian revision number (for non-native packages). The exact format and sorting algorithm are described in deb-version(5). Maintainer: fullname-email Should be in the format `Joe Bloggs <jbloggs@foo.com>', and is typically the person who created the package, as opposed to the author of the software that was packaged. Description: short-description long-description The format for the package description is a short brief summary on the first line (after the "Description" field). The following lines should be used as a longer, more detailed description. Each line of the long description must be preceded by a space, and blank lines in the long description must contain a single '.' following the preceding space. OPTIONAL FIELDS Section: section This is a general field that gives the package a category based on the software that it installs. Some common sections are `utils', `net', `mail', `text', `x11' etc. Priority: priority Sets the importance of this package in relation to the system as a whole. Common priorities are `required', `standard', `optional', `extra' etc. In Debian, the Section and Priority fields have a defined set of accepted values based on the Policy Manual. A list of these values can be obtained from the latest version of the debian-policy package. Essential: yes|no This field is usually only needed when the answer is yes. It denotes a package that is required for proper operation of the system. Dpkg or any other installation tool will not allow an Essential package to be removed (at least not without using one of the force options). Architecture: arch|all The architecture specifies which type of hardware this package was compiled for. Common architectures are `i386', `m68k', `sparc', `alpha', `powerpc' etc. Note that the all option is meant for packages that are architecture independent. Some examples of this are shell and Perl scripts, and documentation. Origin: name The name of the distribution this package is originating from. Bugs: url The url of the bug tracking system for this package. The current used format is bts-type://bts-address, like debbugs://bugs.debian.org. Homepage: url The upstream project home page url. Tag: tag-list List of tags describing the qualities of the package. The description and list of supported tags can be found in the debtags package. Multi-Arch: same|foreign|allowed|no This field is used to indicate how this package should behave on a multi-arch installations. The value same means that the package is co-installable with itself, but it must not be used to satisfy the dependency of any package of a different architecture from itself. The value foreign means that the package is not co-installable with itself, but should be allowed to satisfy the dependency of a package of a different arch from itself. The value allowed allows reverse-dependencies to indicate in their Depends field that they accept a package from a foreign architecture, but has no effect otherwise. The value no is the default when the field is omitted, in which case adding the field with an explicit no value is generally not needed. Source: source-name The name of the source package that this binary package came from, if different than the name of the package itself. Subarchitecture: value Kernel-Version: value Installer-Menu-Item: value These fields are used by the debian-installer and are usually not needed. See /usr/share/doc/debian-installer/devel/modules.txt from the debian-installer package for more details about them. Depends: package-list List of packages that are required for this package to provide a non-trivial amount of functionality. The package maintenance software will not allow a package to be installed if the packages listed in its Depends field aren't installed (at least not without using the force options). In an installation, the postinst scripts of packages listed in Depends: fields are run before those of the packages which depend on them. On the opposite, in a removal, the prerm script of a package is run before those of the packages listed in its Depends: field. Pre-Depends: package-list List of packages that must be installed and configured before this one can be installed. This is usually used in the case where this package requires another package for running its preinst script. Recommends: package-list Lists packages that would be found together with this one in all but unusual installations. The package maintenance software will warn the user if they install a package without those listed in its Recommends field. Suggests: package-list Lists packages that are related to this one and can perhaps enhance its usefulness, but without which installing this package is perfectly reasonable. The syntax of Depends, Pre-Depends, Recommends and Suggests fields is a list of groups of alternative packages. Each group is a list of packages separated by vertical bar (or `pipe') symbols, `|'. The groups are separated by commas. Commas are to be read as `AND', and pipes as `OR', with pipes binding more tightly. Each package name is optionally followed by a version number specification in parentheses. A version number may start with a `>>', in which case any later version will match, and may specify or omit the Debian packaging revision (separated by a hyphen). Accepted version relationships are ">>" for greater than, "<<" for less than, ">=" for greater than or equal to, "<=" for less than or equal to, and "=" for equal to. Breaks: package-list Lists packages that this one breaks, for example by exposing bugs when the named packages rely on this one. The package maintenance software will not allow broken packages to be configured; generally the resolution is to upgrade the packages named in a Breaks field. Conflicts: package-list Lists packages that conflict with this one, for example by containing files with the same names. The package maintenance software will not allow conflicting packages to be installed at the same time. Two conflicting packages should each include a Conflicts line mentioning the other. Replaces: package-list List of packages files from which this one replaces. This is used for allowing this package to overwrite the files of another package and is usually used with the Conflicts field to force removal of the other package, if this one also has the same files as the conflicted package. Provides: package-list This is a list of virtual packages that this one provides. Usually this is used in the case of several packages all providing the same service. For example, sendmail and exim can serve as a mail server, so they provide a common package (`mail-transport-agent') on which other packages can depend. This will allow sendmail or exim to serve as a valid option to satisfy the dependency. This prevents the packages that depend on a mail server from having to know the package names for all of them, and using `|' to separate the list. The syntax of Breaks, Conflicts, Replaces and Provides is a list of package names, separated by commas (and optional whitespace). In the Breaks and Conflicts fields, the comma should be read as `OR'. An optional version can also be given with the same syntax as above for the Breaks, Conflicts and Replaces fields. Built-Using: package-list This field lists extra source packages that were used during the build of this binary package. This is an indication to the archive maintenance software that these extra source packages must be kept whilst this binary package is maintained. This field must be a list of source package names with strict (=) version relationships. Note that the archive maintenance software is likely to refuse to accept an upload which declares a Built-Using relationship which cannot be satisfied within the archive. EXAMPLE # Comment Package: grep Essential: yes Priority: required Section: base Maintainer: Wichert Akkerman <wakkerma@debian.org> Architecture: sparc Version: 2.4-1 Pre-Depends: libc6 (>= 2.0.105) Provides: rgrep Conflicts: rgrep Description: GNU grep, egrep and fgrep. The GNU family of grep utilities may be the "fastest grep in the west". GNU grep is based on a fast lazy-state deterministic matcher (about twice as fast as stock Unix egrep) hybridized with a Boyer-Moore-Gosper search for a fixed string that eliminates impossible text from being considered by the full regexp matcher without necessarily having to look at every character. The result is typically many times faster than Unix grep or egrep. (Regular expressions containing backreferencing will run more slowly, however).

__EOF__

本文作者:朱辉彪
本文链接:https://www.cnblogs.com/zhuhuibiao/p/16902134.html
关于博主:评论和私信会在第一时间回复。或者直接私信我。
版权声明:本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
声援博主:如果您觉得文章对您有帮助,可以点击文章右下角推荐】一下。您的鼓励是博主的最大动力!

标签:package,field,myApp,deb,packages,安装包,dpkg
From: https://www.cnblogs.com/chinasoft/p/18627014

相关文章

  • 最新版的IDEA运行java时怎么看运行过程此操作为(IDEA Debug)
    想必每个学习java的帅哥美女们在运行循环代码的时候,直接看到结果是感觉不真实的,小编今天在学习数组时研究了一个小时都怪我没有好好牢记Random的使用导致了代码的疑问性为此IDEA中有个好用的操作可以查看运行时的步骤是怎样一步一步跑的,废话不多说看下图如图所示为运行步骤......
  • 与程序设计有关的网址收藏C/C++(CodeBlocks/wxWidgets)、Pascal(Lazarus/Delphi/LCL/FCL)
    0.前言在网上查看资料的时候,经常会看到一些好的文章,这些文章介绍的知识点可能是当时使用的,也可能是以后能用得着的。对于那些以后能用得着的知识点,有时在用到的时候在想找却忘记了是在哪一篇文章里了,或者再搜索却搜索不到了。通常遇到以后可能需要的文章,最好的办法是收藏。可是......
  • react中怎么实现防抖Debounce和节流Throttle
    1.防抖 (Debounce)://1.自定义Hook实现防抖import{useState,useEffect}from'react';functionuseDebounce<T>(value:T,delay:number=300):T{const[debouncedValue,setDebouncedValue]=useState<T>(value);useEffect(()=>......
  • 8086汇编(16位汇编)学习笔记01.汇编基础和debug使用
    原文链接:https://bpsend.net/thread-100-1-2.html     为什么学习16位汇编?16位操作指令最多能够操作两个字节,且更能够体现出与硬件的交互。16位下的指令和32位汇编的指令差不多。16位汇编的指令在32位一样使用.要学好汇编必须要了解一点点硬件知识,16汇编是直接操作......
  • win10、11安装eNSPeNSP安装包等资料提供:
    win10、11安装eNSPeNSP安装包等资料提供:eNSPhttps://www.alipan.com/s/gVRgcaJ6xSv点击链接保存,或者复制本段内容,打开「阿里云盘」APP,无需下载极速在线查看,视频原画倍速播放。现在的win11装virtualBox5.2.44会出现无法在此设备上运行的问题。是因为win11的内存虚拟化导致的......
  • 8086汇编(16位汇编)学习笔记00.DEBUG命令使用解析及范例大全
    转载自:https://bpsend.net/thread-99-1-1.html启动Debug,它是可用于测试和调试MS-DOS可执行文件的程序。Debug[[drive:][path]filename[parameters]]参数[drive:][path]filename指定要测试的可执行文件的位置和名称。parameters指定要测试的......
  • 大学8086汇编debug——关于int3断点之后继续调试的方法
    预先在汇编中打入int3,然后在debug中利用G,就可以一路运行到断点处。正文在断点上可以用U来查看上下代码的位置断点后运行然后用-g=xxxx:xxxx可以运行到下一个断点,或是直接运行至结束还可以用-t=xxxx:xxxx逐步运行注意:xxxx:xxxx是int3下一个命令的地址......
  • 你有了解过javaScript Debugger的原理吗?
    关于JavaScriptDebugger的原理,我可以从以下几个方面进行解释:Debugger的基础作用:JavaScriptDebugger是前端开发者的一个重要工具,它允许开发者在代码执行过程中暂停,从而检查和操作当前的程序状态。这包括查看变量值、调用栈、作用域等,以及逐步执行代码来观察每一步如何影响程......
  • 12.10【java exp4】【debug】
    pro1如何知道哪个环境出错了?如何知道nginx的在后端添加跨域处理的时候,localhost一开始写的是https,所以不行,改成http后就可以了pro2登录后,向后端服务器发送申请,nginx会自动发送出一个/auth/check请求,进行验证;但是auth认证服务器并没有受到check请求,同时前台页面会直......
  • Android 安装包提示安装包损坏
    前言全局说明Android安装包提示安装包损坏一、说明二、错误提示:安装包损坏,建议重新下载安装三、解决方法3.1安装包确实下载损坏,重新下载,或查看MD5值,看是否不一致,如不一致则是损坏。3.2android系统和apk文件不匹配,低版本系统用高版本apk就会有此提示四......