ksud: Fix build for win
This commit is contained in:
@@ -34,6 +34,8 @@ rust-embed = { version = "6", features = [
|
|||||||
which = "5"
|
which = "5"
|
||||||
getopts = "0.2"
|
getopts = "0.2"
|
||||||
sha256 = "1"
|
sha256 = "1"
|
||||||
|
tempdir = "0.3"
|
||||||
|
chrono = "0.4"
|
||||||
|
|
||||||
[target.'cfg(any(target_os = "android", target_os = "linux"))'.dependencies]
|
[target.'cfg(any(target_os = "android", target_os = "linux"))'.dependencies]
|
||||||
sys-mount = { git = "https://github.com/tiann/sys-mount", branch = "loopfix" }
|
sys-mount = { git = "https://github.com/tiann/sys-mount", branch = "loopfix" }
|
||||||
@@ -44,8 +46,6 @@ procfs = "0.16"
|
|||||||
[target.'cfg(target_os = "android")'.dependencies]
|
[target.'cfg(target_os = "android")'.dependencies]
|
||||||
android_logger = "0.13"
|
android_logger = "0.13"
|
||||||
|
|
||||||
tempdir = "0.3"
|
|
||||||
chrono = "0.4"
|
|
||||||
[profile.release]
|
[profile.release]
|
||||||
strip = true
|
strip = true
|
||||||
opt-level = "z"
|
opt-level = "z"
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
#[cfg(unix)]
|
||||||
use std::os::unix::fs::PermissionsExt;
|
use std::os::unix::fs::PermissionsExt;
|
||||||
|
|
||||||
use anyhow::bail;
|
use anyhow::bail;
|
||||||
@@ -12,6 +13,7 @@ use std::process::Stdio;
|
|||||||
|
|
||||||
use crate::utils;
|
use crate::utils;
|
||||||
|
|
||||||
|
#[cfg(unix)]
|
||||||
fn ensure_gki_kernel() -> Result<()> {
|
fn ensure_gki_kernel() -> Result<()> {
|
||||||
let version =
|
let version =
|
||||||
procfs::sys::kernel::Version::current().with_context(|| "get kernel version failed")?;
|
procfs::sys::kernel::Version::current().with_context(|| "get kernel version failed")?;
|
||||||
@@ -59,7 +61,10 @@ pub fn patch(
|
|||||||
out: Option<PathBuf>,
|
out: Option<PathBuf>,
|
||||||
magiskboot_path: Option<PathBuf>,
|
magiskboot_path: Option<PathBuf>,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
ensure_gki_kernel()?;
|
if image.is_none() {
|
||||||
|
#[cfg(unix)]
|
||||||
|
ensure_gki_kernel()?;
|
||||||
|
}
|
||||||
|
|
||||||
if kernel.is_some() {
|
if kernel.is_some() {
|
||||||
ensure!(
|
ensure!(
|
||||||
@@ -121,6 +126,7 @@ pub fn patch(
|
|||||||
.unwrap_or_else(|| "magiskboot".into());
|
.unwrap_or_else(|| "magiskboot".into());
|
||||||
|
|
||||||
if !magiskboot.is_executable() {
|
if !magiskboot.is_executable() {
|
||||||
|
#[cfg(unix)]
|
||||||
std::fs::set_permissions(&magiskboot, std::fs::Permissions::from_mode(0o755))
|
std::fs::set_permissions(&magiskboot, std::fs::Permissions::from_mode(0o755))
|
||||||
.with_context(|| "set magiskboot executable failed".to_string())?;
|
.with_context(|| "set magiskboot executable failed".to_string())?;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user