mirror of
https://gitee.com/openharmony/startup_init
synced 2024-11-23 16:20:00 +00:00
commit
1ad2131c68
@ -83,6 +83,7 @@ int ReadFileInDir(const char *dirPath, const char *includeExt,
|
||||
char **SplitStringExt(char *buffer, const char *del, int *returnCount, int maxItemCount);
|
||||
void FreeStringVector(char **vector, int count);
|
||||
int InUpdaterMode(void);
|
||||
int InRescueMode(void);
|
||||
int StringReplaceChr(char *strl, char oldChr, char newChr);
|
||||
|
||||
int OpenConsole(void);
|
||||
|
@ -41,6 +41,7 @@ int DoJobNow(const char *jobName);
|
||||
#define INIT_CONFIGURATION_FILE "/etc/init.cfg"
|
||||
#define OTHER_CFG_PATH "/system/etc/init"
|
||||
#define OTHER_CHARGE_PATH "/system/etc/charger"
|
||||
#define INIT_RESCUE_MODE_PATH "/system/etc/rescue"
|
||||
#define MAX_PATH_ARGS_CNT 20
|
||||
|
||||
void ReadConfig(void);
|
||||
|
@ -113,6 +113,9 @@ void ReadConfig(void)
|
||||
} else if (strcmp(buffer, "charger") == 0) {
|
||||
ParseInitCfg(INIT_CONFIGURATION_FILE, NULL);
|
||||
ReadFileInDir(OTHER_CHARGE_PATH, ".cfg", ParseInitCfg, NULL);
|
||||
} else if (InRescueMode() == 0) {
|
||||
ParseInitCfg(INIT_CONFIGURATION_FILE, NULL);
|
||||
ReadFileInDir(INIT_RESCUE_MODE_PATH, ".cfg", ParseInitCfg, NULL);
|
||||
} else if (InUpdaterMode() == 0) {
|
||||
ParseInitCfg(INIT_CONFIGURATION_FILE, NULL);
|
||||
ParseInitCfgByPriority();
|
||||
|
@ -583,6 +583,21 @@ int InUpdaterMode(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
// Check if in rescue mode.
|
||||
int InRescueMode(void)
|
||||
{
|
||||
#ifdef OHOS_LITE
|
||||
return 1;
|
||||
#else
|
||||
char value[MAX_BUFFER_LEN] = {0};
|
||||
int ret = GetParameterFromCmdLine("rescue_mode", value, MAX_BUFFER_LEN);
|
||||
if (ret == 0 && strcmp(value, "true") == 0) {
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
#endif
|
||||
}
|
||||
|
||||
int StringReplaceChr(char *strl, char oldChr, char newChr)
|
||||
{
|
||||
INIT_ERROR_CHECK(strl != NULL, return -1, "Invalid parament");
|
||||
|
Loading…
Reference in New Issue
Block a user