Skip to content

Commit

Permalink
fix: fix deb permissions (#120)
Browse files Browse the repository at this point in the history
* Fix Debian package launching issue

* Update .changes/fix-deb-launching.md

---------

Co-authored-by: Amr Bashir <[email protected]>
  • Loading branch information
naman-crabnebula and amr-crabnebula authored Jan 8, 2024
1 parent c18bf3e commit bfaefc4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changes/fix-deb-launching.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"cargo-packager": patch
---

Fix Debian packages launching issues due to incorrect permissions
4 changes: 2 additions & 2 deletions crates/packager/src/package/deb/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -419,19 +419,19 @@ fn create_tar_from_dir<P: AsRef<Path>, W: Write>(src_dir: P, dest_file: W) -> cr
if entry.file_type().is_dir() {
let stat = std::fs::metadata(src_path)?;
let mut header = tar::Header::new_gnu();
header.set_mode(0o755);
header.set_metadata(&stat);
header.set_uid(0);
header.set_gid(0);
header.set_mode(0o755);
tar_builder.append_data(&mut header, dest_path, &mut std::io::empty())?;
} else {
let mut src_file = std::fs::File::open(src_path)?;
let stat = src_file.metadata()?;
let mut header = tar::Header::new_gnu();
header.set_mode(0o644);
header.set_metadata(&stat);
header.set_uid(0);
header.set_gid(0);
header.set_mode(0o644);
tar_builder.append_data(&mut header, dest_path, &mut src_file)?;
}
}
Expand Down

0 comments on commit bfaefc4

Please sign in to comment.