ksud: ensure ksud context when install (#356)
Incorrect se context will make module system broken
This commit is contained in:
@@ -3,7 +3,7 @@ use log::{info, warn};
|
||||
use std::{collections::HashMap, path::Path};
|
||||
|
||||
use crate::{
|
||||
assets, defs, mount,
|
||||
assets, defs, mount, restorecon,
|
||||
utils::{self, ensure_clean_dir, ensure_dir_exists},
|
||||
};
|
||||
|
||||
@@ -246,7 +246,7 @@ pub fn daemon() -> Result<()> {
|
||||
pub fn install() -> Result<()> {
|
||||
ensure_dir_exists(defs::ADB_DIR)?;
|
||||
std::fs::copy("/proc/self/exe", defs::DAEMON_PATH)?;
|
||||
|
||||
restorecon::setcon(defs::DAEMON_PATH, restorecon::ADB_CON)?;
|
||||
// install binary assets
|
||||
assets::ensure_binaries().with_context(|| "Failed to extract assets")?;
|
||||
|
||||
|
||||
@@ -7,8 +7,8 @@ use anyhow::{Context, Ok};
|
||||
#[cfg(any(target_os = "linux", target_os = "android"))]
|
||||
use extattr::{setxattr, Flags as XattrFlags};
|
||||
|
||||
const SYSTEM_CON: &str = "u:object_r:system_file:s0";
|
||||
const _ADB_CON: &str = "u:object_r:adb_data_file:s0";
|
||||
pub const SYSTEM_CON: &str = "u:object_r:system_file:s0";
|
||||
pub const ADB_CON: &str = "u:object_r:adb_data_file:s0";
|
||||
const SELINUX_XATTR: &str = "security.selinux";
|
||||
|
||||
pub fn setcon<P: AsRef<Path>>(path: P, con: &str) -> Result<()> {
|
||||
|
||||
Reference in New Issue
Block a user