Skip to content

Commit

Permalink
Add priority and section support
Browse files Browse the repository at this point in the history
  • Loading branch information
naman-crabnebula committed Jan 9, 2024
1 parent bffce40 commit 021618c
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 1 deletion.
15 changes: 15 additions & 0 deletions bindings/packager/nodejs/src-ts/config.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,21 @@ export interface DebianConfig {
* Default file contents: ```text [Desktop Entry] Categories={{categories}} {{#if comment}} Comment={{comment}} {{/if}} Exec={{exec}} Icon={{icon}} Name={{name}} Terminal=false Type=Application {{#if mime_type}} MimeType={{mime_type}} {{/if}} ```
*/
desktopTemplate?: string | null;

/**
* Define the section in Debian Control file. It is recommended to add a section in the debian application.
*
* See : https://www.debian.org/doc/debian-policy/ch-archive.html#s-subsections
*/
section?: string | null;

/**
* Change the priority of the Debian Package. By default, it is set to optional.
*
* See : https://www.debian.org/doc/debian-policy/ch-archive.html#priorities
*/
priority?: string | null;

/**
* List of custom files to add to the deb package. Maps a dir/file to a dir/file inside the debian package.
*/
Expand Down
5 changes: 5 additions & 0 deletions crates/packager/src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,11 @@ pub struct DebianConfig {
/// ```
#[serde(alias = "desktop-template", alias = "desktop_template")]
pub desktop_template: Option<PathBuf>,
/// Define the section in Debian Control file. See : https://www.debian.org/doc/debian-policy/ch-archive.html#s-subsections
pub section: Option<String>,
/// Change the priority of the Debian Package. By default, it is set to optional.
/// Recognized Priorities as of now are : required, important, standard, optional, extra
pub priority: Option<String>,
/// List of custom files to add to the deb package.
/// Maps a dir/file to a dir/file inside the debian package.
pub files: Option<HashMap<String, String>>,
Expand Down
12 changes: 11 additions & 1 deletion crates/packager/src/package/deb/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,16 @@ fn generate_control_file(
if let Some(authors) = &config.authors {
writeln!(file, "Maintainer: {}", authors.join(", "))?;
}
if let Some(section) = config.deb().and_then(|d| d.section.as_ref()) {
writeln!(file, "Section: {}", section)?;
}

if let Some(priority) = config.deb().and_then(|d| d.priority.as_ref()) {
writeln!(file, "Priority: {}", priority)?;
}else{
writeln!(file, "Priority: optional")?;
}

if let Some(homepage) = &config.homepage {
writeln!(file, "Homepage: {}", homepage)?;
}
Expand Down Expand Up @@ -282,7 +292,7 @@ fn generate_control_file(
writeln!(file, " {}", line)?;
}
}
writeln!(file, "Priority: optional")?;

file.flush()?;
Ok(())
}
Expand Down
1 change: 1 addition & 0 deletions examples/tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ icons = [

[package.metadata.packager.deb]
depends = ["libgtk-3-0", "libwebkit2gtk-4.1-0", "libayatana-appindicator3-1"]
section = "rust"

[package.metadata.packager.appimage]
bins = ["/usr/bin/xdg-open"]
Expand Down

0 comments on commit 021618c

Please sign in to comment.