summaryrefslogtreecommitdiff
path: root/src/manifest.rs
diff options
context:
space:
mode:
authorHermes Agent <hermes@localhost>2026-08-12 03:08:50 +0000
committerHermes Agent <hermes@localhost>2026-08-12 03:08:50 +0000
commitca6572f7c96fd14733b42ad6dcd361bc136093ed (patch)
tree85a4f091cc32ed52e6de01a111817f61664559b9 /src/manifest.rs
parenta60cf70253fb1e22dfcc480385c0499272b75477 (diff)
Validate direct systemd wants service facts
Diffstat (limited to 'src/manifest.rs')
-rw-r--r--src/manifest.rs22
1 files changed, 19 insertions, 3 deletions
diff --git a/src/manifest.rs b/src/manifest.rs
index 5b7ae77..ed326e1 100644
--- a/src/manifest.rs
+++ b/src/manifest.rs
@@ -279,9 +279,25 @@ fn portable_path(path: &Path) -> Result<String> {
}
fn is_enabled_service(path: &str) -> bool {
- path.starts_with("etc/systemd/system/")
- && path.contains(".target.wants/")
- && path.ends_with(".service")
+ let mut components = path.split('/');
+ matches!(
+ (
+ components.next(),
+ components.next(),
+ components.next(),
+ components.next(),
+ components.next(),
+ components.next(),
+ ),
+ (
+ Some("etc"),
+ Some("systemd"),
+ Some("system"),
+ Some(wants),
+ Some(service),
+ None,
+ ) if wants.ends_with(".target.wants") && service.ends_with(".service")
+ )
}
fn is_internal_metadata_path(path: &str) -> bool {