Choose an application to restore

This commit is contained in:
Bob Mottram 2015-12-18 14:27:51 +00:00
parent 178b0029fd
commit 315423a88e
1 changed files with 88 additions and 2 deletions

View File

@ -40,6 +40,18 @@ ADMIN_USER=
UPGRADE_SCRIPT_NAME="${PROJECT_NAME}-upgrade"
UPDATE_DATE_SCRIPT=/usr/bin/updatedate
USB_DRIVE=sdb
# get default USB from config file
CONFIG_FILE=$HOME/${PROJECT_NAME}.cfg
if [ -f $CONFIG_FILE ]; then
if grep -q "USB_DRIVE=" $CONFIG_FILE; then
USB_DRIVE=$(cat $CONFIG_FILE | grep "USB_DRIVE=" | awk -F '=' '{print $2}')
if [[ $USB_DRIVE == *"dev"* ]]; then
USB_DRIVE=$(echo ${USB_DRIVE} | awk -F '/' '{print $3}' | sed 's|1||g' | sed 's|2||g')
fi
fi
fi
function any_key {
echo ' '
read -n1 -r -p $"Press any key to continue..." key
@ -469,14 +481,88 @@ function backup_data {
any_key
}
function restore_from_usb {
while true
do
data=$(tempfile 2>/dev/null)
trap "rm -f $data" 0 1 2 5 15
dialog --backtitle $"Freedombone Control Panel" \
--title $"Restore from USB backup" \
--radiolist $"Choose an application to restore:" 30 70 27 \
1 $"Everything" on \
2 $"Return to the backup and restore menu" off \
3 $"Configuration files" off \
4 $"MariaDB settings" off \
5 $"Let's Encrypt account" off \
6 $"Mutt email client settings" off \
7 $"GPG keys" off \
8 $"Email processing rules" off \
9 $"Spam filtering rules" off \
10 $"Administrator's README file" off \
11 $"IPFS" off \
12 $"SSH keys" off \
13 $"User configuration files" off \
14 $"SSL/TLS certificates" off \
15 $"Personal settings" off \
16 $"Mailing List" off \
17 $"XMPP chat" off \
18 $"GNU Social" off \
19 $"Hubzilla" off \
20 $"Owncloud" off \
21 $"Gogs" off \
22 $"Wiki" off \
23 $"Blog" off \
24 $"CJDNS" off \
25 $"Email" off \
26 $"DLNA" off \
27 $"VoIP" off \
28 $"Tox" off 2> $data
sel=$?
case $sel in
1) break;;
255) break;;
esac
case $(cat $data) in
1) freedombone-restore-local $USB_DRIVE;;
2) return;;
3) freedombone-restore-local $USB_DRIVE configuration;;
4) freedombone-restore-local $USB_DRIVE mariadb;;
5) freedombone-restore-local $USB_DRIVE letsencrypt;;
6) freedombone-restore-local $USB_DRIVE mutt;;
7) freedombone-restore-local $USB_DRIVE gpg;;
8) freedombone-restore-local $USB_DRIVE procmail;;
9) freedombone-restore-local $USB_DRIVE spamassassin;;
10) freedombone-restore-local $USB_DRIVE readme;;
11) freedombone-restore-local $USB_DRIVE ipfs;;
12) freedombone-restore-local $USB_DRIVE ssh;;
13) freedombone-restore-local $USB_DRIVE userconfig;;
14) freedombone-restore-local $USB_DRIVE certs;;
15) freedombone-restore-local $USB_DRIVE personal;;
16) freedombone-restore-local $USB_DRIVE mailinglist;;
17) freedombone-restore-local $USB_DRIVE xmpp;;
18) freedombone-restore-local $USB_DRIVE gnusocial;;
19) freedombone-restore-local $USB_DRIVE hubzilla;;
20) freedombone-restore-local $USB_DRIVE owncloud;;
21) freedombone-restore-local $USB_DRIVE gogs;;
22) freedombone-restore-local $USB_DRIVE wiki;;
23) freedombone-restore-local $USB_DRIVE blog;;
24) freedombone-restore-local $USB_DRIVE cjdns;;
25) freedombone-restore-local $USB_DRIVE email;;
26) freedombone-restore-local $USB_DRIVE dlna;;
27) freedombone-restore-local $USB_DRIVE voip;;
28) freedombone-restore-local $USB_DRIVE tox;;
esac
done
any_key
}
function restore_data {
dialog --title $"Restore data from USB" \
--msgbox $"Plug in your backup USB drive" 6 40
clear
echo ' '
echo $'Enter the passphrase for your LUKS encrypted backup drive:'
${PROJECT_NAME}-restore-local
any_key
restore_from_usb
}
function restore_data_remote {