Skip to content

Commit

Permalink
fix(health): check fusermount3 and use fusermount as fallback
Browse files Browse the repository at this point in the history
  • Loading branch information
QaidVoid committed Nov 3, 2024
1 parent bcef36c commit 3cef007
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 14 deletions.
35 changes: 22 additions & 13 deletions src/core/health.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,26 +135,35 @@ async fn check_capabilities() -> Option<&'static str> {
async fn check_fusermount() {
let mut error = String::new();

match which::which("fusermount") {
Ok(path) => match path.metadata() {
let fusermount_path = match which::which("fusermount3") {
Ok(path) => Some(path),
Err(_) => match which::which("fusermount") {
Ok(path) => Some(path),
Err(_) => {
error = format!(
"{} not found. Please install {}.\n",
"fusermount".color(Color::Blue),
"fuse".color(Color::Blue)
);
None
}
},
};

if let Some(fusermount_path) = fusermount_path {
match fusermount_path.metadata() {
Ok(meta) => {
let permissions = meta.permissions().mode();
if permissions != 0o104755 {
error = format!(
"Invalid {} file mode bits. Set 4755 for {}",
"fusermount".color(Color::Blue),
path.to_string_lossy().color(Color::Green)
"Invalid file mode bits. Set 4755 for {}.",
fusermount_path.to_string_lossy().color(Color::Green)
);
}
}
Err(_) => error = "Unable to read fusermount".to_string(),
},
Err(_) => {
error = format!(
"{} not found. Please install {}",
"fusermount".color(Color::Blue),
"fuse".color(Color::Blue)
);
Err(_) => {
error = "Unable to read fusermount metadata.".to_owned();
}
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/registry/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,8 @@ impl PackageStorage {
resolved_pkg
.package
.build_script
.replace("tree", "raw/refs/heads")
.replacen("/tree/", "/raw/refs/heads/", 1)
.replacen("/blob/", "/raw/refs/heads/", 1)
} else {
resolved_pkg.package.build_script
};
Expand Down

0 comments on commit 3cef007

Please sign in to comment.