Forráskód Böngészése

fix: create default folders [skip ci]

Nicolas Meienberger 2 éve
szülő
commit
98c86e0bcf
3 módosított fájl, 14 hozzáadás és 1 törlés
  1. 6 0
      scripts/common.sh
  2. 0 1
      scripts/start.sh
  3. 8 0
      scripts/watcher.sh

+ 6 - 0
scripts/common.sh

@@ -55,6 +55,12 @@ function ensure_linux() {
 function clean_logs() {
     # Clean logs folder
     logs_folder="${ROOT_FOLDER}/logs"
+
+    # Create the folder if it doesn't exist
+    if [[ ! -d "${logs_folder}" ]]; then
+        mkdir "${logs_folder}"
+    fi
+
     if [ "$(find "${logs_folder}" -maxdepth 1 -type f | wc -l)" -gt 0 ]; then
         echo "Cleaning logs folder..."
 

+ 0 - 1
scripts/start.sh

@@ -103,7 +103,6 @@ fi
 kill_watcher
 # Configure Tipi
 "${ROOT_FOLDER}/scripts/configure.sh"
-chmod -R a+rwx "${ROOT_FOLDER}/state/events"
 chmod -R a+rwx "${ROOT_FOLDER}/state/system-info.json"
 "${ROOT_FOLDER}/scripts/watcher.sh" &
 

+ 8 - 0
scripts/watcher.sh

@@ -7,7 +7,15 @@ WATCH_FILE="${ROOT_FOLDER}/state/events"
 
 function clean_events() {
     echo "Cleaning events..."
+
+    # Create the file if it doesn't exist
+    if [[ ! -f "${WATCH_FILE}" ]]; then
+        touch "${WATCH_FILE}"
+    fi
+
     echo "" >"$WATCH_FILE"
+
+    chmod -R a+rwx "${ROOT_FOLDER}/state/events"
 }
 
 function set_status() {