From 28cd4ef8b8812937fcd1976e00142d6c15b8e7e7 Mon Sep 17 00:00:00 2001 From: Masco Skray Date: Tue, 16 Jul 2019 10:43:02 +0800 Subject: [PATCH] style(web,install): set repo clone dir as work dir Clone repository files to /opt, and make this as work dir. Can save disk space, make folder tidy, and easy to access. --- install/bundle/Dockerfile | 8 ++++---- install/bundle/install.sh | 16 ++++++++-------- web/app/controllers/download.php | 2 +- web/app/libs/uoj-judger-lib.php | 2 +- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/install/bundle/Dockerfile b/install/bundle/Dockerfile index 3dac1e1..bd3e975 100644 --- a/install/bundle/Dockerfile +++ b/install/bundle/Dockerfile @@ -6,18 +6,18 @@ WORKDIR /opt #Update apt and install git RUN apt-get update && apt-get install -y git #Clone the latest UOJ Community verison to local -RUN git clone https://github.com/UniversalOJ/UOJ-System.git --depth 1 --single-branch ${CLONE_ADDFLAG} +RUN git clone https://github.com/UniversalOJ/UOJ-System.git --depth 1 --single-branch ${CLONE_ADDFLAG} uoj #Install environment and set startup script -RUN cd UOJ-System/install/bundle && sh install.sh -p && echo "\ +RUN cd uoj/install/bundle && sh install.sh -p && echo "\ #!/bin/sh\n\ chown -R mysql:mysql /var/lib/mysql /var/run/mysqld\n\ if [ ! -f \"/var/uoj_data/.UOJSetupDone\" ]; then\n\ - cd /opt/UOJ-System/install/bundle && sh install.sh -i\n\ + cd /opt/uoj/install/bundle && sh install.sh -i\n\ fi\n\ service ntp start\n\ service mysql start\n\ service apache2 start\n\ -su local_main_judger -c \"/opt/UOJ-System/judger/judge_client start\"\n\ +su local_main_judger -c \"/opt/uoj/judger/judge_client start\"\n\ exec bash\n" >/opt/up && chmod +x /opt/up ENV LANG=C.UTF-8 TZ=Asia/Shanghai diff --git a/install/bundle/install.sh b/install/bundle/install.sh index 9b6c81e..654077b 100644 --- a/install/bundle/install.sh +++ b/install/bundle/install.sh @@ -39,7 +39,7 @@ setLAMPConf(){ XSendFile On XSendFilePath /var/uoj_data XSendFilePath /var/www/uoj/app/storage - XSendFilePath /opt/UOJ-System/judger/uoj_judger/include + XSendFilePath /opt/uoj/judger/uoj_judger/include UOJEOF #Enable modules and make UOJ site conf enabled @@ -65,7 +65,7 @@ UOJEOF setWebConf(){ printf "\n\n==> Setting web files\n" #Set webroot path - ln -sf /opt/UOJ-System/web /var/www/uoj + ln -sf /opt/uoj/web /var/www/uoj chown -R www-data /var/www/uoj/app/storage #Set web config file php -a <uoj_judger/include/uoj_work_path.h < Doing initial config and start service\n" #Replace password placeholders - sed -i -e "s/_main_judger_password_/$_main_judger_password_/g" -e "s/_judger_socket_password_/$_judger_socket_password_/g" /opt/UOJ-System/judger/.conf.json + sed -i -e "s/_main_judger_password_/$_main_judger_password_/g" -e "s/_judger_socket_password_/$_judger_socket_password_/g" /opt/uoj/judger/.conf.json sed -i -e "s/salt0/$(genRandStr 32)/g" -e "s/salt1/$(genRandStr 16)/g" -e "s/salt2/$(genRandStr 16)/g" -e "s/salt3/$(genRandStr 16)/g" -e "s/_judger_socket_password_/$_judger_socket_password_/g" /var/www/uoj/app/.config.php #Import judge_client to MySQL database service mysql start @@ -127,7 +127,7 @@ initProgress(){ service ntp restart service mysql restart service apache2 restart - su local_main_judger -c '/opt/UOJ-System/judger/judge_client start' + su local_main_judger -c '/opt/uoj/judger/judge_client start' #Touch SetupDone flag file touch /var/uoj_data/.UOJSetupDone printf "\n\n***Installation complete. Enjoy!***\n" diff --git a/web/app/controllers/download.php b/web/app/controllers/download.php index 1b1bef4..7d735fe 100644 --- a/web/app/controllers/download.php +++ b/web/app/controllers/download.php @@ -27,7 +27,7 @@ $download_name = "problem_$id.zip"; break; case 'testlib.h': - $file_name = "/opt/UOJ-System/judger/uoj_judger/include/testlib.h"; + $file_name = "/opt/uoj/judger/uoj_judger/include/testlib.h"; $download_name = "testlib.h"; break; default: diff --git a/web/app/libs/uoj-judger-lib.php b/web/app/libs/uoj-judger-lib.php index 931a4be..c86f26f 100644 --- a/web/app/libs/uoj-judger-lib.php +++ b/web/app/libs/uoj-judger-lib.php @@ -1,7 +1,7 @@