瀏覽代碼

fix chmod would fail if needed. (#3482)

Co-authored-by: copyrights <copyrights@mailbox.org>
copyrights 5 年之前
父節點
當前提交
dd833d40c6
共有 1 個文件被更改,包括 5 次插入4 次删除
  1. 5 4
      update.sh

+ 5 - 4
update.sh

@@ -459,11 +459,12 @@ elif [[ $(curl -sL -w "%{http_code}" https://www.servercow.de/docker-compose/lat
   LATEST_COMPOSE=$(curl -#L https://www.servercow.de/docker-compose/latest.php)
   COMPOSE_VERSION=$(docker-compose version --short)
   if [[ "$LATEST_COMPOSE" != "$COMPOSE_VERSION" ]]; then
-    if [[ -w $(which docker-compose) ]]; then
-      curl -#L https://github.com/docker/compose/releases/download/${LATEST_COMPOSE}/docker-compose-$(uname -s)-$(uname -m) > $(which docker-compose)
-      chmod +x $(which docker-compose)
+    COMPOSE_PATH=$(which docker-compose) 
+    if [[ -w ${COMPOSE_PATH} ]]; then
+      curl -#L https://github.com/docker/compose/releases/download/${LATEST_COMPOSE}/docker-compose-$(uname -s)-$(uname -m) > $COMPOSE_PATH
+      chmod +x $COMPOSE_PATH
     else
-      echo -e "\e[33mWARNING: $(which docker-compose) is not writable, but new version $LATEST_COMPOSE is available (installed: $COMPOSE_VERSION)\e[0m"
+      echo -e "\e[33mWARNING: $COMPOSE_PATH is not writable, but new version $LATEST_COMPOSE is available (installed: $COMPOSE_VERSION)\e[0m"
     fi
   fi
 else