mirror of
https://github.com/telekom-security/tpotce.git
synced 2025-04-19 21:52:27 +00:00
fixes for update.sh
This commit is contained in:
parent
a3e0c51493
commit
1e47497c30
1 changed files with 16 additions and 11 deletions
27
update.sh
27
update.sh
|
@ -8,20 +8,25 @@ myGREEN="[0;32m"
|
|||
myWHITE="[0;0m"
|
||||
myBLUE="[0;34m"
|
||||
|
||||
|
||||
# Check for existing tpot.yml
|
||||
function fuCONFIGCHECK () {
|
||||
echo "### Checking for T-Pot configuration file ..."
|
||||
echo -n "###### $myBLUE$myCONFIGFILE$myWHITE "
|
||||
if ! [ -f $myCONFIGFILE ];
|
||||
if ! [ -L $myCONFIGFILE ];
|
||||
then
|
||||
echo
|
||||
echo "[ $myRED""NOT OK""$myWHITE ] - No T-Pot configuration found."
|
||||
echo "Please create a link to your desired config i.e. 'ln -s /opt/tpot/etc/compose/standard.yml /opt/tpot/etc/tpot.yml'."
|
||||
echo
|
||||
exit 1
|
||||
echo -n "###### $myBLUE$myCONFIGFILE$myWHITE "
|
||||
myFILE=$(head -n 1 $myCONFIGFILE | tr -d "()" | tr [:upper:] [:lower:] | awk '{ print $3 }')
|
||||
myFILE+=".yml"
|
||||
echo "[ $myRED""NOT OK""$myWHITE ] - Broken symlink, trying to reset to '$myFILE'."
|
||||
rm -rf $myCONFIGFILE
|
||||
ln -s $myCOMPOSEPATH/$myFILE $myCONFIGFILE
|
||||
fi
|
||||
if [ -L $myCONFIGFILE ];
|
||||
then
|
||||
echo "###### $myBLUE$myCONFIGFILE$myWHITE [ $myGREEN""OK""$myWHITE ]"
|
||||
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
|
||||
echo
|
||||
}
|
||||
|
@ -257,10 +262,10 @@ echo "### All objects will be overwritten upon import, make sure to run an expor
|
|||
}
|
||||
|
||||
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 "### 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
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue