1
0
mirror of https://github.com/DSPBluePrints/FactoryBluePrints.git synced 2025-12-08 19:53:27 +08:00

Add script for Linux

This commit is contained in:
x
2025-08-09 17:26:21 +08:00
parent cc8d1db089
commit e2462bdfec
2 changed files with 60 additions and 4 deletions

View File

@@ -1,9 +1,19 @@
RAR = "C:/Program Files/WinRAR/Rar.exe"
GIT = "C:/Program Files/Git/cmd/git.exe"
ifeq ($(OS),Windows_NT)
RAR := "C:/Program Files/WinRAR/Rar.exe"
GIT := "C:/Program Files/Git/cmd/git.exe"
PACKAGE_EXT := rar
PACKAGE_CMD = $(RAR) a -ma5 -md1024 -m5 -mt32 -htb -s -rr1p -QO+ $@ $^
PACKAGE_DEPS := .git update.bat README.md README_EN.md MinGit
else
GIT := git
PACKAGE_EXT := tar.gz
PACKAGE_CMD = tar -czf $@ $^
PACKAGE_DEPS := update.sh README.md README_EN.md
endif
FactoryBluePrints.rar: .git update.bat README.md README_EN.md MinGit
FactoryBluePrints.$(PACKAGE_EXT): $(PACKAGE_DEPS)
$(GIT) repack -a -d --window-memory=0 --depth=4095
$(RAR) a -ma5 -md1024 -m5 -mt32 -htb -s -rr1p -QO+ $@ $^
$(PACKAGE_CMD)
repack:
$(GIT) config core.compression 9
@@ -12,4 +22,8 @@ repack:
$(GIT) repack -a -d -f -F --window-memory=0 --depth=4095
clean:
ifeq ($(OS),Windows_NT)
rm *.rar
else
rm *.tar.gz
endif

42
update.sh Normal file
View File

@@ -0,0 +1,42 @@
#!/bin/bash
# This script is used to manually fetch blueprints from remote
LOG_PATH="update.log"
REMOTE_URI="git@github.com:DSPBluePrints/FactoryBluePrints.git"
cd "$(dirname "$0")"
# debug info
ls > $LOG_PATH
echo "----" >> $LOG_PATH
# test dir
if [ ! -d "../../Blueprint" ]; then
echo "$(date '+%x %X') Warning: Abnormal installation path" >> "$LOG_PATH"
echo "警告:您似乎安装到了错误的路径,这可能导致文件权限异常"
fi
# test git
# git should already be installed as a package
if git --version &> /dev/null; then
echo "$(date '+%x %X') Infomation: GIT_PATH=$(command -v git)"
else
echo "错误无法找到git"
echo "$(date '+%x %X') Error: git not found" >> "$LOG_PATH"
exit 1
fi
# find .git
if [ ! -d ".git" ]; then
echo "警告:无法找到.git"
echo "$(date '+%x %X') Warning: .git not found" >> "$LOG_PATH"
git init
git remote add origin $REMOTE_URI
fi
# force-reset
git remote set-url origin $REMOTE_URI
git fetch --all
git reset --hard origin/main
echo "$(date '+%x %X') Information : git reset --hard" >> "$LOG_PATH"
# git clean -fd