Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[rust] Fix Edge management in RPM-based Linux #13705

Merged
merged 5 commits into from Mar 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 8 additions & 2 deletions rust/src/files.rs
Expand Up @@ -131,7 +131,7 @@ pub fn uncompress(
} else if extension.eq_ignore_ascii_case(EXE) {
uncompress_sfx(compressed_file, target, log)?
} else if extension.eq_ignore_ascii_case(DEB) {
uncompress_deb(compressed_file, target, log, volume.unwrap_or_default())?
uncompress_deb(compressed_file, target, log, os, volume.unwrap_or_default())?
} else if extension.eq_ignore_ascii_case(MSI) {
install_msi(compressed_file, log, os)?
} else if extension.eq_ignore_ascii_case(XML) || extension.eq_ignore_ascii_case(HTML) {
Expand Down Expand Up @@ -249,6 +249,7 @@ pub fn uncompress_deb(
compressed_file: &str,
target: &Path,
log: &Logger,
os: &str,
label: &str,
) -> Result<(), Error> {
let zip_parent = Path::new(compressed_file).parent().unwrap();
Expand All @@ -265,12 +266,17 @@ pub fn uncompress_deb(
let zip_parent_str = path_to_string(zip_parent);
let target_str = path_to_string(target);
let opt_edge_str = format!("{}/opt/microsoft/{}", zip_parent_str, label);
let opt_edge_mv = format!("mv {} {}", opt_edge_str, target_str);
let command = Command::new_single(opt_edge_mv.clone());
log.trace(format!(
"Moving extracted files and folders from {} to {}",
opt_edge_str, target_str
));
create_parent_path_if_not_exists(target)?;
fs::rename(&opt_edge_str, &target_str)?;
let output = run_shell_command_by_os(os, command)?;
if output.is_empty() {
fs::rename(&opt_edge_str, &target_str)?;
}

Ok(())
}
Expand Down