Browse Source

#IQRV #comment [UOS] version下仅保留一个启动脚本

80374374 1 year ago
parent
commit
6827ffd90e

+ 3 - 0
CMakeLists.txt

@@ -717,6 +717,9 @@ else(MSVC)
 	install(FILES "${CMAKE_SOURCE_DIR}/addin/packaging/UOS/Readme.txt" DESTINATION "${PACK_INSTALL_RUN_DIR}/./.." COMPONENT scripts)
 	file(GLOB VENDOR_ROOT_CONFIG_FILES "${CMAKE_SOURCE_DIR}/addin/hardwarecfg/UOS/root-*.ini")
 	install(FILES ${VENDOR_ROOT_CONFIG_FILES} DESTINATION "${PACK_INSTALL_RUN_DIR}/hardwarecfg" COMPONENT scripts)
+
+	install(PROGRAMS "${CMAKE_SOURCE_DIR}/addin/startup_scripts/spshellstart" DESTINATION "${RVC_RUNTIME_PATH}" COMPONENT scripts)
+
 endif(MSVC)
 
 if(DEVOPS_ON)

+ 1 - 1
Framework/spshell/Widgets/mainwindow.cpp

@@ -48,7 +48,7 @@
 #define FRAMEWORK_STATE_RECOVING 9
 #define FRAMEWORK_STATE_NOTDISTURB 10
 
-#define STARTUP_SCRIPT "spexplorer.sh"
+#define STARTUP_SCRIPT "sudo_spexplorer.sh"
 
 #ifdef DEVOPS_ON_ST /*DevOps流水线编译,ST环境*/
 #define RVC_TITLE_STRING "RVC Terminal Application STver."

+ 3 - 3
Tool/guardian/guardian.cpp

@@ -554,7 +554,7 @@ int FrameworkShutdown(bool bUpgrade=false,bool bRestart = true)
 			toResetCWD = true;
 		}
 
-		strcat(tmp, "spexplorer.sh  --restart");
+		strcat(tmp, "sudo_spexplorer.sh  --restart");
 		LOG4VTM(DEBUG, tmp);
         tk_process_t* process = NULL;
         tk_process_option_t option;
