ci: add CI for clippy, rustfmt and shell scripts (#193)
This commit is contained in:
@@ -20,6 +20,5 @@ pub const DISABLE_FILE_NAME: &str = "disable";
|
||||
pub const UPDATE_FILE_NAME: &str = "update";
|
||||
pub const REMOVE_FILE_NAME: &str = "remove";
|
||||
|
||||
|
||||
pub const VERSION_CODE: &str = include_str!(concat!(env!("OUT_DIR"), "/VERSION_CODE"));
|
||||
pub const VERSION_NAME: &str = include_str!(concat!(env!("OUT_DIR"), "/VERSION_NAME"));
|
||||
pub const VERSION_NAME: &str = include_str!(concat!(env!("OUT_DIR"), "/VERSION_NAME"));
|
||||
|
||||
@@ -9,12 +9,16 @@ 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";
|
||||
const SELINUX_XATTR : &str = "security.selinux";
|
||||
const SELINUX_XATTR: &str = "security.selinux";
|
||||
|
||||
pub fn setcon<P: AsRef<Path>>(path: P, con: &str) -> Result<()> {
|
||||
#[cfg(any(target_os = "linux", target_os = "android"))]
|
||||
setxattr(&path, SELINUX_XATTR, con, XattrFlags::empty())
|
||||
.with_context(|| format!("Failed to change SELinux context for {}", path.as_ref().display()))?;
|
||||
setxattr(&path, SELINUX_XATTR, con, XattrFlags::empty()).with_context(|| {
|
||||
format!(
|
||||
"Failed to change SELinux context for {}",
|
||||
path.as_ref().display()
|
||||
)
|
||||
})?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -32,9 +36,9 @@ pub fn restore_syscon<P: AsRef<Path>>(dir: P) -> Result<()> {
|
||||
for dir_entry in WalkDir::new(dir).parallelism(Serial) {
|
||||
if let Some(path) = dir_entry.ok().map(|dir_entry| dir_entry.path()) {
|
||||
#[cfg(any(target_os = "linux", target_os = "android"))]
|
||||
setxattr(&path, SELINUX_XATTR, SYSTEM_CON, XattrFlags::empty()).with_context(
|
||||
|| format!("Failed to change SELinux context for {}", path.display()),
|
||||
)?;
|
||||
setxattr(&path, SELINUX_XATTR, SYSTEM_CON, XattrFlags::empty()).with_context(|| {
|
||||
format!("Failed to change SELinux context for {}", path.display())
|
||||
})?;
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
|
||||
@@ -745,4 +745,4 @@ pub fn check_rule(policy: &str) -> Result<()> {
|
||||
apply_one_rule(&statement, true)?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user