Browse Source

[Update] Make some pathes more fail-safe and minor wording changes

andryyy 3 years ago
parent
commit
0c3500f5ff
1 changed files with 5 additions and 5 deletions
  1. 5 5
      update.sh

+ 5 - 5
update.sh

@@ -46,7 +46,7 @@ done
 
 
 export LC_ALL=C
 export LC_ALL=C
 DATE=$(date +%Y-%m-%d_%H_%M_%S)
 DATE=$(date +%Y-%m-%d_%H_%M_%S)
-BRANCH=$(git rev-parse --abbrev-ref HEAD)
+BRANCH=$(cd ${SCRIPT_DIR}; git rev-parse --abbrev-ref HEAD)
 
 
 check_online_status() {
 check_online_status() {
   CHECK_ONLINE_IPS=(1.1.1.1 9.9.9.9 8.8.8.8)
   CHECK_ONLINE_IPS=(1.1.1.1 9.9.9.9 8.8.8.8)
@@ -79,7 +79,7 @@ prefetch_images() {
 
 
 docker_garbage() {
 docker_garbage() {
   IMGS_TO_DELETE=()
   IMGS_TO_DELETE=()
-  for container in $(grep -oP "image: \Kmailcow.+" docker-compose.yml); do
+  for container in $(grep -oP "image: \Kmailcow.+" "${SCRIPT_DIR}/docker-compose.yml"); do
     REPOSITORY=${container/:*}
     REPOSITORY=${container/:*}
     TAG=${container/*:}
     TAG=${container/*:}
     V_MAIN=${container/*.}
     V_MAIN=${container/*.}
@@ -121,9 +121,9 @@ docker_garbage() {
       echo "Running image removal without extra confirmation due to force mode."
       echo "Running image removal without extra confirmation due to force mode."
       docker rmi ${IMGS_TO_DELETE[*]}
       docker rmi ${IMGS_TO_DELETE[*]}
     fi
     fi
+    echo -e "\e[32mFurther cleanup...\e[0m"
+    echo "If you want to cleanup further garbage collected by Docker, please make sure all containers are up and running before cleaning your system by executing \"docker system prune\""
   fi
   fi
-  echo -e "\e[32mFurther cleanup...\e[0m"
-  echo "If you want to cleanup further garbage collected by Docker, please make sure all containers are up and running before cleaning your system by executing \"docker system prune\""
 }
 }
 
 
 in_array() {
 in_array() {
@@ -232,7 +232,7 @@ while (($#)); do
       exit 0
       exit 0
     ;;
     ;;
     -f|--force)
     -f|--force)
-      echo -e "\e[32mForcing Update...\e[0m"
+      echo -e "\e[32mRunning in forced mode...\e[0m"
       FORCE=y
       FORCE=y
     ;;
     ;;
     --no-update-compose)
     --no-update-compose)