@@ -565,7 +565,7 @@ int FrameworkShutdown(bool bUpgrade=false,bool bRestart = true)
 
         if (0 == process_spawn(&option, &process)) {
             FREE(process);
-			LOG4VTM(INFO, "run spexplorer.sh scripts succ.");
+			LOG4VTM(INFO, "run sudo_spexplorer.sh scripts succ.");
 			Sleep(1000);
 			g_SpShellPID = GetSpshellProcID();
 			LOG4VTM(INFO, "get spshell proc id: " << g_SpShellPID);
@@ -575,7 +575,7 @@ int FrameworkShutdown(bool bUpgrade=false,bool bRestart = true)
             return 0;
 		} else {
 			FREE(process);
-			LOG4VTM(ERROR, "run spexplorer.sh scripts failed!");
+			LOG4VTM(ERROR, "run sudo_spexplorer.sh scripts failed!");
 
             if (toResetCWD) {
                 SetCurrentDirectoryA(path);

+ 0 - 157
addin/din/unix/rvcinstall.sh

@@ -1,157 +0,0 @@
-#!/bin/bash
-MY_PATH="`dirname \"$0\"`"              # relative
-# echo "1"$MY_PATH
-MY_PATH="`( cd \"$MY_PATH\" && pwd )`"  # absolutized and normalized
-
-
-echo "[RVCTermianal] === Install Start === "
-echo "result=-1&msg=install begin" > `pwd`/install.log
-rvc_install_path_root="/opt"
-rvc_install_path_rvc_dir=${rvc_install_path_root}/rvc
-rvc_install_path_Run_dir=${rvc_install_path_root}/Run
-rvc_install_path_hardware_dir=${rvc_install_path_Run_dir}/hardwarecfg
-rvc_install_path_versions_dir=${rvc_install_path_Run_dir}/version
-
-
-#detect the usr input the vendor or not
-has_vendor=0
-tolower_vendor=''
-upper_vendor=''
-if [ $# -eq 1 ];then
-    has_vendor=1
-    echo has arguments: $*
-	tolower_vendor=$(echo $1 | awk '{ print tolower($0) }' )
-    upper_vendor=$(echo $1 | awk '{ print toupper($0) }' )
-else
-    echo no any arguments.
-fi
-
-# to detect zipped pkg is exist or not
-pkgs=$(sudo find ${MY_PATH} -type f -name "*.tar.gz")
-array=(${pkgs// / })
-let "nums=0"
-for var in ${array[@]}
-do
-    let nums+=1
-    echo $var
-done
-
-if [ "#${pkgs}" = "#" ]
-then
-    echo Fail to find tar install package !!
-    exit 1
-else if [ $nums -ne 1 ]
-then
-    echo "请删除当前目录多余的安装压缩包 .tar.gz 有且请保留一个 ! ${nums}"
-    exit 1
-else
-    echo ${pkgs}
-fi
-fi
-
-cur_pkg=${pkgs}
-slen=${#cur_pkg}
-cur_pkg_len=$((${slen}-6))
-cur_pkg_exists_dir=$(echo $cur_pkg | awk '{ print substr($0,0,length($0)-6) }') #.tar.gz
-echo ${cur_pkg_exists_dir}
-
-# remove the unzipped files if exists
-if [ -d $cur_pkg_exists_dir ]; then
-    echo "删除已存在的解压包文件夹..."
-    sudo rm -rf ${cur_pkg_exists_dir}
-fi
-
-# unzip the zipped pkg.
-echo to unzip $cur_pkg ...
-tar -xzvf $cur_pkg
-echo unzip $cur_pkg done!
-
-# fetch the version full path at pkg
-version_dir=$(find ${cur_pkg_exists_dir}/Run/version/ -maxdepth 1 -regex ".*[0-9\.]$" -type d)
-echo version dir: $version_dir
-slen=${#cur_pkg_exists_dir}
-rel_version_dir=${version_dir:$slen+1}
-echo ${rel_version_dir}
-
-#if [ $has_vendor -eq 1 ];then
-#    bak=${cur_pkg}_bak
-#    sudo rm -rf ${bak}
-#    sudo mkdir -p ${bak}
-#    sudo cp -R 'find ${version_dir} -type d -path ${version_dir}/dep -prune -o -print | sed 1d' ${bak}
-#fi
-
-
-# to copy thirdparty libraries
-
-# deal with libcef.so
-# if [ ! -f "$version_dir/bin/Chromium/libcef.so" -a ! -f "/usr/lib/libcef.so"  ];then
-#     echo cannot found libcef.so !!!
-#     exit 1
-# else if [ ! -f "/usr/lib/libcef.so" ];then
-#     echo to mv libcef.so...
-#     sudo mv $version_dir/bin/Chromium/libcef.so /usr/lib/
-#     echo mv libcef.so done!
-# else if [ -f "$version_dir/bin/Chromium/libcef.so" ]; then
-#     sudo rm $version_dir/bin/Chromium/libcef.so
-# fi
-# fi
-# fi
-# sudo chmod 644 /usr/lib/libcef.so
-
-#delete /opt/rvc
-# sudo rm -rf ${rvc_install_path_rvc_dir}
-
-if [ ! -f $rvc_install_path_hardware_dir/root.ini ]; then
-    #delete /opt/Run
-    sudo rm -rf ${rvc_install_path_Run_dir}
-else
-    echo root.ini 文件已存在,不打算删除整个 Run 文件夹.
-fi
-
-
-#copy the Run pkg to run path
-echo to copy Run package...
-sudo cp -rvf $cur_pkg_exists_dir/Run ${rvc_install_path_root}
-echo copy Run package completely!
-
-#copy the res pkg to rvc path
-echo to copy rvc Audio files...
-if [ ! -d $rvc_install_path_rvc_dir ]; then
-    sudo mkdir -p ${rvc_install_path_rvc_dir}
-fi
-if [ ! -d $rvc_install_path_rvc_dir/addata ]; then
-    sudo mkdir -p ${rvc_install_path_rvc_dir}/addata
-fi
-sudo cp -rvf $cur_pkg_exists_dir/Data/Audio ${rvc_install_path_rvc_dir}/addata
-echo copy rvc Audio files completely!
-sudo cp -rvf $cur_pkg_exists_dir/Data/Video ${rvc_install_path_rvc_dir}/addata
-echo copy rvc Video files completely!
-
-
-echo change the run scripts priviledge...
-echo ${rvc_install_path_rvc_dir}
-echo ${rvc_install_path_root}/${rel_version_dir}
-sudo chmod 777 ${rvc_install_path_root}
-sudo chmod a+rw -R ${rvc_install_path_rvc_dir}
-sudo chmod a+rw -R ${rvc_install_path_hardware_dir}
-sudo chmod 777 -R ${rvc_install_path_root}/${rel_version_dir}
-sudo chmod 777 ${rvc_install_path_versions_dir}/spexplorer.sh
-sudo chmod 777 ${rvc_install_path_versions_dir}/sudo_spexplorer.sh
-echo change the run scripts priviledge done!
-
-if [ $has_vendor -eq 1 ];then
-    root_file=$rvc_install_path_hardware_dir/root.ini
-    root_vendor_file=$rvc_install_path_hardware_dir/root.ini.$tolower_vendor
-    if [ -f $root_vendor_file -a ! -f $root_files ] #  ! -f $root_file -a 
-    then
-        echo "重命名 root.ini "
-        sudo cp $root_vendor_file $root_file
-    fi
-fi
-
-echo "result=0&msg=install ok" > `pwd`/install.log
-chmod 777 `pwd`/install.log
-
-echo "[RVCTermianal] 所有操作已完成 !!!"
-
-exit 0

+ 1 - 1
addin/packaging/DEBIAN/postinst

@@ -160,7 +160,7 @@ if [ "$1" = "configure" ]; then
     chmod 777 -R ${rvc_install_path_Run_dir}
     chmod 777 -R ${rvc_install_path_rvc_dir}
     chmod 777 -R ${rvc_install_path_hardware_dir}
-    chmod 777 ${rvc_install_path_versions_dir}/spexplorer.sh
+    chmod 777 ${rvc_install_path_versions_dir}/spexplorer.sh > /dev/null 2>&1
     chmod 777 ${rvc_install_path_versions_dir}/sudo_spexplorer.sh
     chmod a+rw ${rvc_install_path_versions_dir}/active.txt
     echo "[INFO]: change the run scripts priviledge done!"

+ 1 - 1
addin/packaging/UOS/installsh.in

@@ -293,7 +293,7 @@ sudo chmod a+rw -R ${rvc_install_path_rvc_dir}
 sudo chmod a+rw -R ${rvc_install_path_hardware_dir}
 
 sudo chmod 777 -R ${rvc_install_path_root}/${rel_version_dir}
-sudo chmod 777 ${rvc_install_path_versions_dir}/spexplorer.sh
+sudo chmod 777 ${rvc_install_path_versions_dir}/spexplorer.sh > /dev/null 2>&1
 sudo chmod 777 ${rvc_install_path_versions_dir}/sudo_spexplorer.sh
 sudo chmod a+rw ${rvc_install_path_versions_dir}/active.txt
 sudo chmod a+rw ${rvc_install_path_versions_dir}

+ 1 - 1
addin/packaging/UOS/original.sh

@@ -305,7 +305,7 @@ sudo chmod a+rw -R ${rvc_install_path_rvc_dir}
 sudo chmod a+rw -R ${rvc_install_path_hardware_dir}
 
 sudo chmod 777 -R ${rvc_install_path_root}/${rel_version_dir}
-sudo chmod 777 ${rvc_install_path_versions_dir}/spexplorer.sh
+sudo chmod 777 ${rvc_install_path_versions_dir}/spexplorer.sh > /dev/null 2>&1
 sudo chmod 777 ${rvc_install_path_versions_dir}/sudo_spexplorer.sh
 sudo chmod a+rw ${rvc_install_path_versions_dir}/active.txt
 sudo chmod a+rw ${rvc_install_path_versions_dir}

+ 0 - 105
addin/startup_scripts/spexplorer.sh

@@ -1,105 +0,0 @@
-#!/bin/sh
-MY_PATH="`dirname \"$0\"`"              # relative
-# echo "1"$MY_PATH
-MY_PATH="`( cd \"$MY_PATH\" && pwd )`"  # absolutized and normalized
-# echo "2"$MY_PATH
-common_run() {
-	echo "[RUN] $@"
-	"$@"
-	RES=$?
-	if [ $RES -ne 0 ];
-	then
-		echo "[ERROR] $@ retured $RES"
-		exit 1
-	fi
-}
-
-check_dir_exists() {
-	if [ ! -d "$*" ]; then
-		echo "\n"
-		echo "=============================================================="
-		echo "   文件夹 $* 不存在!  "
-		echo "==============================================================\n"
-		exit 2
-	fi
-}
-
-check_file_exists() {
-	if [ ! -f "$*" ]; then
-		echo "\n"
-		echo "=============================================================="
-		echo "   文件 $* 不存在!  "
-		echo "==============================================================\n"
-		exit 2
-	fi
-}
-
-# echo "scriptPath1: "$(cd `dirname $0`; pwd)
-# echo "scriptPath2: "$(dirname $(readlink -f $0))
-# echo "scriptPath4: "$(cd "$(dirname "$0")" && pwd)
-# echo "scriptPath5: "$(dirname "$(readlink -f "$0")")
-# echo "scriptPath6: "$(cd "$(dirname "$0")" && pwd -P)
-versionpath=""
-versionpath=$MY_PATH"/active.txt"
-# echo $versionpath
-line=""
-version=$(cat $versionpath)
-version=`echo ${version} | sed -e 's/^[ \t]*//g' -e 's/^[ \t]*$//g'`
-if [ -z "$version" ]; then
-    echo "\n"
-	echo "=============================================================="
-	echo "   文件 ${versionpath} 不存在或内容为空!  "
-	echo "==============================================================\n"
-	exit 1
-fi
-
-# add library search path
-LIBDIR0=${MY_PATH}"/"${version}
-LIBDIR1=${MY_PATH}"/"${version}"/bin"
-LIBDIR2=${MY_PATH}"/"${version}"/dep"
-
-check_dir_exists ${LIBDIR0}
-check_dir_exists ${LIBDIR1}
-# check_dir_exists ${LIBDIR2}
-
-path=$LD_LIBRARY_PATH
-# echo $path
-result=$(echo $path | grep "${LIBDIR1}")
-if [ "$result" != "" ]
-#if [ $path =~ $LIBDIR1 ]
-then
-	echo "has execute path alreadly"
-else
-	echo "add path: ${LIBDIR1}:${LIBDIR2}"
-	export LD_LIBRARY_PATH=$LIBDIR1:$LIBDIR2:$LD_LIBRARY_PATH
-fi
-
-shell_path=${MY_PATH}"/"${version}"/bin/spshell"
-host_path=${MY_PATH}"/"${version}"/bin/sphost"
-
-check_file_exists ${shell_path}
-check_file_exists ${host_path}
-
-# echo "bin_path: ${bin_path}"
-if [ ! -x "$shell_path" ]; then
-chmod 766 $shell_path
-echo "add run privilege for : ${shell_path}"
-fi
-if [ ! -x "$host_path" ]; then
-chmod 766 $host_path
-echo "add run privilege for : ${host_path}"
-fi
-
-if [ $# -eq 0 ]
-then
-	common_run exec ${shell_path}
-else
-	printenv
-	# echo $#
-	common_run exec ${shell_path} $*
-fi
-exit $?
-
-
-
-

+ 65 - 0
addin/startup_scripts/spshellstart

@@ -0,0 +1,65 @@
+#!/bin/sh
+MY_PATH="`dirname \"$0\"`"              # relative
+MY_PATH="`( cd \"$MY_PATH\" && pwd )`"  # absolutized and normalized
+common_run() {
+	echo "[RUN] $@"
+	"$@"
+	RES=$?
+	if [ $RES -ne 0 ];
+	then
+		echo "[ERROR] $@ retured $RES"
+		exit 1
+	fi
+}
+
+check_file_exists() {
+	if [ ! -f "$*" ]; then
+		echo "\n"
+		echo "=============================================================="
+		echo "   文件 $* 不存在!  "
+		echo "==============================================================\n"
+		exit 2
+	fi
+}
+
+# add library search path
+LIBDIR1=${MY_PATH}
+path=$LD_LIBRARY_PATH
+# echo $path
+result=$(echo $path | grep "${LIBDIR1}")
+if [ "$result" != "" ]
+#if [ $path =~ $LIBDIR1 ]
+then
+	echo "has execute path alreadly"
+else
+	echo "add path: ${LIBDIR1}"
+	export LD_LIBRARY_PATH=$LIBDIR1:$LD_LIBRARY_PATH
+fi
+
+shell_path=${MY_PATH}"/spshell"
+host_path=${MY_PATH}"/sphost"
+
+check_file_exists ${shell_path}
+check_file_exists ${host_path}
+
+# echo "bin_path: ${bin_path}"
+if [ ! -x "$shell_path" ]; then
+chmod 766 $shell_path
+echo "add run privilege for : ${shell_path}"
+fi
+if [ ! -x "$host_path" ]; then
+chmod 766 $host_path
+echo "add run privilege for : ${host_path}"
+fi
+
+if [ $# -eq 0 ]
+then
+	common_run exec ${shell_path}
+else
+	common_run exec ${shell_path} $*
+fi
+exit $?
+
+
+
+

+ 54 - 3
addin/startup_scripts/sudo_spexplorer.sh

@@ -2,10 +2,61 @@
 
 MY_PATH="`dirname \"$0\"`"              # relative
 MY_PATH="`( cd \"$MY_PATH\" && pwd )`"  # absolutized and normalized
-echo "2"$MY_PATH
+
+
+
 bootscripts=""
-bootscripts=$MY_PATH"/spexplorer.sh"
+
+
+check_dir_exists() {
+	if [ ! -d "$*" ]; then
+		echo "\n"
+		echo "=============================================================="
+		echo "   文件夹 $* 不存在!  "
+		echo "==============================================================\n"
+		exit 2
+	fi
+}
+
+check_file_exists() {
+	if [ ! -f "$*" ]; then
+		echo "\n"
+		echo "=============================================================="
+		echo "   文件 $* 不存在!  "
+		echo "==============================================================\n"
+		exit 2
+	fi
+}
+
+versionpath=""
+versionpath=$MY_PATH"/active.txt"
+# echo $versionpath
+line=""
+version=$(cat $versionpath)
+version=`echo ${version} | sed -e 's/^[ \t]*//g' -e 's/^[ \t]*$//g'`
+if [ -z "$version" ]; then
+    echo "\n"
+	echo "=============================================================="
+	echo "   文件 ${versionpath} 不存在或内容为空!  "
+	echo "==============================================================\n"
+	exit 1
+fi
+
+# add library search path
+LIBDIR=${MY_PATH}"/"${version}"/bin"
+check_dir_exists ${LIBDIR}
+
+bootscripts=$LIBDIR"/spshellstart"
 echo $bootscripts
 chmod 766 $bootscripts
-sudo $bootscripts
+
+if [ $# -eq 0 ]
+then
+	sudo $bootscripts
+else
+	# echo $#
+	sudo $bootscripts $*
+fi
+
+