From 81f895ecce2c5e910c6456d6f9a76686f58a0265 Mon Sep 17 00:00:00 2001 From: xtaodada Date: Tue, 12 Dec 2023 20:51:22 +0800 Subject: [PATCH] :ambulance: Fix docker install lock --- pagermaid/update/v1402.py | 19 +++++++++++++++---- utils/docker-config.sh | 3 +++ 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/pagermaid/update/v1402.py b/pagermaid/update/v1402.py index 911f2f5..3b38d80 100644 --- a/pagermaid/update/v1402.py +++ b/pagermaid/update/v1402.py @@ -1,14 +1,25 @@ from pathlib import Path + +def rename(old: Path): + if old.exists(): + old_file_name = old.name + new = Path("data") / old_file_name + if new.exists(): + new.unlink() + old.rename(new) + + # move file # session session = Path("pagermaid.session") -if session.exists(): - session.rename("data/pagermaid.session") +rename(session) # config config = Path("config.yml") -if config.exists(): - config.rename("data/config.yml") +rename(config) +# docker +docker = Path("install.lock") +rename(docker) # delete file # log log = Path("pagermaid.log.txt") diff --git a/utils/docker-config.sh b/utils/docker-config.sh index 7a6fc60..024bfa3 100644 --- a/utils/docker-config.sh +++ b/utils/docker-config.sh @@ -57,6 +57,9 @@ login () { main () { cd /pagermaid/workdir || exit + if [ -f "/pagermaid/workdir/install.lock" ]; then + echo "Hello world!" > /pagermaid/workdir/data/install.lock + fi if [ ! -s "/pagermaid/workdir/data/install.lock" ]; then welcome configure