Skip to content

Commit

Permalink
moss: Adapt boot.rs to the new fnmatch API
Browse files Browse the repository at this point in the history
  • Loading branch information
livingsilver94 committed Jul 26, 2024
1 parent bf125af commit 03d9ce9
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions moss/src/client/boot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@ pub enum Error {
#[error("os_release: {0}")]
OsRelease(#[from] os_release::Error),

/// fnmatch pattern compilation for boot, etc.
#[error("fnmatch pattern: {0}")]
Pattern(#[from] fnmatch::Error),

#[error("incomplete kernel tree: {0}")]
IncompleteKernel(String),
}
Expand Down Expand Up @@ -62,15 +58,15 @@ fn kernel_files_from_state<'a>(
for (_, path) in layouts.iter() {
match &path.entry {
layout::Entry::Regular(_, target) => {
if pattern.match_path(target).is_some() {
if pattern.matches(target).is_some() {
kernel_entries.push(KernelCandidate {
path: install.root.join("usr").join(target),
_layout: path,
});
}
}
layout::Entry::Symlink(_, target) => {
if pattern.match_path(target).is_some() {
if pattern.matches(target).is_some() {
kernel_entries.push(KernelCandidate {
path: install.root.join("usr").join(target),
_layout: path,
Expand All @@ -94,7 +90,7 @@ fn boot_files_from_state<'a>(

for (_, path) in layouts.iter() {
if let layout::Entry::Regular(_, target) = &path.entry {
if pattern.match_path(target).is_some() {
if pattern.matches(target).is_some() {
rets.push(install.root.join("usr").join(target));
}
}
Expand All @@ -116,8 +112,8 @@ pub fn synchronize(install: &Installation, layouts: &[(Id, Layout)]) -> Result<(
vfs: "/".into(),
};

let pattern = fnmatch::Pattern::from_str("lib/kernel/(version:*)/*")?;
let systemd = fnmatch::Pattern::from_str("lib*/systemd/boot/efi/*.efi")?;
let pattern = fnmatch::Pattern::from_str("lib/kernel/(version:*)/*").unwrap(); // TODO: Do not return Infallible?
let systemd = fnmatch::Pattern::from_str("lib*/systemd/boot/efi/*.efi").unwrap(); // TODO: Do not return Infallible?
let booty_bits = boot_files_from_state(install, layouts, &systemd);

// No kernels? No bother.
Expand Down

0 comments on commit 03d9ce9

Please sign in to comment.