migrate_roundcube.sh 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #!/bin/bash
  2. # info: Disconnect PHPmyadmin from APT and solving issues with PHPMyadmin accidental updates from ATP
  3. #----------------------------------------------------------#
  4. # Variable&Function #
  5. #----------------------------------------------------------#
  6. # Includes
  7. source $HESTIA/func/main.sh
  8. # get current phpmyadmin version
  9. source $HESTIA/install/upgrade/upgrade.conf
  10. source $HESTIA/conf/hestia.conf
  11. #----------------------------------------------------------#
  12. # Verifications #
  13. #----------------------------------------------------------#
  14. if [ ! -d "/usr/share/phpmyadmin/" ]; then
  15. echo "Install Roundcube not done via APT"
  16. exit 2;
  17. fi
  18. echo "For deleting Roudcube you will need confirm the removal with root password. Password can be found in /usr/local/hestia/conf/mysql.conf"
  19. read -p "Please enter Y to continue" -n 1 -r
  20. echo # (optional) move to a new line
  21. if [[ $REPLY =~ ^[Yy]$ ]]
  22. then
  23. version=$(cat /usr/share/roundcube/index.php | grep -o -E '[0-9].[0-9].[0-9]+' | head -1);
  24. # Backup database
  25. echo "SET FOREIGN_KEY_CHECKS = 0;" >> ~/roundcube.sql
  26. mysqldump --add-drop-table roundcube >> ~/roundcube.sql
  27. echo "SET FOREIGN_KEY_CHECKS = 1;" >> ~/roundcube.sql
  28. echo '[ * ] Remove Roundcube via ATP'
  29. apt-get autoremove roundcube-core roundcube-mysql roundcube-plugins
  30. echo '[ * ] Delete possible trail'
  31. # make sure everything is deleted
  32. rm -f -r /usr/share/roundcube
  33. rm -f -r /etc/roundcube
  34. rm -f -r /var/lib/roundcube/
  35. # Install roundcube
  36. $HESTIA/bin/v-add-sys-roundcube
  37. # restore backup
  38. mysql roundcube < ~/roundcube.sql
  39. /var/lib/roundcube/bin/update.sh --version "$version"
  40. fi