فهرست منبع

#IQRV #comment 解决全新安装加载厂商适配器失败的问题

80374374 1 سال پیش
والد
کامیت
5382f6d7b4
3فایلهای تغییر یافته به همراه54 افزوده شده و 85 حذف شده
  1. 1 1
      Framework/spbase/sp_env.c
  2. 48 82
      Framework/spshell/svc.cpp
  3. 5 2
      addin/startup_scripts/spshellstart.sh

+ 1 - 1
Framework/spbase/sp_env.c

@@ -33,7 +33,7 @@ void set_ld_library_path(sp_env_t* env)
 	{
 		strcpy(manu, env->cfg->root_ini->manufacturer);
 		if (strlen(manu) == 0) {
-			DbgWithLinkForC(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM, "not any config for manufacturer");
+			DbgWithLinkForC(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM, "not any config for manufacturer, cannot set sub dep directory!");
 			return;
 		}
 	}

+ 48 - 82
Framework/spshell/svc.cpp

@@ -197,98 +197,64 @@ static int KickoffSpRestartInner(int options)
 
 #else
 
-#if 0
-
-    if (env && env->cfg && env->cfg->args && env->cfg->args->program) {
-        char app[MAX_PATH] = { '\0' };
-        tk_process_t* process = NULL;
-        tk_process_option_t option;
-        if (env->cfg->args->arguments == NULL) {
-            sprintf(app, "%s -Rwait", env->cfg->args->program);
-        } else {
-            sprintf(app, "%s %s -Rwait", env->cfg->args->program, env->cfg->args->arguments);
-        }
-        option.exit_cb = NULL;
-        option.file = NULL;
-        option.flags = 0;
-        option.params = app;
-		char szldPath[1024] = {'\0'};
-		size_t szldLen = 1023;
-		const int ldRet = toolkit_getenv("LD_LIBRARY_PATH", szldPath, &szldLen);
-		if (ldRet == 0) {
-			toolkit_unsetenv("LD_LIBRARY_PATH");
-		} else {
-			DbgWithLink(LOG_LEVEL_ERROR, LOG_TYPE_SYSTEM)("GetEnv of LD_LIBRARY_PATH failed: %s", toolkit_strerror(ldRet));
-		}
-
-        if (0 == process_spawn(&option, &process)) {
-            DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("create new process succ pid=%u! %s", process->pid, app);
-            FREE(process);
-            return 0;
-        } else {
-            DbgWithLink(LOG_LEVEL_ERROR, LOG_TYPE_SYSTEM)("create new process failed! %s", app);
-			if (ldRet == 0) {
-				toolkit_setenv("LD_LIBRARY_PATH", szldPath);
-			}
-        }
-	} else {
-			DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("Env has no any program startup information!");
-    }
-
-#else
-
-    sp_env_t* env = sp_get_env();
-    if (env && env->dir) {
-        tk_process_t* process = NULL;
-        tk_process_option_t option;
+	sp_env_t* env = sp_get_env();
+	if (env && env->dir) {
+		tk_process_t* process = NULL;
+		tk_process_option_t option;
 		char app[MAX_PATH] = { '\0' };
-        char shell_scripts[MAX_PATH] = { '\0' };
-        sprintf(shell_scripts, "%s/%s", env->dir->root_ver_path, "spexplorer.sh");
+		char shell_scripts[MAX_PATH] = { '\0' };
+		sprintf(shell_scripts, "%s/%s", env->dir->root_ver_path, "sudo_spexplorer.sh");
 		if (options == RESTART_FRAMEWORK) {
-            if (env && env->cfg && env->cfg->args && env->cfg->args->arguments) {
-                sprintf(app, "%s %s -Rwait", shell_scripts, env->cfg->args->arguments);
-            } else {
-                sprintf(app, "%s -Rwait", shell_scripts);
-            }
-		} else if(options == SHUTDOWN_FRAMEWORK) {
+			if (env && env->cfg && env->cfg->args && env->cfg->args->arguments) {
+				sprintf(app, "%s %s -Rwait", shell_scripts, env->cfg->args->arguments);
+			}
+			else {
+				sprintf(app, "%s -Rwait", shell_scripts);
+			}
+		}
+		else if (options == SHUTDOWN_FRAMEWORK) {
 			sprintf(app, "%s --shutdown", shell_scripts);
-		} else if (options == RESTART_PC) {
+		}
+		else if (options == RESTART_PC) {
 			sprintf(app, "%s --reboot", shell_scripts);
-		} else if (options == SHUTDOWN_PC) {
+		}
+		else if (options == SHUTDOWN_PC) {
 			sprintf(app, "%s --systemoff", shell_scripts);
-		} else {
+		}
+		else {
 			DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("invalid restart pararm: %d", options);
 			return -1;
 		}
 
-        option.exit_cb = NULL;
-        option.file = NULL;
-        option.flags = 0;
-        option.params = app;
-        char szldPath[1024] = { '\0' };
-        size_t szldLen = 1023;
-        const int ldRet = toolkit_getenv("LD_LIBRARY_PATH", szldPath, &szldLen);
-        if (ldRet == 0) {
+		option.exit_cb = NULL;
+		option.file = NULL;
+		option.flags = 0;
+		option.params = app;
+		char szldPath[1024] = { '\0' };
+		size_t szldLen = 1023;
+		const int ldRet = toolkit_getenv("LD_LIBRARY_PATH", szldPath, &szldLen);
+		if (ldRet == 0) {
 			DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("get library path: %s", szldPath);
-            toolkit_unsetenv("LD_LIBRARY_PATH");
-        } else {
-            DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("GetEnv of LD_LIBRARY_PATH failed: %s", toolkit_strerror(ldRet));
-        }
-        if (0 == process_spawn(&option, &process)) {
-            DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("create new process succ pid=%u! %s", process->pid, app);
-            FREE(process);
-            return 0;
-        } else {
-            DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("create new process failed! %s", app);
-            if (ldRet == 0) {
-                toolkit_setenv("LD_LIBRARY_PATH", szldPath);
-            }
-        }
-    } else {
-        DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("Env has no any dir information!");
-    }
-
-#endif
+			toolkit_unsetenv("LD_LIBRARY_PATH");
+		}
+		else {
+			DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("GetEnv of LD_LIBRARY_PATH failed: %s", toolkit_strerror(ldRet));
+		}
+		if (0 == process_spawn(&option, &process)) {
+			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("create new process succ pid=%u! %s", process->pid, app);
+			FREE(process);
+			return 0;
+		}
+		else {
+			DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("create new process failed! %s", app);
+			if (ldRet == 0) {
+				toolkit_setenv("LD_LIBRARY_PATH", szldPath);
+			}
+		}
+	}
+	else {
+		DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("Env has no any dir information!");
+	}
 
 	return -1;
 

+ 5 - 2
addin/startup_scripts/spshellstart.sh

@@ -25,6 +25,9 @@ check_file_exists() {
 
 # add library search path
 LIBDIR1=${MY_PATH}
+LIBDIRTMP=${LIBDIR1%bin*}
+LIBDIR2=${LIBDIRTMP}dep
+
 path=$LD_LIBRARY_PATH
 # echo $path
 result=$(echo $path | grep "${LIBDIR1}")
@@ -33,8 +36,8 @@ if [ "$result" != "" ]
 then
 	echo "has execute path alreadly"
 else
-	echo "add path: ${LIBDIR1}"
-	export LD_LIBRARY_PATH=$LIBDIR1:$LD_LIBRARY_PATH
+	echo "add path: ${LIBDIR1}:${LIBDIR2}"
+	export LD_LIBRARY_PATH=$LIBDIR1:$LIBDIR2:$LD_LIBRARY_PATH
 fi
 
 shell_path=${MY_PATH}"/spshell"