fixes for update.sh

This commit is contained in:
t3chn0m4g3 2020-01-28 17:52:44 +00:00
parent a3e0c51493
commit 1e47497c30

View file

@ -8,20 +8,25 @@ myGREEN=""
myWHITE="" myWHITE=""
myBLUE="" myBLUE=""
# Check for existing tpot.yml # Check for existing tpot.yml
function fuCONFIGCHECK () { function fuCONFIGCHECK () {
echo "### Checking for T-Pot configuration file ..." echo "### Checking for T-Pot configuration file ..."
echo -n "###### $myBLUE$myCONFIGFILE$myWHITE " if ! [ -L $myCONFIGFILE ];
if ! [ -f $myCONFIGFILE ];
then then
echo echo -n "###### $myBLUE$myCONFIGFILE$myWHITE "
echo "[ $myRED""NOT OK""$myWHITE ] - No T-Pot configuration found." myFILE=$(head -n 1 $myCONFIGFILE | tr -d "()" | tr [:upper:] [:lower:] | awk '{ print $3 }')
echo "Please create a link to your desired config i.e. 'ln -s /opt/tpot/etc/compose/standard.yml /opt/tpot/etc/tpot.yml'." myFILE+=".yml"
echo echo "[ $myRED""NOT OK""$myWHITE ] - Broken symlink, trying to reset to '$myFILE'."
exit 1 rm -rf $myCONFIGFILE
ln -s $myCOMPOSEPATH/$myFILE $myCONFIGFILE
fi
if [ -L $myCONFIGFILE ];
then
echo "###### $myBLUE$myCONFIGFILE$myWHITE [ $myGREEN""OK""$myWHITE ]"
else else
echo "[ $myGREEN""OK""$myWHITE ]" echo "[ $myRED""NOT OK""$myWHITE ] - Broken symlink and / or restore failed."
echo "Please create a link to your desired config i.e. 'ln -s /opt/tpot/etc/compose/standard.yml /opt/tpot/etc/tpot.yml'."
exit
fi fi
echo echo
} }
@ -257,10 +262,10 @@ echo "### All objects will be overwritten upon import, make sure to run an expor
} }
function fuRESTORE_EWSCFG () { function fuRESTORE_EWSCFG () {
if [ -f '/data/ews/conf/ews.cfg' ] && ! grep 'ews.cfg' /opt/tpot/etc/tpot.yml > /dev/null; then if [ -f '/data/ews/conf/ews.cfg' ] && ! grep 'ews.cfg' $myCONFIGFILE > /dev/null; then
echo echo
echo "### Restoring volume mount for ews.cfg in tpot.yml" echo "### Restoring volume mount for ews.cfg in tpot.yml"
sed -i '/\/opt\/ewsposter\/ews.ip/a\\ \ \ \ \ - /data/ews/conf/ews.cfg:/opt/ewsposter/ews.cfg' /opt/tpot/etc/tpot.yml sed -i --follow-symlinks '/\/opt\/ewsposter\/ews.ip/a\\ \ \ \ \ - /data/ews/conf/ews.cfg:/opt/ewsposter/ews.cfg' $myCONFIGFILE
fi fi
} }