ksud: fix post-fs-data.sh and service.sh may be not executed
This commit is contained in:
@@ -155,7 +155,9 @@ pub fn on_post_data_fs() -> Result<()> {
|
|||||||
pub fn on_services() -> Result<()> {
|
pub fn on_services() -> Result<()> {
|
||||||
// exec modules service.sh scripts
|
// exec modules service.sh scripts
|
||||||
if !crate::utils::is_safe_mode() {
|
if !crate::utils::is_safe_mode() {
|
||||||
let _ = crate::module::exec_services();
|
if let Err(e) = crate::module::exec_services() {
|
||||||
|
warn!("exec service scripts failed: {}", e);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
warn!("safe mode, skip module service scripts");
|
warn!("safe mode, skip module service scripts");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ use crate::{
|
|||||||
|
|
||||||
use const_format::concatcp;
|
use const_format::concatcp;
|
||||||
use java_properties::PropertiesIter;
|
use java_properties::PropertiesIter;
|
||||||
use log::{info, warn};
|
use log::{info, warn, debug};
|
||||||
use std::{
|
use std::{
|
||||||
collections::HashMap,
|
collections::HashMap,
|
||||||
env::var as env_var,
|
env::var as env_var,
|
||||||
@@ -216,10 +216,12 @@ pub fn exec_post_fs_data() -> Result<()> {
|
|||||||
|
|
||||||
let mut command_new;
|
let mut command_new;
|
||||||
let mut command;
|
let mut command;
|
||||||
if is_executable(&post_fs_data) {
|
if !is_executable(&post_fs_data) {
|
||||||
|
debug!("{} is not executable, use /system/bin/sh!", post_fs_data.display());
|
||||||
command_new = Command::new("sh");
|
command_new = Command::new("sh");
|
||||||
command = command_new.arg(&post_fs_data);
|
command = command_new.arg(&post_fs_data);
|
||||||
} else {
|
} else {
|
||||||
|
debug!("{} is executable, exec directly!", post_fs_data.display());
|
||||||
command_new = Command::new(&post_fs_data);
|
command_new = Command::new(&post_fs_data);
|
||||||
command = &mut command_new;
|
command = &mut command_new;
|
||||||
};
|
};
|
||||||
@@ -267,10 +269,12 @@ pub fn exec_services() -> Result<()> {
|
|||||||
|
|
||||||
let mut command_new;
|
let mut command_new;
|
||||||
let mut command;
|
let mut command;
|
||||||
if is_executable(&service) {
|
if !is_executable(&service) {
|
||||||
|
debug!("{} is not executable, use /system/bin/sh!", service.display());
|
||||||
command_new = Command::new("sh");
|
command_new = Command::new("sh");
|
||||||
command = command_new.arg(&service);
|
command = command_new.arg(&service);
|
||||||
} else {
|
} else {
|
||||||
|
debug!("{} is executable, exec directly!", service.display());
|
||||||
command_new = Command::new(&service);
|
command_new = Command::new(&service);
|
||||||
command = &mut command_new;
|
command = &mut command_new;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user