ソースを参照

Z991239-5240 #comment 安装脚本同步

80374374 1 年間 前
コミット
ee3139ce1f
5 ファイル変更226 行追加58 行削除
  1. 5 1
      CMakeLists.txt
  2. 99 0
      addin/install.bat
  3. 23 0
      addin/kill.bat
  4. 99 0
      addin/upgrade.bat
  5. 0 57
      rvc_test.bat

+ 5 - 1
CMakeLists.txt

@@ -715,11 +715,15 @@ install(FILES ${active_txt_file} DESTINATION ${RVC_BASE_PATH} COMPONENT scripts)
 
 if(MSVC)
 	file(GLOB BAT_SCRIPTS "${CMAKE_SOURCE_DIR}/addin/startup_scripts/*.vbs")
-	install(FILES "${CMAKE_SOURCE_DIR}/rvc_test.bat" DESTINATION ${OUTPUT_CUR_DISK_PATH}  COMPONENT scripts)
+	install(PROGRAMS "${CMAKE_SOURCE_DIR}/addin/install.bat" DESTINATION "${PACK_INSTALL_RUN_DIR}/./.." COMPONENT scripts)
+	install(PROGRAMS "${CMAKE_SOURCE_DIR}/addin/upgrade.bat" DESTINATION "${PACK_INSTALL_RUN_DIR}/./.." COMPONENT scripts)
 	install(FILES "${CMAKE_SOURCE_DIR}/addin/hardwarecfg/${ROOT_INI_NAME}" 
 	DESTINATION "${PACK_INSTALL_RUN_DIR}/hardwarecfg" 
 	RENAME "root.ini"
 	COMPONENT scripts)
+	if(NOT DEVOPS_ON_CMAKE_PRD)
+		install(PROGRAMS "${CMAKE_SOURCE_DIR}/addin/kill.bat" DESTINATION ${RVC_BASE_PATH} COMPONENT scripts)
+	endif(NOT DEVOPS_ON_CMAKE_PRD)
 else(MSVC)
 	file(GLOB BAT_SCRIPTS "${CMAKE_SOURCE_DIR}/addin/startup_scripts/*.sh")
 	file(GLOB VENDOR_ROOT_CONFIG_FILES "${CMAKE_SOURCE_DIR}/addin/hardwarecfg/root-*.ini")

+ 99 - 0
addin/install.bat

@@ -0,0 +1,99 @@
+@setlocal enabledelayedexpansion
+@echo off
+
+@rem 要求以管理员方式启动
+bcdedit >nul
+if '%errorlevel%' NEQ '0' (goto UACPrompt) else (goto UACAdmin)
+:UACPrompt
+%1 start "" mshta vbscript:createobject("shell.application").shellexecute("""%~0""","::",,"runas",1)(window.close)&exit
+exit /B
+:UACAdmin
+cd /d "%~dp0"
+
+@set /a argumentNum=0
+@for %%a in (%*) do set /a argumentNum+=1
+@if %argumentNum% gtr 0 (
+	@echo argument count: %argumentNum%
+) else (
+	@echo no any arguments!
+)
+
+echo "[RVCTermianal] === Install Start === "
+
+tasklist /nh | find /i "spshell.exe"
+@if errorlevel 1 (
+	@echo  [INFO] 可视柜台进程不存在,跳过
+) else (
+	@echo  [INFO] 检测到可视柜台进程存在!5s 后将清理可视柜台相关进程
+	@for /l %%a in (1, 1, 5) do (
+		timeout 1 > nul
+		@echo %%a秒…… 如果不想清理可视柜台应用进程,请及时关闭此窗口!
+	)
+	@echo [INFO] 开始清理可视柜台相关进程……
+	TASKKILL /F /IM spshell.exe
+	TASKKILL /F /IM guardian.exe
+	TASKKILL /F /IM cefclient.exe
+
+	@for /f "tokens=1,2 delims= " %%a in ('tasklist /m ^| findstr "sphost.exe"') do (
+		@echo name=%%a, PID = %%b, and will kill it.
+		TASKKILL /F /PID %%a
+	)
+)
+
+
+
+@set ROOT=%cd%
+@set rvc_src_path_rvc_dir=%ROOT%\\rvc
+@set rvc_src_path_Run_dir=%ROOT%\\Run
+@set rvc_install_path_root=C:
+
+@if exist "D:\\" (
+	@echo "D:\\ exists!"
+	@if exist "D:\\Run\\version\\vtm.exe" (
+		@set rvc_install_path_root=D:
+	) else (
+		@set rvc_install_path_root=D:
+	)
+) else (
+	@set rvc_install_path_root=C:
+)
+
+@echo rvc_install_path_root=%rvc_install_path_root%
+@echo rvc_src_path_Run_dir=%rvc_src_path_Run_dir%
+
+@set rvc_install_path_rvc_dir=%rvc_install_path_root%\\rvc
+@set rvc_install_path_Run_dir=%rvc_install_path_root%\\Run
+@set rvc_install_path_hardware_dir=%rvc_install_path_Run_dir%\\hardwarecfg
+@set rvc_install_path_versions_dir=%rvc_install_path_Run_dir%\\version
+
+@echo rvc_install_path_rvc_dir=%rvc_install_path_rvc_dir%
+@echo rvc_install_path_Run_dir=%rvc_install_path_Run_dir%
+@echo rvc_install_path_hardware_dir=%rvc_install_path_hardware_dir%
+@echo rvc_install_path_versions_dir=%rvc_install_path_versions_dir%
+
+@if not exist "%rvc_install_path_rvc_dir%" md "%rvc_install_path_rvc_dir%"
+@if not exist "%rvc_install_path_Run_dir%" md "%rvc_install_path_Run_dir%"
+@if not exist "%rvc_install_path_hardware_dir%" md "%rvc_install_path_hardware_dir%"
+@if not exist "%rvc_install_path_versions_dir%" md "%rvc_install_path_versions_dir%"
+
+@echo 【0/1】拷贝RVC目录...
+@xcopy %rvc_src_path_rvc_dir% %rvc_install_path_rvc_dir%\\  /E/Y/Q
+@echo 【1/1】拷贝RVC目录OK!
+
+
+@echo 【1/2】拷贝终端版本...
+@xcopy %rvc_src_path_Run_dir%\\hardwarecfg\\ %rvc_install_path_hardware_dir%\\  /E/Y/Q
+@xcopy %rvc_src_path_Run_dir%\\version\\ %rvc_install_path_versions_dir%\\  /E/Y/Q
+@echo 【2/2】拷贝终端版本OK!
+
+
+@echo 【2/3】 打开版本所在文件夹
+@start %rvc_install_path_versions_dir%
+
+@echo  [INFO] 3s 后自动退出该执行脚本
+@for /l %%a in (1, 1, 3) do (
+		timeout 1 > nul
+		@echo %%a秒…… !
+	)
+@echo  [INFO] 退出脚本,安装结束!
+@exit 0

