|
|
@@ -354,7 +354,7 @@ void ResourceWatcherEntity::InstallThirdPartyProgram(SpReqAnsContext<ResourceWat
|
|
|
char* p = inifile_read_str(strRunIniFilePath, "Action", "ToRun", "");
|
|
|
CSimpleStringA strInstallScriptFile(strInstallPkgPath + SPLIT_SLASH_STR + p);
|
|
|
toolkit_free(p);
|
|
|
- Dbg("RunScript file: %s", strInstallScriptFile.GetData());
|
|
|
+ Dbg("install script file: %s", strInstallScriptFile.GetData());
|
|
|
if (ExistsFileA(strInstallScriptFile)) {
|
|
|
do {
|
|
|
char app[MAX_PATH] = { '\0' };
|
|
|
@@ -377,6 +377,34 @@ void ResourceWatcherEntity::InstallThirdPartyProgram(SpReqAnsContext<ResourceWat
|
|
|
|
|
|
} while (false);
|
|
|
|
|
|
+ CSimpleStringA strStartupScriptFile(strInstallPkgPath + SPLIT_SLASH_STR + "startup_service.sh");
|
|
|
+ Dbg("startup script file: %s", strStartupScriptFile.GetData());
|
|
|
+ if (!ExistsFileA(strStartupScriptFile)) {
|
|
|
+ tmpMsg = CSimpleStringA::Format("%s 启动脚本文件不存在,需重启设备后触发", strStartupScriptFile.GetData());
|
|
|
+ tmpResult = Error_NotExist;
|
|
|
+ } else {
|
|
|
+ Sleep(1000);
|
|
|
+ do {
|
|
|
+ char app[MAX_PATH] = { '\0' };
|
|
|
+ tk_process_t* process = NULL;
|
|
|
+ tk_process_option_t option;
|
|
|
+ option.exit_cb = NULL;
|
|
|
+ option.file = NULL;
|
|
|
+ option.flags = 0;
|
|
|
+
|
|
|
+ sprintf(app, "bash %s", strStartupScriptFile.GetData());
|
|
|
+ option.params = app;
|
|
|
+ const int res = process_spawn(&option, &process);
|
|
|
+ if (0 == res) {
|
|
|
+ FREE(process);
|
|
|
+ Dbg("execute {%s} suc", strStartupScriptFile.GetData());
|
|
|
+ } else {
|
|
|
+ tmpMsg = CSimpleStringA::Format("执行 %s 失败:%s", strStartupScriptFile.GetData(), toolkit_strerror(res));
|
|
|
+ tmpResult = Error_Process;
|
|
|
+ }
|
|
|
+ } while (false);
|
|
|
+ }
|
|
|
+
|
|
|
} else {
|
|
|
tmpMsg = CSimpleStringA::Format("%s 执行文件不存在", strInstallScriptFile.GetData());
|
|
|
tmpResult = Error_NotExist;
|
|
|
@@ -391,7 +419,7 @@ void ResourceWatcherEntity::InstallThirdPartyProgram(SpReqAnsContext<ResourceWat
|
|
|
}
|
|
|
|
|
|
if (tmpResult == Error_Succeed) {
|
|
|
- Sleep(500);
|
|
|
+ Sleep(1000);
|
|
|
SogouInstallInfo info;
|
|
|
info.state.dwInstalledStatus = Sogou_GetInstallStatus();
|
|
|
info.state.strInstallDate = Sogou_GetInstallTime();
|