begin working on update feature

This commit is contained in:
t3chn0m4g3 2018-08-08 15:02:56 +00:00
parent f6a30dd973
commit a75cf7efbe
2 changed files with 53 additions and 2 deletions

View file

@ -12,6 +12,32 @@ myGREEN=""
myWHITE="" myWHITE=""
myBLUE="" 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? # Got root?
myWHOAMI=$(whoami) myWHOAMI=$(whoami)
if [ "$myWHOAMI" != "root" ] if [ "$myWHOAMI" != "root" ]
@ -89,11 +115,36 @@ function fuSELFUPDATE () {
fi 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 # Only run with command switch
if [ "$1" != "-y" ]; then if [ "$1" != "-y" ]; then
echo "This script will update / upgrade all T-Pot related scripts, tools and packages" 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 "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 echo
exit exit
fi fi

View file

@ -1 +1 @@
18.10.0 18.04.0