diff --git a/bindings/packager/nodejs/src-ts/config.d.ts b/bindings/packager/nodejs/src-ts/config.d.ts index caa7588f..6295cb51 100644 --- a/bindings/packager/nodejs/src-ts/config.d.ts +++ b/bindings/packager/nodejs/src-ts/config.d.ts @@ -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. */ diff --git a/crates/packager/src/config/mod.rs b/crates/packager/src/config/mod.rs index de20c543..6ae915c9 100644 --- a/crates/packager/src/config/mod.rs +++ b/crates/packager/src/config/mod.rs @@ -311,6 +311,11 @@ pub struct DebianConfig { /// ``` #[serde(alias = "desktop-template", alias = "desktop_template")] pub desktop_template: Option, + /// Define the section in Debian Control file. See : https://www.debian.org/doc/debian-policy/ch-archive.html#s-subsections + pub section: Option, + /// 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, /// 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>, diff --git a/crates/packager/src/package/deb/mod.rs b/crates/packager/src/package/deb/mod.rs index 42876aed..9bac7e2f 100644 --- a/crates/packager/src/package/deb/mod.rs +++ b/crates/packager/src/package/deb/mod.rs @@ -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)?; } @@ -282,7 +292,7 @@ fn generate_control_file( writeln!(file, " {}", line)?; } } - writeln!(file, "Priority: optional")?; + file.flush()?; Ok(()) } diff --git a/examples/tauri/Cargo.toml b/examples/tauri/Cargo.toml index 39fedc57..c4149ceb 100644 --- a/examples/tauri/Cargo.toml +++ b/examples/tauri/Cargo.toml @@ -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"]