前言

  • 制作deb的方式很多

    • 使用 dpkg-deb 方式
    • 使用 checkinstall 方式
    • 使用 dh_make 方式
    • 修改原有的 deb 包

概念 **

  • deb包

    • deb包是在linux系统下的一种安装包
    • 它是基于tar包的
      • 所以同样会记录着文件的权限信息(读、写、可执行)、所有者、用户组等
    • 可以使用 dpkg -l 命令来查看系统以及安装了哪些deb包。
  • deb包组成(一般分成两部)**
    • 控制信息 (放在 DEBIAN 目录下)

      • 本 deb 包的 DEBIAN 目录下有 changelog、control、copyright、postinst、postrm 等文件(不一定全部都要有)

        • changelog

          • 记录了该deb包的作者、版本以及最后一次更新日期等信息
        • control
          • 记录了包名、版本号、架构、维护者及描述等信息
        • copyright
          • 文件记录了一些版权信息
        • postinst
          • 安装后执行的配置文件
        • postrm
          • 软件卸载后需要执行的脚本
    • 安装的内容
      • 目录方式和文件系统根目录一样
      • 最终存放着需要运行的脚本

创建自己的deb包

  • 创建目录

    • 创建目录 myDeb
    • 创建目录 myDeb/DEBIAN
    • 创建目录 myDeb/home/lss/work
  • 创建文件

    • myDeb/DEBIAN 目录下
  • 构建 deb 包

    • 运行 sudo dpkg-deb -b ../mydeb ../MyAdcSoftware_1.0.0_armhf.deb

    • sdpkg -c myHello_1.0.0_armhf.deb 查看制作包的内容

    • sdpkg -i myHello_1.0.0_armhf.deb 安装了该软件

    • sdpkg -s myHello 查看是否安装了该软件

    • 运行效果

文件源码

  • myDeb/home/lss/work/myHello.sh
#/** @file         myHello.sh
# * @brief 简要说明
# * @details 详细说明
# * @author lzm
# * @date 2020-11-08 19:33:53
# * @version v1.0
# * @copyright Copyright By lizhuming, All Rights Reserved
# *
# **********************************************************
# * @LOG 修改日志:
# **********************************************************
#*/ #!/bin/bash echo hello
  • myDeb/DEBIAN/control
Package: myHello
Version: 1.0.0
Section: free
Priority: optional
Essential: no
Architecture: armhf
Maintainer: lss <821350342@qq.com>
Provides: MyHello
Description: hello detect
  • myDeb/DEBIAN/postinst
if [ "$1" = "upgrade" ] || [ "$1" = "install" ];then
echo "install"
fi
  • myDeb/DEBIAN/postrm
if [ "$1" = "upgrade" ] ; then
echo "upgrade"
elif [ "$1" = "remove" ] || [ "$1" = "purge" ] ; then
echo "remove"
fi

【linux】制作deb包方法 **的更多相关文章

  1. 用dpkg命令制作deb包方法总结

    用dpkg命令制作deb包方法总结 如何制作Deb包和相应的软件仓库,其实这个很简单.这里推荐使用dpkg来进行deb包的创建.编辑和制作. 首先了解一下deb包的文件结构: deb 软件包里面的结构 ...

  2. 从源代码制作deb包的两种方法以及修改已有deb包(转载)

    From:http://yysfire.github.io/linux/%E4%BB%8E%E6%BA%90%E4%BB%A3%E7%A0%81%E5%88%B6%E4%BD%9Cdeb%E5%8C% ...

  3. Ubuntu下制作deb包的方法详解

    1  认识deb包 1.1   认识deb包 deb是Unix系统(其实主要是Linux)下的安装包,基于 tar 包,因此本身会记录文件的权限(读/写/可执行)以及所有者/用户组. 由于 Unix ...

  4. ubuntu 制作deb 包

    ubuntu下打包制作deb安装包 http://www.th7.cn/system/lin/201406/61012.shtml   2014-06-22 20:16:45CSDN-yangbing ...

  5. [deb]制作deb包

    转自:http://www.cnblogs.com/Genesis-007/p/5219960.html 查看系统安装了哪些deb包: dpkg -l 打包: dpkg -b dir result.d ...

  6. dpkg制作deb包

    deb包的文件结构: deb包里面的结构:DEBIAN目录 和 软件具体安装目录(模拟安装目录)(如etc, usr, opt, tmp等). 在DEBIAN目录中至少有control文件,还可能有p ...

  7. Linux 之 deb 包生成、安装、卸载

    Linux 之 deb 包的生成.安装和卸载 deb DEB 是 Debian 软件包格式的文件扩展名,是 Unixar 的标准归档,将包文件信息以及包内容,经过 gzip 和 tar 打包而成. d ...

  8. Fedora Linux安装deb包

    前言: 我们知道,在Linux系统上有两种主要的软件包格式,分别是RPM和deb. RPM是"RPM Package Manager(RPM软件包管理器)"的递归缩写.RPM是一种 ...

  9. Linux制作deb

    1.新建一个我们临时的工作目录mkdir deb 2.新建我们程序的目录mkdir hello 3.编写我们的程序 我们以我们最熟悉的helloworld程序做起,hello.c代码如下#includ ...

随机推荐

  1. vue watch All In One

    vue watch All In One var vm = new Vue({ data: { a: 1, b: 2, c: 3, d: 4, e: { f: { g: 5 } } }, watch: ...

  2. SASS CSS3 koala

    CSS with superpowers Sass: Syntactically Awesome Style Sheets http://sass-lang.com/ Sass is the most ...

  3. 动态规划算法 All In One

    动态规划算法 All In One dynamic programming leetcode https://leetcode.com/tag/dynamic-programming/ https:/ ...

  4. hackr.io & Programming Courses & Programming Tutorials

    hackr.io & Programming Courses & Programming Tutorials the Best Programming Courses & Tu ...

  5. LeetCode & tree & binary tree

    LeetCode & tree & binary tree 树 & 二叉树 refs https://leetcode.com/problemset/all/?topicSlu ...

  6. js binary search algorithm

    js binary search algorithm js 二分查找算法 二分查找, 前置条件 存储在数组中 有序排列 理想条件: 数组是递增排列,数组中的元素互不相同; 重排 & 去重 顺序 ...

  7. yapi & mock JSON

    yapi & mock JSON json, body https://hellosean1025.github.io/yapi/documents/mock.html response bo ...

  8. Baccarat如何点燃DEFI市场?

    目前DeFi是成为了各大生态的"兵家必争之地",与此同时DeFi的高收益也成为吸引散户入局的一个利器.而虽然流动性挖矿板块近期的温度有所下降,但是这其中不乏还是有很多收益颇丰的De ...

  9. python 第三方库paramiko

    目录 介绍 三种常用方式 使用密码进行登录 使用密钥免密码登录 SFTP 传输文件 terminal demo 介绍 paramiko是什么可以参考其他人的博客或文章,这里不再赘述,直入正题. 本次测 ...

  10. Dyno-queues 分布式延迟队列 之 生产消费

    Dyno-queues 分布式延迟队列 之 生产消费 目录 Dyno-queues 分布式延迟队列 之 生产消费 0x00 摘要 0x01 前情回顾 1.1 设计目标 1.2 选型思路 0x02 产生 ...