From d4c6a85b4fa9e290a3312db34dda178a25ee10a3 Mon Sep 17 00:00:00 2001 From: Florian Date: Sat, 25 Mar 2017 00:13:14 +0100 Subject: [PATCH] Check for old installation / copy config - check for old version (existing boswatch.py in two different folders) and copy it via /tmp to boswatchpath/old - copy config.template.ini to config.ini to enable boswatch starting after installation --- install.sh | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/install.sh b/install.sh index 71b5b93..5c251ea 100644 --- a/install.sh +++ b/install.sh @@ -45,6 +45,27 @@ echo "So you have to make up manually if you want to use MySQL support" boswatchpath=/opt/boswatch reboot=false +didBackup=false + +# check for old version (for the old ones...) +if [ -f $boswatchpath/BOSWatch/boswatch.py ]; then + echo "Old installation found!" + echo "A backup will be copied to $boswatchpath/old" + + mkdir /tmp/boswatch + mv $boswatchpath/BOSWatch/* /tmp/boswatch/ + didBackup=true +fi + +#and the future... +if [ -f $boswatchpath/boswatch.py ]; then + echo "Old installation found!" + echo "A backup will be copied to $boswatchpath/old" + + mkdir /tmp/boswatch + mv $boswatchpath/* /tmp/boswatch/ + didBackup=true +fi for (( i=1; i<=$#; i=$i+2 )); do t=$((i + 1)) @@ -206,6 +227,16 @@ rm $boswatchpath/install/ -R mv $boswatchpath/BOSWatch/* $boswatchpath/ rm $boswatchpath/BOSWatch -R +#copy the template config to run boswatch +cp $boswatchpath/config/config.template.ini $boswatchpath/config/config.ini + + +#replay the backup +if [ $didBackup = "true" ]; then + mkdir $boswatchpath/old/ + mv /tmp/boswatch/* $boswatchpath/old/ +fi + if [ $reboot = "true" ]; then /sbin/reboot fi