Option to reinstall mariadb from control panel

This commit is contained in:
Bob Mottram 2016-07-25 19:46:32 +01:00
parent 87ba25a322
commit 4f8e79902e
2 changed files with 42 additions and 15 deletions

View File

@ -1783,6 +1783,24 @@ function hotspot_settings {
--msgbox $"Hotspot settings were changed" 6 40
}
function reinstall_mariadb {
dialog --title $"Reinstall MariaDB" \
--backtitle $"Freedombone Control Panel" \
--defaultno \
--yesno $"\nThis should be a LAST RESORT, if the mysql daemon won't start. You will lose ALL databases and will then need to restore them from backup.\n\nAre you sure that you wish to continue?" 12 60
sel=$?
case $sel in
1) return;;
255) return;;
esac
clear
database_reinstall
dialog --title $"Reinstall MariaDB" \
--msgbox $"MariaDB has been reinstalled" 6 40
}
function menu_backup_restore {
while true
do
@ -1790,17 +1808,18 @@ function menu_backup_restore {
trap "rm -f $data" 0 1 2 5 15
dialog --backtitle $"Freedombone Control Panel" \
--title $"Backup and Restore" \
--radiolist $"Choose an operation:" 18 70 11 \
--radiolist $"Choose an operation:" 19 70 12 \
1 $"Backup data to USB drive" off \
2 $"Restore GPG key from USB keydrive" off \
3 $"Restore data from USB drive" off \
4 $"Configure remote backups" off \
5 $"Restore from remote backup" off \
6 $"Backup GPG key to USB (master keydrive)" off \
7 $"Backup GPG key to USB (fragment keydrive)" off \
8 $"Format a USB drive (LUKS encrypted)" off \
9 $"Remove backups from a USB drive" off \
10 $"Back to main menu" on 2> $data
4 $"Reinstall mariadb" off \
5 $"Configure remote backups" off \
6 $"Restore from remote backup" off \
7 $"Backup GPG key to USB (master keydrive)" off \
8 $"Backup GPG key to USB (fragment keydrive)" off \
9 $"Format a USB drive (LUKS encrypted)" off \
10 $"Remove backups from a USB drive" off \
11 $"Back to main menu" on 2> $data
sel=$?
case $sel in
1) break;;
@ -1810,13 +1829,14 @@ function menu_backup_restore {
1) backup_data;;
2) restore_gpg_key;;
3) restore_data;;
4) configure_remote_backups;;
5) restore_data_remote;;
6) create_keydrive_master;;
7) create_keydrive_fragment;;
8) format_drive;;
9) remove_backups;;
10) break;;
4) reinstall_mariadb;;
5) configure_remote_backups;;
6) restore_data_remote;;
7) create_keydrive_master;;
8) create_keydrive_fragment;;
9) format_drive;;
10) remove_backups;;
11) break;;
esac
done
}

View File

@ -327,4 +327,11 @@ function drop_database {
mysqladmin -uroot -p"$MARIADB_PASSWORD" -f drop $database_name
}
function database_reinstall {
apt-get -y purge mariadb*
rm -rf /var/lib/mysql
rm -rf /etc/mysql
apt-get -y install mariadb-server
}
# NOTE: deliberately there is no "exit 0"