This commit is contained in:
Andre
2020-01-05 03:05:13 +01:00
parent d5a1bda9b4
commit 27b6c93a17

View File

@@ -100,8 +100,7 @@ echo "----- Step 2 of 5: Detecting ioBroker installation -----"
echo "$(printf -- '-%.0s' {1..60})" echo "$(printf -- '-%.0s' {1..60})"
echo ' ' echo ' '
files=(/opt/iobroker/*) if [ `ls -1a|wc -l` -lt 1 ]
if [ ${#files[@]} -lt 1 ]
then then
echo "There is no data detected in /opt/iobroker. Restoring initial ioBroker installation..." echo "There is no data detected in /opt/iobroker. Restoring initial ioBroker installation..."
tar -xf /opt/initial_iobroker.tar -C / tar -xf /opt/initial_iobroker.tar -C /
@@ -109,24 +108,21 @@ then
elif [ -f /opt/iobroker/iobroker ] elif [ -f /opt/iobroker/iobroker ]
then then
echo "Existing installation of ioBroker detected in /opt/iobroker." echo "Existing installation of ioBroker detected in /opt/iobroker."
elif [ ${#files[@]} -lt 2 ] elif [ -f /opt/iobroker/*.tar.gz ] && [ tar -ztvf /opt/iobroker/*.tar.gz "backup/backup.json" &> /dev/null ] #ACTUALLY BROKEN!!!
then then
if tar -ztvf /opt/iobroker/*.tar.gz "backup/backup.json" &> /dev/null echo "ioBroker backup file detected in /opt/iobroker. Restoring ioBroker..."
then mv /opt/iobroker/*.tar.gz /opt/
echo "ioBroker backup file detected in /opt/iobroker. Restoring ioBroker..." tar -xf /opt/initial_iobroker.tar -C /
mv /opt/iobroker/iobroker_20*.tar.gz /opt/ mkdir /opt/iobroker/backups
tar -xf /opt/initial_iobroker.tar -C / mv /opt/*.tar.gz /opt/iobroker/backups/
mkdir /opt/iobroker/backups iobroker restore 0
mv /opt/iobroker_20*.tar.gz /opt/iobroker/backups/ echo "Done."
iobroker restore 0 echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
echo "Done." echo "!!!!! Please note: The sartup script restored iobroker from a backup file. !!!!!"
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" echo "!!!!! When ioBroker will be started it will reinstall all Adapters automatically. !!!!!"
echo "!!!!! Please note: The sartup script restored iobroker from a backup file. !!!!!" echo "!!!!! This might be take a looooong time! Please be patient! !!!!!"
echo "!!!!! When ioBroker will be started it will reinstall all Adapters automatically. !!!!!" echo "!!!!! You can view installation process by taking a look at ioBroker log. !!!!!"
echo "!!!!! This might be take a looooong time! Please be patient! !!!!!" echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
echo "!!!!! You can view installation process by taking a look at ioBroker log. !!!!!"
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
fi
else else
echo "There is data detected in /opt/iobroker but it looks like it is no instance of iobroker or a valid backup file!" echo "There is data detected in /opt/iobroker but it looks like it is no instance of iobroker or a valid backup file!"
echo "Please check/ recreate mounted folder/ volume and restart ioBroker container." echo "Please check/ recreate mounted folder/ volume and restart ioBroker container."