From cf49be54e3d96e54fb0abafc37e3a3711bca93dc Mon Sep 17 00:00:00 2001 From: bWFuanVzYWth Date: Fri, 31 Mar 2023 22:49:45 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9Emakefile=EF=BC=8C=E5=8F=AF?= =?UTF-8?q?=E4=BB=A5=E8=87=AA=E5=8A=A8=E5=8C=96=E6=89=93=E5=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + Makefile | 11 +++++++++++ README.md | 46 +------------------------------------------- 双击更新蓝图仓库.bat | 29 +++++++++++----------------- 4 files changed, 24 insertions(+), 63 deletions(-) create mode 100644 Makefile diff --git a/.gitignore b/.gitignore index 554141e..66d03bc 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ MinGit/ +7-zip/ *.log diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..ef79fab --- /dev/null +++ b/Makefile @@ -0,0 +1,11 @@ +7Z = ./7-Zip/7z.exe +GIT = ./MinGit/cmd/git.exe + +FactoryBluePrints.7z: .git 双击更新蓝图仓库.bat MinGit/ 7-Zip/ + $(GIT) pull origin main + $(GIT) push origin main + $(GIT) gc --aggressive --prune=now + $(7Z) a -ms -mx=9 $@ $^ + +clear: + rm FactoryBluePrints.7z \ No newline at end of file diff --git a/README.md b/README.md index 39ffa6e..1a1f536 100644 --- a/README.md +++ b/README.md @@ -62,51 +62,7 @@ Just double click: `双击更新蓝图仓库.bat` > Q: 为什么我打不开蓝图仓库主页 / 下载特别慢 / 更新特别慢?
Why can't I open the homepage of the blueprint warehouse / the download is very slow / the update is very slow? > A: 通常是网络问题。蓝图仓库被托管在github上,可以通过在[Watt Toolkit](https://steampp.net)(原名steam++)中开启github加速服务解决。~~或者魔法?~~
-A: Usually a network problem. The blueprint warehouse is hosted on github, which can be resolved by enabling the github acceleration service in [Watt Toolkit](https://steampp.net) (formerly known as steam++). ~~ Or magic? ~~ - - +A: Usually a network problem. The blueprint warehouse is hosted on github, which can be resolved by enabling the github acceleration service in [Watt Toolkit](https://steampp.net) (formerly known as steam++). ~~Or magic?~~ --- diff --git a/双击更新蓝图仓库.bat b/双击更新蓝图仓库.bat index 6c2aeeb..ba9013a 100644 --- a/双击更新蓝图仓库.bat +++ b/双击更新蓝图仓库.bat @@ -9,6 +9,7 @@ echo ---->>%LOG_PATH% echo INF: %date% %time% Start>>%LOG_PATH% +::find git if exist ".\MinGit\cmd\git.exe" ( set GIT_PATH=.\MinGit\cmd\git.exe echo INF: %date% %time% GIT_PATH=MinGit>>%LOG_PATH% @@ -21,31 +22,23 @@ echo WAR: %date% %time% Git/MinGit no found>>%LOG_PATH% set GIT_PATH=git ) -if exist ".\.git" ( -echo INF: %date% %time% ".git" found>>%LOG_PATH% -goto git_init -) else ( -echo 警告:没有找到.git文件夹 | Warning: No .git folder found -echo WAR: %date% %time% ".git" no found>>%LOG_PATH% -goto git_no_init +::init +if not exist ".\.gitignore" ( +%GIT_PATH% reset --hard ) -:git_no_init -echo 正在尝试重建.git | Trying to rebuild .git -echo INF: %date% %time% ".git" init start>>%LOG_PATH% -%GIT_PATH% init -%GIT_PATH% branch -M main -%GIT_PATH% remote add origin https://github.com/DSPBluePrints/FactoryBluePrints.git -echo INF: %date% %time% ".git" init end>>%LOG_PATH% - -:git_init +::update echo INF: %date% %time% git pull start>>%LOG_PATH% git config core.longpaths true set GIT_SSL_NO_VERIFY=true %GIT_PATH% pull origin main -echo INF: %date% %time% git pull end>>%LOG_PATH% +set git_pull_errorlevel = %errorlevel% +echo INF: %date% %time% git pull exit: %git_pull_errorlevel%>>%LOG_PATH% +if %git_pull_errorlevel% NEQ 0( +echo 错误:更新失败,这通常是网络问题。请重试,或者开加速器再更新。详见README.md +) -:end +::end echo INF: %date% %time% Exit>>%LOG_PATH% pause exit