+ 23 - 0
addin/kill.bat

@@ -0,0 +1,23 @@
+@setlocal enabledelayedexpansion
+@echo off
+
+bcdedit >nul
+if '%errorlevel%' NEQ '0' (goto UACPrompt) else (goto UACAdmin)
+:UACPrompt
+%1 start "" mshta vbscript:createobject("shell.application").shellexecute("""%~0""","::",,"runas",1)(window.close)&exit
+exit /B
+:UACAdmin
+
+echo '============================================begin====================================================='
+
+TASKKILL /F /IM spshell.exe
+TASKKILL /F /IM guardian.exe
+TASKKILL /F /IM cefclient.exe
+
+for /f "tokens=1,2 delims= " %%a in ('tasklist /m ^| findstr "sphost.exe"') do (
+    echo name=%%a, PID = %%b, and will kill it.
+    TASKKILL /F /PID %%a
+)
+
+echo "=============================================end====================================================="
+

+ 99 - 0
addin/upgrade.bat

@@ -0,0 +1,99 @@
+@setlocal enabledelayedexpansion
+@echo off
+
+@rem 要求以管理员方式启动
+bcdedit >nul
+if '%errorlevel%' NEQ '0' (goto UACPrompt) else (goto UACAdmin)
+:UACPrompt
+%1 start "" mshta vbscript:createobject("shell.application").shellexecute("""%~0""","::",,"runas",1)(window.close)&exit
+exit /B
+:UACAdmin
+cd /d "%~dp0"
+
+@set /a argumentNum=0
+@for %%a in (%*) do set /a argumentNum+=1
+@if %argumentNum% gtr 0 (
+	@echo argument count: %argumentNum%
+) else (
+	@echo no any arguments!
+)
+
+echo "[RVCTermianal] === Install Start === "
+
+tasklist /nh | find /i "spshell.exe"
+@if errorlevel 1 (
+	@echo  [INFO] 可视柜台进程不存在,跳过
+) else (
+	@echo  [INFO] 检测到可视柜台进程存在!5s 后将清理可视柜台相关进程
+	@for /l %%a in (1, 1, 5) do (
+		timeout 1 > nul
+		@echo %%a秒…… 如果不想清理可视柜台应用进程,请及时关闭此窗口!
+	)
+	@echo [INFO] 开始清理可视柜台相关进程……
+	TASKKILL /F /IM spshell.exe
+	TASKKILL /F /IM guardian.exe
+	TASKKILL /F /IM cefclient.exe
+
+	@for /f "tokens=1,2 delims= " %%a in ('tasklist /m ^| findstr "sphost.exe"') do (
+		@echo name=%%a, PID = %%b, and will kill it.
+		TASKKILL /F /PID %%a
+	)
+)
+
+
+
+@set ROOT=%cd%
+@set rvc_src_path_rvc_dir=%ROOT%\\rvc
+@set rvc_src_path_Run_dir=%ROOT%\\Run
+@set rvc_install_path_root=C:
+
+@if exist "D:\\" (
+	@echo "D:\\ exists!"
+	@if exist "D:\\Run\\version\\vtm.exe" (
+		@set rvc_install_path_root=D:
+	) else (
+		@set rvc_install_path_root=D:
+	)
+) else (
+	@set rvc_install_path_root=C:
+)
+
+@echo rvc_install_path_root=%rvc_install_path_root%
+@echo rvc_src_path_Run_dir=%rvc_src_path_Run_dir%
+
+@set rvc_install_path_rvc_dir=%rvc_install_path_root%\\rvc
+@set rvc_install_path_Run_dir=%rvc_install_path_root%\\Run
+@set rvc_install_path_hardware_dir=%rvc_install_path_Run_dir%\\hardwarecfg
+@set rvc_install_path_versions_dir=%rvc_install_path_Run_dir%\\version
+
+@echo rvc_install_path_rvc_dir=%rvc_install_path_rvc_dir%
+@echo rvc_install_path_Run_dir=%rvc_install_path_Run_dir%
+@echo rvc_install_path_hardware_dir=%rvc_install_path_hardware_dir%
+@echo rvc_install_path_versions_dir=%rvc_install_path_versions_dir%
+
+@if not exist "%rvc_install_path_rvc_dir%" md "%rvc_install_path_rvc_dir%"
+@if not exist "%rvc_install_path_Run_dir%" md "%rvc_install_path_Run_dir%"
+@if not exist "%rvc_install_path_hardware_dir%" md "%rvc_install_path_hardware_dir%"
+@if not exist "%rvc_install_path_versions_dir%" md "%rvc_install_path_versions_dir%"
+
+@echo 【0/1】拷贝RVC目录...
+@xcopy %rvc_src_path_rvc_dir% %rvc_install_path_rvc_dir%\\  /E/Y/Q
+@echo 【1/1】拷贝RVC目录OK!
+
+
+@echo 【1/2】拷贝终端版本...
+@xcopy %rvc_src_path_Run_dir%\\hardwarecfg\\ %rvc_install_path_hardware_dir%\\  /E/Y/Q
+@xcopy %rvc_src_path_Run_dir%\\version\\ %rvc_install_path_versions_dir%\\  /E/Y/Q
+@echo 【2/2】拷贝终端版本OK!
+
+
+@echo 【2/3】 打开版本所在文件夹
+@start %rvc_install_path_versions_dir%
+
+@echo  [INFO] 3s 后自动退出该执行脚本
+@for /l %%a in (1, 1, 3) do (
+		timeout 1 > nul
+		@echo %%a秒…… !
+	)
+@echo  [INFO] 退出脚本,安装结束!
+@exit 0

