From 21058b0f3ddecb7f52a01b79b3679956b882dd07 Mon Sep 17 00:00:00 2001 From: xiagw Date: Mon, 17 Jul 2023 12:57:42 +0800 Subject: [PATCH] fix old dir of showdoc_data --- docker-compose.yml | 2 ++ docker.run.sh | 11 ++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 048c53ddc..fa8f4f413 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -20,6 +20,8 @@ services: ports: - 4999:80 volumes: + ## 兼容历史版本文件 + - /showdoc_data:/showdoc_data_old - ./showdocdata/html:/var/www/html restart: always tty: true diff --git a/docker.run.sh b/docker.run.sh index 35356ba05..1e18f40aa 100644 --- a/docker.run.sh +++ b/docker.run.sh @@ -4,6 +4,8 @@ set -e ## web site dir showdoc_dir='/showdoc_data' +showdoc_dir_old='/showdoc_data_old' +showdoc_dir_old_skip='/showdoc_data_old/.skip_old' showdoc_html_dir="$showdoc_dir/html" web_dir='/var/www/html' file_ver=$web_dir/.ver @@ -14,7 +16,14 @@ if [ -f "$web_dir/index.php" ]; then echo "Found $web_dir/index.php, skip copy." else echo "Not found $web_dir/index.php, copy..." - rsync -a $showdoc_html_dir/ $web_dir/ + ## 兼容历史版本 + if [[ -f $showdoc_dir_old/html/index.php && ! -f $showdoc_dir_old_skip ]]; then + echo "Found old version of \"showdoc_data\", copy..." + rsync -a $showdoc_dir_old/html/ $web_dir/ && + touch $showdoc_dir_old_skip + else + rsync -a $showdoc_html_dir/ $web_dir/ + fi fi ## upgrade (通过 Dockerfile 的环境变量 变更版本) if [ -f $file_ver ]; then