From f85647d894e1ee9840301da2181b6e3b09fff04e Mon Sep 17 00:00:00 2001 From: ngfchl Date: Thu, 25 Aug 2022 10:25:55 +0800 Subject: [PATCH] =?UTF-8?q?1.=20=E6=9B=B4=E6=96=B0=E5=90=AF=E5=8A=A8?= =?UTF-8?q?=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- start.sh | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/start.sh b/start.sh index 2940bdd..1d146dc 100644 --- a/start.sh +++ b/start.sh @@ -1,16 +1,20 @@ #!/bin/bash - CONTAINER_ALREADY_STARTED="CONTAINER_ALREADY_STARTED_PLACEHOLDER" if [ ! -e $CONTAINER_ALREADY_STARTED ]; then - touch $CONTAINER_ALREADY_STARTED echo "-- First container startup --" # 拉取文件 - git clone https://gitee.com/ngfchl/ptools && - # 进入文件夹 - cd ptools && + if [ ! -f ptools ]; then + + git clone https://gitee.com/ngfchl/ptools + fi + # 进入文件夹 + cd ptools && + git init && + git remote add origin https://gitee.com/ngfchl/ptools && # 设置拉取最新文件并覆盖 git config pull.ff only && + git pull && pip install -r requirements.txt && python manage.py makemigrations && python manage.py migrate && @@ -20,11 +24,12 @@ if [ ! -e $CONTAINER_ALREADY_STARTED ]; then DJANGO_SUPERUSER_USERNAME=$DJANGO_SUPERUSER_USERNAME \ DJANGO_SUPERUSER_EMAIL=$DJANGO_SUPERUSER_EMAIL \ DJANGO_SUPERUSER_PASSWORD=$DJANGO_SUPERUSER_PASSWORD \ - python manage.py createsuperuser --noinput + python manage.py createsuperuser --noinput && + touch $CONTAINER_ALREADY_STARTED else echo "-- Not first container startup --" cd ptools && - pip install -r requirements.txt + pip install -r requirements.txt if [ ! -f ./db/db.sqlite3 ]; then echo "-- 初始化数据库 init database --" # 如果数据库存在,就不执行