+ 0 - 57
rvc_test.bat

@@ -1,57 +0,0 @@
-@echo off
-setlocal enabledelayedexpansion
-
-%1 %2
-set result=-1
-ver|find "5.">nul&&goto :admin
-mshta vbscript:createobject("shell.application").shellexecute("%~s0","goto :admin","","runas",1)(window.close)&goto :eof
-:admin
-set result=0
-taskkill /F /IM sphost.exe
-taskkill /F /IM spshell.exe
-if %errorlevel% neq 0 (
-if %errorlevel% equ 128 (
-echo specified process is not existed.
-) else (
-echo error occurs: %errorlevel%
-)
-) else (
-echo normal resut delay 3 seconds for safety.
-rem delay seconds
-choice /t 3 /d y /n >nul
-)
-
-
-
-echo current disk: %~d0
-set run_path=%~d0
-set relate_path="\\Run\\version\\spexplorer.vbs"
-set exec_path=%run_path%%relate_path%
-echo execute path: %exec_path%
-rem start %exec_path%
-
-for /f "delims=" %%i in ('cscript //nologo %exec_path%') do set "d=%%i"
-echo %d%
-
-choice /t 15 /d y /n >nul
-
-set has_sphost=no
-set has_spshell=no
-
-for /F "tokens=1*" %%a in ('tasklist /nh /fi "imagename eq spshell.exe"') do if %%a == spshell.exe set has_spshell=yes
-for /F "tokens=1*" %%a in ('tasklist /nh /fi "imagename eq sphost.exe"') do if %%a == sphost.exe set has_sphost=yes
-if %has_sphost% == yes (
-echo sphost is loaded successfully.
-) else (
-echo sphost is boost failed!!
-set result=-1
-)
-if %has_spshell% == yes (
-echo spshell is loaded successfully.
-) else (
-echo spshell is boost failed!!
-set result=-1
-)
-:eof
-echo result:  %result%
-exit /b %result%