Skip to content

Commit 3ca8504

Browse files
authored
Merge pull request #20 from sanshu-rom/main
定义map定制备份恢复
2 parents 8c51d25 + 406c44f commit 3ca8504

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

Diff for: autorun.sh

+29
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,18 @@ backup_files_and_cookie_auth_code() {
371371
echo -e "${RED}备份.env文件失败。${NC}"
372372
exit 1
373373
fi
374+
375+
# 备份map.txt文件
376+
local map_txt_path="$REPO_DIR/$PROJECT_NAME/config/map.txt"
377+
local map_txt_backup_file="map.txt.backup_$(date +%Y%m%d)"
378+
echo -e "${YELLOW}正在备份map.txt文件...${NC}"
379+
cp "$map_txt_path" "./$map_txt_backup_file"
380+
if [ $? -eq 0 ]; then
381+
echo -e "${GREEN}map.txt文件已备份为 $map_txt_backup_file${NC}"
382+
else
383+
echo -e "${RED}备份map.txt文件失败。${NC}"
384+
exit 1
385+
fi
374386
}
375387

376388
# 定义恢复函数
@@ -408,6 +420,23 @@ restore_env_json_and_cookie_auth_code() {
408420
echo -e "${RED}备份文件 $env_backup_file 不存在,无法恢复.env文件。${NC}"
409421
exit 1
410422
fi
423+
424+
# 恢复map.txt文件
425+
local map_txt_backup_file="map.txt.backup_$(date +%Y%m%d)"
426+
if [ -f "./$map_txt_backup_file" ]; then
427+
echo -e "${YELLOW}正在恢复map.txt文件...${NC}"
428+
cp "./$map_txt_backup_file" "$REPO_DIR/$PROJECT_NAME/config/map.txt"
429+
if [ $? -eq 0 ]; then
430+
echo -e "${GREEN}map.txt文件已恢复。${NC}"
431+
rm "./$map_txt_backup_file" # 删除备份文件
432+
else
433+
echo -e "${RED}恢复map.txt文件失败。${NC}"
434+
exit 1
435+
fi
436+
else
437+
echo -e "${RED}备份文件 $map_txt_backup_file 不存在,无法恢复map.txt文件。${NC}"
438+
exit 1
439+
fi
411440
}
412441

413442
# 尝试次数限制,避免无限循环

0 commit comments

Comments
 (0)