ksud: add /data/adb/ksu/bin to PATH (#343)

This commit is contained in:
Ylarod
2023-04-05 11:47:35 +08:00
committed by GitHub
parent ddbc71b273
commit 862d12a904
3 changed files with 38 additions and 4 deletions

View File

@@ -248,5 +248,21 @@ pub fn install() -> Result<()> {
std::fs::copy("/proc/self/exe", defs::DAEMON_PATH)?;
// install binary assets
assets::ensure_binaries().with_context(|| "Failed to extract assets")
assets::ensure_binaries().with_context(|| "Failed to extract assets")?;
#[cfg(target_os = "android")]
link_ksud_to_bin()?;
Ok(())
}
#[cfg(target_os = "android")]
fn link_ksud_to_bin() -> Result<()> {
use std::path::PathBuf;
let ksu_bin = PathBuf::from(defs::DAEMON_PATH);
let ksu_bin_link = PathBuf::from(defs::DAEMON_LINK_PATH);
if ksu_bin.exists() && !ksu_bin_link.exists() {
std::os::unix::fs::symlink(&ksu_bin, &ksu_bin_link)?;
}
Ok(())
}