mirror of
https://github.com/openharmony/startup_init_lite.git
synced 2026-07-01 03:23:16 -04:00
!227 add selinux adaption for rk3568
Merge pull request !227 from dapaodexiaoyu2/master
This commit is contained in:
@@ -35,6 +35,7 @@
|
||||
#include "ueventd_socket.h"
|
||||
#ifdef WITH_SELINUX
|
||||
#include <policycoreutils.h>
|
||||
#include <selinux/selinux.h>
|
||||
#endif // WITH_SELINUX
|
||||
|
||||
void SystemInit(void)
|
||||
@@ -164,16 +165,16 @@ void SystemLoadSelinux(void)
|
||||
} else {
|
||||
INIT_LOGI("main, load_policy success.");
|
||||
}
|
||||
if (restorecon() < 0) {
|
||||
INIT_LOGE("main, restorecon failed.");
|
||||
} else {
|
||||
INIT_LOGI("main, restorecon success.");
|
||||
}
|
||||
|
||||
setcon("u:r:init:s0");
|
||||
#endif // WITH_SELINUX
|
||||
}
|
||||
|
||||
void SystemConfig(void)
|
||||
{
|
||||
// load SELinux context and policy
|
||||
SystemLoadSelinux();
|
||||
|
||||
InitParamService();
|
||||
// parse parameters
|
||||
LoadDefaultParams("/system/etc/param/ohos_const", LOAD_PARAM_NORMAL);
|
||||
@@ -193,9 +194,6 @@ void SystemConfig(void)
|
||||
PostTrigger(EVENT_TRIGGER_BOOT, "pre-init", strlen("pre-init"));
|
||||
PostTrigger(EVENT_TRIGGER_BOOT, "init", strlen("init"));
|
||||
PostTrigger(EVENT_TRIGGER_BOOT, "post-init", strlen("post-init"));
|
||||
|
||||
// load SELinux context and policy
|
||||
SystemLoadSelinux();
|
||||
}
|
||||
|
||||
void SystemRun(void)
|
||||
|
||||
@@ -38,6 +38,9 @@
|
||||
#include "init_service_manager.h"
|
||||
#include "init_utils.h"
|
||||
#include "securec.h"
|
||||
#ifdef WITH_SELINUX
|
||||
#include <policycoreutils.h>
|
||||
#endif
|
||||
|
||||
int GetParamValue(const char *symValue, unsigned int symLen, char *paramValue, unsigned int paramLen)
|
||||
{
|
||||
@@ -266,6 +269,16 @@ static void DoUmountFstabFile(const struct CmdArgs *ctx)
|
||||
}
|
||||
}
|
||||
|
||||
static void DoRestorecon(const struct CmdArgs *ctx)
|
||||
{
|
||||
#ifdef WITH_SELINUX
|
||||
INIT_LOGI("start restorecon ......\n");
|
||||
restorecon();
|
||||
INIT_LOGI("finish restorecon ......\n");
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
static const struct CmdTable g_cmdTable[] = {
|
||||
{ "exec ", 1, 10, DoExec },
|
||||
{ "mknode ", 1, 5, DoMakeNode },
|
||||
@@ -279,6 +292,7 @@ static const struct CmdTable g_cmdTable[] = {
|
||||
{ "ifup ", 1, 1, DoIfup },
|
||||
{ "mount_fstab ", 1, 1, DoMountFstabFile },
|
||||
{ "umount_fstab ", 1, 1, DoUmountFstabFile },
|
||||
{ "restorecon ", 0, 0, DoRestorecon },
|
||||
};
|
||||
|
||||
const struct CmdTable *GetCmdTable(int *number)
|
||||
|
||||
Reference in New Issue
Block a user