From 1ff421365ed3dd65ff64090a5648f43153473809 Mon Sep 17 00:00:00 2001 From: tiann Date: Sat, 4 Feb 2023 13:33:35 +0800 Subject: [PATCH] ksud: pass KSU_VER and KSU_VER_CODE to installer script --- userspace/ksud/src/module.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/userspace/ksud/src/module.rs b/userspace/ksud/src/module.rs index 1efbb16d..7a1523b5 100644 --- a/userspace/ksud/src/module.rs +++ b/userspace/ksud/src/module.rs @@ -25,9 +25,9 @@ use zip_extensions::zip_extract_file_to_memory; #[cfg(unix)] use std::os::unix::{prelude::PermissionsExt, process::CommandExt}; -const UTIL_FUNCTIONS: &str = include_str!("./installer.sh"); +const INSTALLER_CONTENT: &str = include_str!("./installer.sh"); const INSTALL_MODULE_SCRIPT: &str = - concatcp!(UTIL_FUNCTIONS, "\n", "install_module", "\n", "exit 0", "\n"); + concatcp!(INSTALLER_CONTENT, "\n", "install_module", "\n", "exit 0", "\n"); fn exec_install_script(module_file: &str) -> Result<()> { let realpath = std::fs::canonicalize(module_file) @@ -41,6 +41,8 @@ fn exec_install_script(module_file: &str) -> Result<()> { format!("{}:{}", env_var("PATH").unwrap(), defs::BINARY_DIR), ) .env("KSU", "true") + .env("KSU_VER", defs::VERSION_NAME) + .env("KSU_VER_CODE", defs::VERSION_CODE) .env("OUTFD", "1") .env("ZIPFILE", realpath) .stderr(Stdio::null()) @@ -172,7 +174,7 @@ pub fn load_sepolicy_rule() -> Result<()> { let path = entry.path(); let disabled = path.join(defs::DISABLE_FILE_NAME); if disabled.exists() { - println!("{} is disabled, skip", path.display()); + info!("{} is disabled, skip", path.display()); continue; } @@ -180,10 +182,10 @@ pub fn load_sepolicy_rule() -> Result<()> { if !rule_file.exists() { continue; } - println!("load policy: {}", &rule_file.display()); + info!("load policy: {}", &rule_file.display()); if sepolicy::apply_file(&rule_file).is_err() { - println!("Failed to load sepolicy.rule for {}", &rule_file.display()); + warn!("Failed to load sepolicy.rule for {}", &rule_file.display()); } }