diff --git a/exts/devmaster/src/lib/config/netif_conf.rs b/exts/devmaster/src/lib/config/netif_conf.rs index 9c593902c51ec5328b69d82b523c837f316dafdd..44ae7f7227c5434f8b28a8145ceae180e43f3980 100644 --- a/exts/devmaster/src/lib/config/netif_conf.rs +++ b/exts/devmaster/src/lib/config/netif_conf.rs @@ -132,6 +132,8 @@ impl NetifConfigCtx { if name.ends_with(".link") { let conf_path = dir_path.join(&name); + log::debug!("loading .link config: {:?}", conf_path); + let s = match std::fs::read_to_string(&conf_path) { Ok(content) => content, Err(e) => { diff --git a/exts/devmaster/src/lib/rules/exec_mgr.rs b/exts/devmaster/src/lib/rules/exec_mgr.rs index 22b9a2ad64b132d4f30fac9da4b8ef3336309aeb..54e0093e7162fa82a59943bc27c154a550967d92 100644 --- a/exts/devmaster/src/lib/rules/exec_mgr.rs +++ b/exts/devmaster/src/lib/rules/exec_mgr.rs @@ -903,20 +903,16 @@ impl ExecuteManager { } MatchImportCmdline => { let cmdline = basic::cmdline::Cmdline::default(); - let s = cmdline.get_param(&token_value); - if s.is_none() { + if !cmdline.has_param(&token_value) { return Ok(token.read().unwrap().as_ref().unwrap().op == OperatorType::Nomatch); } - let value = match s.as_ref().unwrap().split_once('=') { - Some(ret) => ret.1, - None => "", - }; + let value = cmdline.get_param(&token_value); execute_err!( token.read().unwrap().as_ref().unwrap(), - device.add_property(&token_value, if value.is_empty() { "1" } else { value }) + device.add_property(&token_value, &value.unwrap_or_default()) )?; Ok(token.read().unwrap().as_ref().unwrap().op == OperatorType::Match) diff --git a/exts/devmaster/src/lib/utils/commons.rs b/exts/devmaster/src/lib/utils/commons.rs index 700caf2d2127f45bb55f6fb1f38aa87dcb92de0a..80e37b3acbd1d77c149bc0ab37599c7891d11827 100644 --- a/exts/devmaster/src/lib/utils/commons.rs +++ b/exts/devmaster/src/lib/utils/commons.rs @@ -19,7 +19,7 @@ use std::{ use crate::{error::*, log_dev, rules::FormatSubstitutionType, utils::trie::*}; use basic::{error::errno_is_privilege, IN_SET}; -use device::{Device, DB_BASE_DIR}; +use device::{Device, DB_BASE_DIR, DEFAULT_BASE_DIR}; use lazy_static::lazy_static; use nix::{errno::Errno, unistd::unlink}; use snafu::ResultExt; @@ -575,7 +575,7 @@ pub(crate) fn device_update_tag( pub(crate) fn cleanup_db(dev: Rc) -> Result<()> { let id = dev.get_device_id().context(DeviceSnafu)?; - let db_path = format!("{}{}", DB_BASE_DIR, id); + let db_path = format!("{}/{}/{}", DEFAULT_BASE_DIR, DB_BASE_DIR, id); match unlink(db_path.as_str()) { Ok(_) => log_dev!(debug, dev, format!("unlinked '{}'", db_path)),