From 56d5ada887395156863e91e2db30e444186968d2 Mon Sep 17 00:00:00 2001 From: TD-er Date: Tue, 11 May 2021 20:03:04 +0200 Subject: [PATCH] [Linux Build] Add some checks to prevent wiping ALL data on PC See [the forum](https://www.letscontrolit.com/forum/viewtopic.php?f=6&t=8542) of what terrible things may happen if `mktemp` is not installed on the system. --- before_deploy | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/before_deploy b/before_deploy index 26caaf7b6..5eb070495 100755 --- a/before_deploy +++ b/before_deploy @@ -1,7 +1,26 @@ #!/bin/bash VERSION=$(git describe) -TMP_DIST=`mktemp -d` +TMP_DIR=`mktemp -d` +if [ $? -eq 0 ]; then + # Make sure coreutils is installed. + # if not, these terrible things may happen: + # https://www.letscontrolit.com/forum/viewtopic.php?f=6&t=8542 + echo "Created ${TMP_DIR}" +else + echo "Could not create tmp dir, mktemp -d failed" + exit 1 +fi + +TMP_DIST=`echo "${TMP_DIR}/ESPEasy_collect_dist"` +mkdir -p ${TMP_DIST} +if [ $? -eq 0 ]; then + echo "Created ${TMP_DIST}" +else + echo "Could not create tmp dir: ${TMP_DIST}" + exit 1 +fi + CURPATH=`pwd` BUILD_LOG=`echo "${TMP_DIST}/buildlog.txt"`