Skip to content

Commit 6497678

Browse files
committed
feat(deb): "Priority" attribute for .deb packages
Close #1088
1 parent 6597810 commit 6497678

File tree

3 files changed

+33
-12
lines changed

3 files changed

+33
-12
lines changed

docs/Options.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,12 @@ For example, to change icon location for DMG:
2424
As you can see, you need to customize MacOS options only if you want to provide custom `x, y`.
2525
Don't customize paths to background and icon, — just follow conventions.
2626

27+
Most of the options accept `null` — for example, to explicitly set that DMG icon must be default volume icon from the OS and default rules must be not applied (i.e. use application icon as DMG icon), set `dmg.icon` to `null`.
28+
2729
<!-- do not edit. start of generated block -->
2830
* [Configuration Options](#Config)
2931
* [appx](#AppXOptions)
32+
* [deb Debian Package Specific Options](#DebOptions)
3033
* [directories](#MetadataDirectories)
3134
* [dmg macOS DMG Options](#DmgOptions)
3235
* [fileAssociations File Associations](#FileAssociation)
@@ -80,6 +83,14 @@ Please see [Windows AppX docs](https://msdn.microsoft.com/en-us/library/windows/
8083
| publisherDisplayName | <a name="AppXOptions-publisherDisplayName"></a>A friendly name for the publisher that can be displayed to users. Corresponds to [Properties.PublisherDisplayName](https://msdn.microsoft.com/en-us/library/windows/apps/br211460.aspx).
8184
| identityName | <a name="AppXOptions-identityName"></a>Describes the contents of the package. The Name attribute is case-sensitive. Corresponds to [Identity.Name](https://msdn.microsoft.com/en-us/library/windows/apps/br211441.aspx).
8285

86+
<a name="DebOptions"></a>
87+
### `deb` Debian Package Specific Options
88+
| Name | Description
89+
| --- | ---
90+
| synopsis | <a name="DebOptions-synopsis"></a>The [short description](https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Description).
91+
| compression | <a name="DebOptions-compression"></a>The compression type, one of `gz`, `bzip2`, `xz`. Defaults to `xz`.
92+
| priority | <a name="DebOptions-priority"></a>The [Priority](https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Priority) attribute.
93+
8394
<a name="MetadataDirectories"></a>
8495
### `directories`
8596
| Name | Description
@@ -126,11 +137,9 @@ On Windows works only if [nsis.perMachine](https://github.com/electron-userland/
126137
| packageCategory | <a name="LinuxBuildOptions-packageCategory"></a>The [package category](https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Section). Not applicable for AppImage.
127138
| description | <a name="LinuxBuildOptions-description"></a>As [description](#AppMetadata-description) from application package.json, but allows you to specify different for Linux.
128139
| target | <a name="LinuxBuildOptions-target"></a><p>Target package type: list of <code>AppImage</code>, <code>snap</code>, <code>deb</code>, <code>rpm</code>, <code>freebsd</code>, <code>pacman</code>, <code>p5p</code>, <code>apk</code>, <code>7z</code>, <code>zip</code>, <code>tar.xz</code>, <code>tar.lz</code>, <code>tar.gz</code>, <code>tar.bz2</code>, <code>dir</code>. Defaults to <code>AppImage</code>.</p> <p>The most effective [xz](https://en.wikipedia.org/wiki/Xz) compression format used by default.</p>
129-
| synopsis | <a name="LinuxBuildOptions-synopsis"></a>*deb-only.* The [short description](https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Description).
130140
| maintainer | <a name="LinuxBuildOptions-maintainer"></a>The maintainer. Defaults to [author](#AppMetadata-author).
131141
| vendor | <a name="LinuxBuildOptions-vendor"></a>The vendor. Defaults to [author](#AppMetadata-author).
132142
| desktop | <a name="LinuxBuildOptions-desktop"></a>The [Desktop file](https://developer.gnome.org/integration-guide/stable/desktop-files.html.en) entries (name to value).
133-
| compression | <a name="LinuxBuildOptions-compression"></a>*deb-only.* The compression type, one of `gz`, `bzip2`, `xz`. Defaults to `xz`.
134143
| depends | <a name="LinuxBuildOptions-depends"></a>Package dependencies. Defaults to `["gconf2", "gconf-service", "libnotify4", "libappindicator1", "libxtst6", "libnss3"]` for `deb`.
135144
| executableName | <a name="LinuxBuildOptions-executableName"></a><p>The executable name. Defaults to <code>productName</code>.</p> <p>Cannot be specified per target, allowed only in the <code>linux</code>.</p>
136145
| icon | <a name="LinuxBuildOptions-icon"></a><p>The path to icon set directory, relative to <code>build</code> (build resources directory). The icon filename must contain the size (e.g. 32x32.png) of the icon. By default will be generated automatically based on the macOS icns file.</p>

packages/electron-builder/src/options/linuxOptions.ts

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,6 @@ export interface LinuxBuildOptions extends PlatformSpecificBuildOptions {
2626
*/
2727
readonly target?: Array<string> | null
2828

29-
/*
30-
*deb-only.* The [short description](https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Description).
31-
*/
32-
readonly synopsis?: string | null
33-
3429
/*
3530
The maintainer. Defaults to [author](#AppMetadata-author).
3631
*/
@@ -52,11 +47,6 @@ export interface LinuxBuildOptions extends PlatformSpecificBuildOptions {
5247
readonly afterInstall?: string | null
5348
readonly afterRemove?: string | null
5449

55-
/*
56-
*deb-only.* The compression type, one of `gz`, `bzip2`, `xz`. Defaults to `xz`.
57-
*/
58-
readonly compression?: string | null
59-
6050
/*
6151
Package dependencies. Defaults to `["gconf2", "gconf-service", "libnotify4", "libappindicator1", "libxtst6", "libnss3"]` for `deb`.
6252
*/
@@ -76,6 +66,26 @@ export interface LinuxBuildOptions extends PlatformSpecificBuildOptions {
7666
readonly icon?: string
7767
}
7868

69+
/*
70+
### `deb` Debian Package Specific Options
71+
*/
72+
export interface DebOptions {
73+
/*
74+
The [short description](https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Description).
75+
*/
76+
readonly synopsis?: string | null
77+
78+
/*
79+
The compression type, one of `gz`, `bzip2`, `xz`. Defaults to `xz`.
80+
*/
81+
readonly compression?: string | null
82+
83+
/*
84+
The [Priority](https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Priority) attribute.
85+
*/
86+
readonly priority?: string | null
87+
}
88+
7989
/*
8090
### `snap` [Snap](http://snapcraft.io) Specific Options
8191
*/

packages/electron-builder/src/targets/fpm.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { LinuxPackager } from "../linuxPackager"
1111
import { log, warn } from "electron-builder-util/out/log"
1212
import { Target, Arch } from "electron-builder-core"
1313
import { unlinkIfExists } from "electron-builder-util/out/fs"
14+
import { DebOptions } from "../options/linuxOptions"
1415

1516
const fpmPath = (process.platform === "win32" || process.env.USE_SYSTEM_FPM === "true") ?
1617
BluebirdPromise.resolve("fpm") : downloadFpm()
@@ -118,6 +119,7 @@ export default class FpmTarget extends Target {
118119

119120
if (target === "deb") {
120121
args.push("--deb-compression", options.compression || (packager.config.compression === "store" ? "gz" : "xz"))
122+
use((<DebOptions>options).priority, it => args.push("--deb-priority", it!))
121123
}
122124
else if (target === "rpm") {
123125
// args.push("--rpm-compression", options.compression || (this.config.compression === "store" ? "none" : "xz"))

0 commit comments

Comments
 (0)