From 2a0efff6312f51de504b40e5ba355813bcba4ac6 Mon Sep 17 00:00:00 2001 From: Daniel Ortiz Date: Fri, 4 Jul 2025 21:12:54 -0400 Subject: [PATCH] reads TPOT_TYPE variable from .env, and copies the appropriate file from compose to docker-compose.yml --- update.sh | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/update.sh b/update.sh index a7155252..f4160137 100755 --- a/update.sh +++ b/update.sh @@ -18,6 +18,11 @@ myUPDATER=$(cat << "EOF" EOF ) +if [[ -n "$2" ]]; then + TPOT_TYPE=$2 + echo "[ $myGREEN"Starting update procedure ARGS for T-Pot $TPOT_TYPE ... "$myWHITE ]" +fi + # Check if running with root privileges if [ ${EUID} -eq 0 ]; then @@ -67,7 +72,13 @@ function fuSELFUPDATE () { echo "###### $myBLUE""Found newer version, will be pulling updates and restart myself.""$myWHITE" git reset --hard git pull --force - exec ./update.sh -y + + if [ -z "$TPOT_TYPE" ]; then + exec ./update.sh -y + else + exec ./update.sh -y $TPOT_TYPE + fi + exit 1 else echo "###### $myBLUE""Pulling updates from repository.""$myWHITE" @@ -210,16 +221,18 @@ function fuRESTORE () { } function fuGETTPOTTYPE () { - if [ -f .env ]; then - TPOT_TYPE=$(grep "^TPOT_TYPE=" .env | cut -d'=' -f2-) - if [ -z "$TPOT_TYPE" ]; then - echo "TPOT_TYPE is not set in .env file. Defaulting to 'HIVE'" + if [ -z "$TPOT_TYPE" ]; then + if [ -f .env ]; then + TPOT_TYPE=$(grep "^TPOT_TYPE=" .env | cut -d'=' -f2-) + if [ -z "$TPOT_TYPE" ]; then + echo "TPOT_TYPE is not set in .env file. Defaulting to 'HIVE'" + TPOT_TYPE=HIVE + fi + else TPOT_TYPE=HIVE fi - else - TPOT_TYPE=HIVE + echo "[ $myGREEN"Starting update procedure fuGETTPOTTYPE for T-Pot $TPOT_TYPE ... "$myWHITE ]" fi - echo "[ $myGREEN"Starting update procedure for T-Pot $TPOT_TYPE ... "$myWHITE ]" } ################ @@ -239,9 +252,11 @@ if [ "$1" != "-y" ]; then exit fi + + +fuGETTPOTTYPE fuCHECK_VERSION fuCHECKINET "https://index.docker.io https://github.com" -fuGETTPOTTYPE fuSTOP_TPOT fuBACKUP fuSELFUPDATE "$0" "$@"