Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion apps/bootstrap-installer/src-tauri/src/paths.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,16 @@ pub fn copy_self_to_hermes_home() -> std::io::Result<()> {
}
std::fs::copy(&src, &dest)?;
repair_macos_installer_helper(&dest);
// The copy inherits the source binary's mode, which may be tighter than
// expected (e.g. translocated/staged origins). Normalize to 0755 so the
// desktop's later `--update` handoff can always execute the staged
// installer. Mode bits are not part of the code signature, so this does
// not undo the repair above.
#[cfg(unix)]
{
use std::os::unix::fs::PermissionsExt;
let _ = std::fs::set_permissions(&dest, std::fs::Permissions::from_mode(0o755));
}
tracing::info!(?src, ?dest, "copied installer to HERMES_HOME");
Ok(())
}
Expand All @@ -126,8 +136,16 @@ fn repair_macos_installer_helper(path: &Path) {
.status();

if !matches!(verify, Ok(status) if status.success()) {
// Re-seal with an ad-hoc signature, preserving the original
// identifier/entitlements/flags so Gatekeeper and TCC still see the
// same identity instead of a filename-derived ad-hoc one.
let _ = Command::new("/usr/bin/codesign")
.args(["--force", "--sign", "-"])
.args([
"--force",
"--sign",
"-",
"--preserve-metadata=identifier,entitlements,flags",
])
.arg(path)
.status();
}
Expand Down