github.com/elyscape/goreleaser@v0.66.1-0.20180515111211-5252f74ade63/www/content/linux-packages.md (about)

     1  ---
     2  title: Linux Packages
     3  series: customization
     4  hideFromIndex: true
     5  weight: 80
     6  ---
     7  
     8  GoReleaser can generate RPM, Deb and Snap packages for your projects.
     9  
    10  Let's see each option in detail:
    11  
    12  ## NFPM
    13  
    14  GoReleaser can be wired to [nfpm](https://github.com/goreleaser/nfpm) to
    15  generate and publish `.deb` and `.rpm` packages.
    16  
    17  Available options:
    18  
    19  ```yml
    20  # .goreleaser.yml
    21  nfpm:
    22    # You can change the name of the package.
    23    # This is parsed with the Go template engine and the following variables
    24    # are available:
    25    # - ProjectName
    26    # - Tag
    27    # - Version (Git tag without `v` prefix)
    28    # - Os
    29    # - Arch
    30    # - Arm (ARM version)
    31    # - Env (environment variables)
    32    # Default: `{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}`
    33    name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
    34  
    35    # Replacements for GOOS and GOARCH in the package name.
    36    # Keys should be valid GOOSs or GOARCHs.
    37    # Values are the respective replacements.
    38    # Default is empty.
    39    replacements:
    40      amd64: 64-bit
    41      386: 32-bit
    42      darwin: macOS
    43      linux: Tux
    44  
    45    # Your app's vendor.
    46    # Default is empty.
    47    vendor: Drum Roll Inc.
    48    # Your app's homepage.
    49    # Default is empty.
    50    homepage: https://example.com/
    51  
    52    # Your app's maintainer (probably you).
    53    # Default is empty.
    54    maintainer: Drummer <drum-roll@example.com>
    55  
    56    # Your app's description.
    57    # Default is empty.
    58    description: Software to create fast and easy drum rolls.
    59  
    60    # Your app's license.
    61    # Default is empty.
    62    license: Apache 2.0
    63  
    64    # Formats to be generated.
    65    formats:
    66      - deb
    67      - rpm
    68  
    69    # Packages your package depends on.
    70    dependencies:
    71      - git
    72      - zsh
    73  
    74    # Packages your package recommends installing.
    75    # For RPM packages rpmbuild >= 4.13 is required
    76    recommends:
    77      - bzr
    78      - gtk
    79  
    80    # Packages your package suggests installing.
    81    # For RPM packages rpmbuild >= 4.13 is required
    82    suggests:
    83      - cvs
    84      - ksh
    85  
    86    # Packages that conflict with your package.
    87    conflicts:
    88      - svn
    89      - bash
    90  
    91    # Override default /usr/local/bin destination for binaries
    92    bindir: /usr/bin
    93  
    94    # Files or directories to add to your package (beyond the binary).
    95    # Keys are source paths/globs to get the files from.
    96    # Values are the destination locations of the files in the package.
    97    files:
    98      "scripts/etc/init.d/": "/etc/init.d"
    99      "path/**/glob": "/var/foo/glob"
   100  
   101    # Config files to add to your package. They are about the same as
   102    # the files keyword, except package managers treat them differently (while
   103    # uninstalling, mostly).
   104    # Keys are source paths/globs to get the files from.
   105    # Values are the destination locations of the files in the package.
   106    config_files:
   107      "tmp/app_generated.conf": "/etc/app.conf"
   108      "conf/*.conf": "/etc/foo/"
   109  
   110    # Scripts to execute during the installation of the package.
   111    # Keys are the possible targets during the installation process
   112    # Values are the paths to the scripts which will be executed
   113    scripts:
   114      preinstall: "scripts/preinstall.sh"
   115      postinstall: "scripts/postinstall.sh"
   116      preremove: "scripts/preremove.sh"
   117      postremove: "scripts/postremove.sh"
   118  
   119    # Some attributes can be overrided per package format.
   120    overrides:
   121      deb:
   122        conflicts:
   123          - subversion
   124        dependencies:
   125          - git
   126        suggests:
   127          - gitk
   128        recommends:
   129          - tig
   130      rpm:
   131        replacements:
   132          amd64: x86_64
   133        name_template: "{{ .ProjectName }}-{{ .Version }}-{{ .Arch }}"
   134        files:
   135          "tmp/man.gz": "/usr/share/man/man8/app.8.gz"
   136        config_files:
   137          "tmp/app_generated.conf": "/etc/app-rpm.conf"
   138        scripts:
   139          preinstall: "scripts/preinstall-rpm.sh"
   140  ```
   141  
   142  Note that GoReleaser will not install `rpmbuild` or any dependencies for you.
   143  As for now, `rpmbuild` is recommended if you want to generate rpm packages.
   144  You can install it with `apt-get install rpm` or `brew install rpm`.
   145  
   146  ## Snapcraft
   147  
   148  GoReleaser can also generate `snap` packages.
   149  [Snaps](http://snapcraft.io/) are a new packaging format, that will let you
   150  publish your project directly to the Ubuntu store.
   151  From there it will be installable in all the
   152  [supported Linux distros](https://snapcraft.io/docs/core/install), with
   153  automatic and transactional updates.
   154  
   155  You can read more about it in the [snapcraft docs](https://snapcraft.io/docs/).
   156  
   157  Available options:
   158  
   159  ```yml
   160  # .goreleaser.yml
   161  snapcraft:
   162    # You can change the name of the package.
   163    # This is parsed with the Go template engine and the following variables
   164    # are available:
   165    # - ProjectName
   166    # - Tag
   167    # - Version (Git tag without `v` prefix)
   168    # - Os
   169    # - Arch
   170    # - Arm (ARM version)
   171    # - Env (environment variables)
   172    # Default: `{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}`
   173    name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
   174  
   175    # Replacements for GOOS and GOARCH in the package name.
   176    # Keys should be valid GOOSs or GOARCHs.
   177    # Values are the respective replacements.
   178    # Default is empty.
   179    replacements:
   180      amd64: 64-bit
   181      386: 32-bit
   182      darwin: macOS
   183      linux: Tux
   184  
   185    # The name of the snap. This is optional.
   186    # Default is project name.
   187    name: drumroll
   188  
   189    # Single-line elevator pitch for your amazing snap.
   190    # 79 char long at most.
   191    summary: Software to create fast and easy drum rolls.
   192  
   193    # This the description of your snap. You have a paragraph or two to tell the
   194    # most important story about your snap. Keep it under 100 words though,
   195    # we live in tweetspace and your description wants to look good in the snap
   196    # store.
   197    description: |
   198      This is the best drum roll application out there.
   199      Install it and awe!
   200  
   201    # A guardrail to prevent you from releasing a snap to all your users before
   202    # it is ready.
   203    # `devel` will let you release only to the `edge` and `beta` channels in the
   204    # store. `stable` will let you release also to the `candidate` and `stable`
   205    # channels. More info about channels here:
   206    # https://snapcraft.io/docs/reference/channels
   207    grade: stable
   208  
   209    # Snaps can be setup to follow three different confinement policies:
   210    # `strict`, `devmode` and `classic`. A strict confinement where the snap
   211    # can only read and write in its own namespace is recommended. Extra
   212    # permissions for strict snaps can be declared as `plugs` for the app, which
   213    # are explained later. More info about confinement here:
   214    # https://snapcraft.io/docs/reference/confinement
   215    confinement: strict
   216  
   217    # Each binary built by GoReleaser is an app inside the snap. In this section
   218    # you can declare extra details for those binaries. It is optional.
   219    apps:
   220  
   221      # The name of the app must be the same name as the binary built.
   222      drumroll:
   223  
   224        # If your app requires extra permissions to work outside of its default
   225        # confined space, declare them here.
   226        # You can read the documentation about the available plugs and the
   227        # things they allow:
   228        # https://snapcraft.io/docs/reference/interfaces).
   229        plugs: ["home", "network"]
   230  
   231        # If you want your app to be autostarted and to always run in the
   232        # background, you can make it a simple daemon.
   233        daemon: simple
   234  ```
   235  
   236  Note that GoReleaser will not install `snapcraft` nor any of its dependencies
   237  for you.