From a75cf7efbe3e7a051d5bfb011c373f7eadea0d7c Mon Sep 17 00:00:00 2001 From: t3chn0m4g3 Date: Wed, 8 Aug 2018 15:02:56 +0000 Subject: [PATCH] begin working on update feature --- update.sh | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++++- version | 2 +- 2 files changed, 53 insertions(+), 2 deletions(-) diff --git a/update.sh b/update.sh index 17142512..69f26de7 100755 --- a/update.sh +++ b/update.sh @@ -12,6 +12,32 @@ myGREEN="" myWHITE="" myBLUE="" + +# Let's check for version +function fuCHECK_VERSION { +myMINVERSION="18.04.0" +myMASTERVERSION="18.04.0" +echo +echo -n "##### Checking for version tag: " +if [ -f "version" ]; + then + myVERSION=$(cat version) + echo "[ OK ] - You are running $myVERSION" + if [[ "$myVERSION" > "$myMINVERSION" || "$myVERSION" == "$myMINVERSION" ]] && [[ "$myVERSION" < "$myMASTERVERSION" || "$myVERSION" == "$myMASTERVERSION" ]] + then + echo "##### Valid version found. Update procedure will be initiated." + exit + else + echo "##### Your T-Pot installation cannot be upgraded automatically. Please run a fresh install." + exit + fi + else + echo "[ NOT OK ]" + echo "##### 'version' is missing. Please run 'update.sh' from within '/opt/tpot'." + exit + fi +} + # Got root? myWHOAMI=$(whoami) if [ "$myWHOAMI" != "root" ] @@ -89,11 +115,36 @@ function fuSELFUPDATE () { fi } +# Let's check for version +function fuCHECK_VERSION () { +local myMINVERSION="18.04.0" +local myMASTERVERSION="18.04.0" +echo +echo -n "##### Checking for version tag: " +if [ -f "version" ]; + then + myVERSION=$(cat version) + echo "[ OK ] - You are running $myVERSION" + if [[ "$myVERSION" > "$myMINVERSION" || "$myVERSION" == "$myMINVERSION" ]] && [[ "$myVERSION" < "$myMASTERVERSION" || "$myVERSION" == "$myMASTERVERSION" ]] + then + echo "##### Valid version found. Update procedure will be initiated." + exit + else + echo "##### Your T-Pot installation cannot be upgraded automatically. Please run a fresh install." + exit + fi + else + echo "[ NOT OK ]" + echo "##### 'version' is missing. Please run 'update.sh' from within '/opt/tpot'." + exit + fi +} + # Only run with command switch if [ "$1" != "-y" ]; then echo "This script will update / upgrade all T-Pot related scripts, tools and packages" echo "Some of your changes might be overwritten, so make sure to save your work" - echo "This feature is still experimental, run with \"-y\" switch" + echo "This is beta feature and only recommended for experienced users, run with \"-y\" switch" echo exit fi diff --git a/version b/version index 5036cb7c..3d19f6ac 100644 --- a/version +++ b/version @@ -1 +1 @@ -18.10.0 +18.04.0