• 使用nfpm打包deb&&rpm


    nfpm是受fpm启发的一个deb以及rpm包制作工具,goreleaser中的rpm包制作就依赖此包(当然是同一个人开发的)
    使用nfpm的好处是简单,跨平台(基于golang同时包也小),以下是一个简单的使用

    安装nfpm

    比较简单,从github下载即可,https://github.com/goreleaser/nfpm/releases

    使用

    • init
      使用init 可以帮助我们生成一个配置模版,命令nfpm init
      nfpm init 内容如下(主要是关于deb以及rpm依赖的资源以及配置还有安装中的一些脚本)
     
    # nfpm example config file
    name: "foo"
    arch: "amd64"
    platform: "linux"
    version: "v${MY_APP_VERSION}"
    section: "default"
    priority: "extra"
    replaces:
    - foobar
    provides:
    - bar
    depends:
    - foo
    - bar
    # recommends on rpm packages requires rpmbuild >= 4.13
    recommends:
    - whatever
    # suggests on rpm packages requires rpmbuild >= 4.13
    suggests:
    - something-else
    conflicts:
    - not-foo
    - not-bar
    maintainer: "John Doe <john@example.com>"
    description: |
      FooBar is the great foo and bar software.
        And this can be in multiple lines!
    vendor: "FooBarCorp"
    homepage: "http://example.com"
    license: "MIT"
    bindir: "/usr/local/bin"
    files:
      ./foo: "/usr/local/bin/foo"
      ./bar: "/usr/local/bin/bar"
    config_files:
      ./foobar.conf: "/etc/foobar.conf"
    overrides:
      rpm:
        scripts:
          preinstall: ./scripts/preinstall.sh
          postremove: ./scripts/postremove.sh
      deb:
        scripts:
          postinstall: ./scripts/postinstall.sh
          preremove: ./scripts/preremove.sh
    • 创建demo资源
      因为是测试,我们需要参考上边的yaml,创建需要的文件,比如shell 脚本依赖的部署文件,内容可以为空
      主要是测试
     
    ├── bar
    ├── foo
    ├── foobar.conf
    ├── nfpm.yaml
    └── scripts
        ├── postinstall.sh
        ├── postremove.sh
        ├── preinstall.sh
        └── preremove.sh
    • 打包
    nfpm pkg -t /tmp/foo.deb
    nfpm pkg -t /tmp/foo.rpm

    效果

    说明

    nfpm 是一个不错的deb以及rpm打包工具,相对比fpm 弱了点,但是安装以及使用简单,是一个不错的工具

    参考资料

    https://github.com/goreleaser/nfpm

  • 相关阅读:
    sql 相关子查询
    sql 执行计划
    SQL表连接查询(inner join、full join、left join、right join)
    sql执行顺序
    sql 语句 嵌套子查询 执行顺序分析
    只有程序员才看得懂的情书
    Give Me an E
    hdu 1114 (背包变形)
    模版 并查集
    背包 讲解
  • 原文地址:https://www.cnblogs.com/rongfengliang/p/12638358.html
Copyright © 2020-2023  润新知