Skip to content
This repository has been archived by the owner on Jul 27, 2024. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Admirepowered committed May 7, 2024
2 parents da06459 + 32e80c7 commit e27de74
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 14 deletions.
5 changes: 4 additions & 1 deletion loader/src/ptracer/monitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,10 @@ static void updateStatus() {
} else { \
state##suffix=1; \
if (!status##suffix.daemon_error_info.empty()) { \
status_text += "("; \
status_text += status##suffix.daemon_error_info; \
in##suffix += status##suffix.daemon_info; \
status_text += ")"; \
} \
} \
}
Expand Down Expand Up @@ -616,4 +619,4 @@ void send_control_command(Command cmd) {
exit(1);
}
printf("command sent\n");
}
}
12 changes: 6 additions & 6 deletions module/src/customize.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,6 @@ if [ "$BOOTMODE" ] && [ "$KSU" ]; then
ui_print "! Please update KernelSU Manager to latest version"
abort "*********************************************************"
fi
if ! [ "$APATCH_VER_CODE" ] || [ "$APATCH_VER_CODE" -lt "$MIN_APATCH_VERSION" ]; then
ui_print "*********************************************************"
ui_print "! Apatch version is too old!"
ui_print "! Please update Apatch to latest version"
abort "*********************************************************"
fi
if [ "$(which magisk)" ]; then
ui_print "*********************************************************"
ui_print "! Multiple root implementation is NOT supported!"
Expand All @@ -43,6 +37,12 @@ if [ "$BOOTMODE" ] && [ "$KSU" ]; then
fi
elif [ "$BOOTMODE" ] && [ "$APATCH" ]; then
ui_print "- Installing from Apatch app"
if ! [ "$APATCH_VER_CODE" ] || [ "$APATCH_VER_CODE" -lt "$MIN_APATCH_VERSION" ]; then
ui_print "*********************************************************"
ui_print "! Apatch version is too old!"
ui_print "! Please update Apatch to latest version"
abort "*********************************************************"
fi
elif [ "$BOOTMODE" ] && [ "$MAGISK_VER_CODE" ]; then
ui_print "- Installing from Magisk app"
if [ "$MAGISK_VER_CODE" -lt "$MIN_MAGISK_VERSION" ]; then
Expand Down
23 changes: 16 additions & 7 deletions zygiskd/src/root_impl/apatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,24 @@ fn parse_version(output: &str) -> i32 {
}

pub fn get_apatch() -> Option<Version> {
let output = Command::new("/data/adb/apd")
.arg("-V")
let output = Command::new("su")
.arg("-v")
.stdout(Stdio::piped())
.stderr(Stdio::null())
.output()
.ok()?;
let stdout = String::from_utf8(output.stdout).ok()?;
let version = parse_version(&stdout); // 返回 i32 类型的值
if !stdout.contains("APatch") {
return None;
}
let output1 = Command::new("/data/adb/apd")
.arg("-V")
.stdout(Stdio::piped())
.stderr(Stdio::null())
.output()
.ok()?;
let stdout1 = String::from_utf8(output1.stdout).ok()?;
let version = parse_version(&stdout1); // 返回 i32 类型的值
const MAX_OLD_VERSION: i32 = MIN_APATCH_VERSION - 1;
match version {
0 => Some(Version::Abnormal),
Expand Down Expand Up @@ -93,12 +103,11 @@ pub fn uid_should_umount(uid: i32) -> bool {
.find(|config| config.uid == uid)
.map(|config| {
match config.exclude {
0 => false,
1 => true,
_ => true,
_ => false,
}
})
.unwrap_or(true)
.unwrap_or(false)
}
Err(err) => {
log::warn!("Error reading package configs");
Expand All @@ -113,4 +122,4 @@ pub fn uid_is_manager(uid: i32) -> bool {
return s.st_uid == uid as u32;
}
false
}
}

0 comments on commit e27de74

Please sign in to comment.