commit be31b59f06dc153ec245cb9665e250f3b3521c31 Author: chenyf <1343619937@qq.com> Date: Mon Feb 10 11:12:08 2025 +0800 fix(null): null diff --git a/install.bat b/install.bat new file mode 100644 index 0000000..30b4b4c --- /dev/null +++ b/install.bat @@ -0,0 +1,12 @@ +:: 检查下是否有git命令 +where git >nul 2>nul +if %errorlevel% neq 0 ( + msg * "没有找到git命令,请安装git后再运行此脚本,请手动执行install_env.bat." + pause + exit +) +:: 调用 install_maco.bat +call install_maco.bat + +:: 调用 install_maco_cshart.bat +call install_maco_cshart.bat \ No newline at end of file diff --git a/install_env.bat b/install_env.bat new file mode 100644 index 0000000..a83f29f --- /dev/null +++ b/install_env.bat @@ -0,0 +1,2 @@ +msg * "请在网页中下载git软件,并安装,安装选项均设置为默认即可" +start http://chenyf123.top:1000/#s/_RHUzZ-Q \ No newline at end of file diff --git a/install_maco_cshart.bat b/install_maco_cshart.bat new file mode 100644 index 0000000..2bc6ae4 --- /dev/null +++ b/install_maco_cshart.bat @@ -0,0 +1,70 @@ +@echo off +setlocal enabledelayedexpansion + +:: 设置Git仓库URL +set repo_url=http://chenyf123.top:1030/chenyf/fcma_csharp_maco.git +set release_url=%repo_url%/releases/download +set download_file=app_data.zip +set local_tag_path=maco_csharp_tag +:: app目录 +set target_dir=app + + +:: 检查下是否有git命令 +where git >nul 2>nul +if %errorlevel% neq 0 ( + msg * "没有找到git命令,请安装git后再运行此脚本,请手动执行install_env.bat." + pause + exit +) + +if not exist %target_dir% mkdir %target_dir% + +if not exist %local_tag_path% mkdir %local_tag_path% + + +:: 获取 Git 仓库的tag 列表 +git ls-remote --tags %repo_url% > %local_tag_path%\orign_tags.txt +:: 读取最新tag名称 +for /f "tokens=3 delims=/" %%i in (%local_tag_path%\orign_tags.txt) do set latest_tag_name=%%i + +echo latest_tag_name=%latest_tag_name% + +set local_tags= +:: 检查是否有本地版本文件 local_tags.txt +if exist %local_tag_path%\local_tags.txt ( + :: 读取本地版本文件中的tag信息 + set /p local_tags=<%local_tag_path%\local_tags.txt +) +echo local_tags=%local_tags% +::检查是否有新版本 +if "%local_tags%"=="" ( + :: 没有本地版本文件,直接拉取最新的release文件 + echo 没有本地版本文件,直接拉取最新的release文件 + goto :func_download_app +) else ( + :: 有本地版本文件,检查是否有新版本 + if "%local_tags%"=="%latest_tag_name%" ( + echo 本地版本已是最新版本 + goto :func_end + ) else ( + echo 有新版本,准备下载 + goto :func_clean_local_app + ) +) + +:func_clean_local_app + del /s /q %target_dir% +:func_download_app + echo download_url=%release_url%/%latest_tag_name%/%download_file% + curl -o %target_dir%\%download_file% -L %release_url%/%latest_tag_name%/%download_file% + :: 解压文件到app目录 + powershell -Command "Expand-Archive -Path %target_dir%/%download_file% -DestinationPath %target_dir%" + ::删除下载的zip文件 + del %target_dir%\%download_file% + :: 更新本地版本文件 + echo %latest_tag_name%>%local_tag_path%\local_tags.txt + goto :func_end + +:func_end +pause \ No newline at end of file diff --git a/install_maco_qt.bat b/install_maco_qt.bat new file mode 100644 index 0000000..af94b60 --- /dev/null +++ b/install_maco_qt.bat @@ -0,0 +1,69 @@ +@echo off +setlocal enabledelayedexpansion + +:: 设置Git仓库URL +set repo_url=http://chenyf123.top:1030/chenyf/fcma_qt_maco.git +set release_url=%repo_url%/releases/download +set download_file=app_data.zip +set local_tag_path=maco_qt_tag +:: app目录 +set target_dir=app + +:: 检查下是否有git命令 +where git >nul 2>nul +if %errorlevel% neq 0 ( + msg * "没有找到git命令,请安装git后再运行此脚本,请手动执行install_env.bat." + pause + exit +) + +if not exist %target_dir% mkdir %target_dir% + +if not exist %local_tag_path% mkdir %local_tag_path% + +set latest_tag_name= +:: 获取 Git 仓库的tag 列表 +git ls-remote --tags %repo_url% > %local_tag_path%\orign_tags.txt +:: 读取最新tag名称 +for /f "tokens=3 delims=/" %%i in (%local_tag_path%\orign_tags.txt) do set latest_tag_name=%%i + +echo latest_tag_name=%latest_tag_name% + +set local_tags= +:: 检查是否有本地版本文件 local_tags.txt +if exist %local_tag_path%\local_tags.txt ( + :: 读取本地版本文件中的tag信息 + set /p local_tags=<%local_tag_path%\local_tags.txt +) +echo local_tags=%local_tags% +::检查是否有新版本 +if "%local_tags%"=="" ( + :: 没有本地版本文件,直接拉取最新的release文件 + echo 没有本地版本文件,直接拉取最新的release文件 + goto :func_download_app +) else ( + :: 有本地版本文件,检查是否有新版本 + if "%local_tags%"=="%latest_tag_name%" ( + echo 本地版本已是最新版本 + goto :func_end + ) else ( + echo 有新版本,准备下载 + goto :func_clean_local_app + ) +) + +:func_clean_local_app + del /s /q %target_dir% +:func_download_app + echo download_url=%release_url%/%latest_tag_name%/%download_file% + curl -o %target_dir%\%download_file% -L %release_url%/%latest_tag_name%/%download_file% + :: 解压文件到app目录 + powershell -Command "Expand-Archive -Path %target_dir%/%download_file% -DestinationPath %target_dir%" + ::删除下载的zip文件 + del %target_dir%\%download_file% + :: 更新本地版本文件 + echo %latest_tag_name%>%local_tag_path%\local_tags.txt + goto :func_end + +:func_end +pause \ No newline at end of file