diff --git a/.changes/bundler-deb-fix-owner.md b/.changes/bundler-deb-fix-owner.md new file mode 100644 index 000000000000..67174a888217 --- /dev/null +++ b/.changes/bundler-deb-fix-owner.md @@ -0,0 +1,5 @@ +--- +'tauri-bundler': 'patch:bug' +--- + +In Debian packages, set `root` the owner of control files and package files. diff --git a/tooling/bundler/src/bundle/linux/debian.rs b/tooling/bundler/src/bundle/linux/debian.rs index 6e54325babb7..cd6cce8e2195 100644 --- a/tooling/bundler/src/bundle/linux/debian.rs +++ b/tooling/bundler/src/bundle/linux/debian.rs @@ -367,10 +367,20 @@ fn create_tar_from_dir, W: Write>(src_dir: P, dest_file: W) -> cr } let dest_path = src_path.strip_prefix(src_dir)?; if entry.file_type().is_dir() { - tar_builder.append_dir(dest_path, src_path)?; + let stat = fs::metadata(src_path)?; + let mut header = tar::Header::new_gnu(); + header.set_metadata(&stat); + header.set_uid(0); + header.set_gid(0); + tar_builder.append_data(&mut header, dest_path, &mut io::empty())?; } else { let mut src_file = fs::File::open(src_path)?; - tar_builder.append_file(dest_path, &mut src_file)?; + let stat = src_file.metadata()?; + let mut header = tar::Header::new_gnu(); + header.set_metadata(&stat); + header.set_uid(0); + header.set_gid(0); + tar_builder.append_data(&mut header, dest_path, &mut src_file)?; } } let dest_file = tar_builder.into_inner()?;