From d790ab9b9cab40bbbfec336f754372bd744df712 Mon Sep 17 00:00:00 2001 From: Gallen Date: Mon, 18 Mar 2019 09:43:44 +0800 Subject: [PATCH] fix a bug when changing FS_PREFIX --- bin/docklet-master | 6 +++--- bin/docklet-supermaster | 6 +++--- bin/docklet-worker | 6 +++--- prepare.sh | 16 ++++++++++------ 4 files changed, 19 insertions(+), 15 deletions(-) diff --git a/bin/docklet-master b/bin/docklet-master index f516595..28ba55c 100755 --- a/bin/docklet-master +++ b/bin/docklet-master @@ -18,9 +18,6 @@ DOCKLET_USER=$DOCKLET_HOME/user # default working directory, default to /opt/docklet FS_PREFIX=/opt/docklet -RUN_DIR=$FS_PREFIX/local/run -LOG_DIR=$FS_PREFIX/local/log - #network interface , default is eth0 NETWORK_DEVICE=eth0 #etcd server address, default is localhost:2379 @@ -44,6 +41,9 @@ DISTRIBUTED_GATEWAY=False export FS_PREFIX +RUN_DIR=$FS_PREFIX/local/run +LOG_DIR=$FS_PREFIX/local/log + # This next line determines what user the script runs as. DAEMON_USER=root diff --git a/bin/docklet-supermaster b/bin/docklet-supermaster index 3934846..580ec5a 100755 --- a/bin/docklet-supermaster +++ b/bin/docklet-supermaster @@ -18,9 +18,6 @@ DOCKLET_USER=$DOCKLET_HOME/user # default working directory, default to /opt/docklet FS_PREFIX=/opt/docklet -RUN_DIR=$FS_PREFIX/local/run -LOG_DIR=$FS_PREFIX/local/log - #configurable-http-proxy public port, default is 8000 PROXY_PORT=8000 #configurable-http-proxy api port, default is 8001 @@ -43,6 +40,9 @@ BATCH_NET="10.16.0.0/16" export FS_PREFIX +RUN_DIR=$FS_PREFIX/local/run +LOG_DIR=$FS_PREFIX/local/log + # This next line determines what user the script runs as. DAEMON_USER=root diff --git a/bin/docklet-worker b/bin/docklet-worker index f7efb91..6fd96ff 100755 --- a/bin/docklet-worker +++ b/bin/docklet-worker @@ -28,13 +28,13 @@ PROXY_PORT=8000 PROXY_API_PORT=8001 DISTRIBUTED_GATEWAY=False -RUN_DIR=$FS_PREFIX/local/run -LOG_DIR=$FS_PREFIX/local/log - . $DOCKLET_CONF/docklet.conf export FS_PREFIX +RUN_DIR=$FS_PREFIX/local/run +LOG_DIR=$FS_PREFIX/local/log + # This next line determines what user the script runs as. DAEMON_USER=root diff --git a/prepare.sh b/prepare.sh index f58f006..2c5b5aa 100755 --- a/prepare.sh +++ b/prepare.sh @@ -54,15 +54,19 @@ echo "" [[ -f conf/docklet.conf ]] || { echo "Generating docklet.conf from template" && cp conf/docklet.conf.template conf/docklet.conf; } [[ -f web/templates/home.html ]] || { echo "Generating HomePage from home.template" && cp web/templates/home.template web/templates/home.html; } -mkdir -p /opt/docklet/global -mkdir -p /opt/docklet/local/ +FS_PREFIX=/opt/docklet +. conf/docklet.conf +export FS_PREFIX -echo "directory /opt/docklet have been created" +mkdir -p $FS_PREFIX/global +mkdir -p $FS_PREFIX/local/ -if [[ ! -d /opt/docklet/local/basefs && ! $1 = "withoutfs" ]]; then - mkdir -p /opt/docklet/local/basefs +echo "directory FS_PREFIX (${FS_PREFIX}) have been created" + +if [[ ! -d $FS_PREFIX/local/basefs && ! $1 = "withoutfs" ]]; then + mkdir -p $FS_PREFIX/local/basefs echo "Generating basefs" - wget -P /opt/docklet/local http://iwork.pku.edu.cn:1616/basefs-0.11.tar.bz2 && tar xvf /opt/docklet/local/basefs-0.11.tar.bz2 -C /opt/docklet/local/ > /dev/null + wget -P $FS_PREFIX/local http://iwork.pku.edu.cn:1616/basefs-0.11.tar.bz2 && tar xvf $FS_PREFIX/local/basefs-0.11.tar.bz2 -C $FS_PREFIX/local/ > /dev/null [ $? != "0" ] && echo "Generate basefs failed, please download it from http://unias.github.io/docklet/download to FS_PREFIX/local and then extract it using root. (defalut FS_PRERIX is /opt/docklet)" fi