Refactoring restore from usb

This commit is contained in:
Bob Mottram 2015-09-13 15:23:08 +01:00
parent 89e1ca2463
commit 0a6928a4f6
1 changed files with 41 additions and 81 deletions

View File

@ -2904,6 +2904,16 @@ function create_backup_script {
echo 'create_backup_script' >> $COMPLETION_FILE echo 'create_backup_script' >> $COMPLETION_FILE
} }
function restore_directory_from_usb {
echo ' if [ ! -d ${1} ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' mkdir ${1}' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME
if [[ $BACKUP_TYPE == 'rsync' ]]; then
echo " rsyncrypto -v -d -r $USB_MOUNT/backup/${2} ${1} $USB_MOUNT/backup/${2}.keys $BACKUP_CERTIFICATE" >> /usr/bin/$RESTORE_SCRIPT_NAME
fi
}
function create_restore_script { function create_restore_script {
if grep -Fxq "create_restore_script" $COMPLETION_FILE; then if grep -Fxq "create_restore_script" $COMPLETION_FILE; then
return return
@ -3013,10 +3023,7 @@ function create_restore_script {
if [[ $BACKUP_INCLUDES_DATABASES == "yes" ]]; then if [[ $BACKUP_INCLUDES_DATABASES == "yes" ]]; then
echo "if [ -d $USB_MOUNT/backup/mariadb ]; then" >> /usr/bin/$RESTORE_SCRIPT_NAME echo "if [ -d $USB_MOUNT/backup/mariadb ]; then" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' echo "Restoring mysql settings"' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' echo "Restoring mysql settings"' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' if [ ! -d /root/tempmariadb ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME restore_directory_from_usb /root/tempmariadb mariadb
echo ' mkdir /root/tempmariadb' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo " rsyncrypto -v -d -r $USB_MOUNT/backup/mariadb /root/tempmariadb $USB_MOUNT/backup/mariadb.keys $BACKUP_CERTIFICATE" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' echo "Get the MariaDB password from the backup"' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' echo "Get the MariaDB password from the backup"' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' if [ ! -f /root/tempmariadb/usb/backup/mariadb/tempmariadb/db ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' if [ ! -f /root/tempmariadb/usb/backup/mariadb/tempmariadb/db ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' echo "MariaDB password file not found"' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' echo "MariaDB password file not found"' >> /usr/bin/$RESTORE_SCRIPT_NAME
@ -3054,8 +3061,7 @@ function create_restore_script {
echo "if [ -d $USB_MOUNT/backup/mutt ]; then" >> /usr/bin/$RESTORE_SCRIPT_NAME echo "if [ -d $USB_MOUNT/backup/mutt ]; then" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' echo "Restoring Mutt settings"' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' echo "Restoring Mutt settings"' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' mkdir /root/tempmutt' >> /usr/bin/$RESTORE_SCRIPT_NAME restore_directory_from_usb /root/tempmutt mutt
echo " rsyncrypto -v -d -r $USB_MOUNT/backup/mutt /root/tempmutt $USB_MOUNT/backup/mutt.keys $BACKUP_CERTIFICATE" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' if [ -f /root/tempmutt/usb/backup/mutt/$MY_USERNAME/tempbackup/.muttrc ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' if [ -f /root/tempmutt/usb/backup/mutt/$MY_USERNAME/tempbackup/.muttrc ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' cp -f /root/tempmutt/usb/backup/mutt/$MY_USERNAME/tempbackup/.muttrc /home/$MY_USERNAME/.muttrc' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' cp -f /root/tempmutt/usb/backup/mutt/$MY_USERNAME/tempbackup/.muttrc /home/$MY_USERNAME/.muttrc' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME
@ -3074,8 +3080,7 @@ function create_restore_script {
echo "if [ -d $USB_MOUNT/backup/gnupg ]; then" >> /usr/bin/$RESTORE_SCRIPT_NAME echo "if [ -d $USB_MOUNT/backup/gnupg ]; then" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' echo "Restoring gnupg settings"' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' echo "Restoring gnupg settings"' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' mkdir /root/tempgnupg' >> /usr/bin/$RESTORE_SCRIPT_NAME restore_directory_from_usb /root/tempgnupg gnupg
echo " rsyncrypto -v -d -r $USB_MOUNT/backup/gnupg /root/tempgnupg $USB_MOUNT/backup/gnupg.keys $BACKUP_CERTIFICATE" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' cp -r /root/tempgnupg/usb/backup/gnupg/$MY_USERNAME/.gnupg /home/$MY_USERNAME/' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' cp -r /root/tempgnupg/usb/backup/gnupg/$MY_USERNAME/.gnupg /home/$MY_USERNAME/' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' if [ ! "$?" = "0" ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' if [ ! "$?" = "0" ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo " umount $USB_MOUNT" >> /usr/bin/$RESTORE_SCRIPT_NAME echo " umount $USB_MOUNT" >> /usr/bin/$RESTORE_SCRIPT_NAME
@ -3095,8 +3100,7 @@ function create_restore_script {
echo "if [ -d $USB_MOUNT/backup/procmail ]; then" >> /usr/bin/$RESTORE_SCRIPT_NAME echo "if [ -d $USB_MOUNT/backup/procmail ]; then" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' echo "Restoring procmail settings"' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' echo "Restoring procmail settings"' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' mkdir /root/tempprocmail' >> /usr/bin/$RESTORE_SCRIPT_NAME restore_directory_from_usb /root/tempprocmail procmail
echo " rsyncrypto -v -d -r $USB_MOUNT/backup/procmail /root/tempprocmail $USB_MOUNT/backup/procmail.keys $BACKUP_CERTIFICATE" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' cp -f /root/tempprocmail/usb/backup/procmail/$MY_USERNAME/tempbackup/.procmailrc /home/$MY_USERNAME/' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' cp -f /root/tempprocmail/usb/backup/procmail/$MY_USERNAME/tempbackup/.procmailrc /home/$MY_USERNAME/' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' if [ ! "$?" = "0" ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' if [ ! "$?" = "0" ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo " umount $USB_MOUNT" >> /usr/bin/$RESTORE_SCRIPT_NAME echo " umount $USB_MOUNT" >> /usr/bin/$RESTORE_SCRIPT_NAME
@ -3110,8 +3114,7 @@ function create_restore_script {
echo "if [ -d $USB_MOUNT/backup/spamassassin ]; then" >> /usr/bin/$RESTORE_SCRIPT_NAME echo "if [ -d $USB_MOUNT/backup/spamassassin ]; then" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' echo "Restoring spamassassin settings"' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' echo "Restoring spamassassin settings"' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' mkdir /root/tempspamassassin' >> /usr/bin/$RESTORE_SCRIPT_NAME restore_directory_from_usb /root/tempspamassassin spamassassin
echo " rsyncrypto -v -d -r $USB_MOUNT/backup/spamassassin /root/tempspamassassin $USB_MOUNT/backup/spamassassin.keys $BACKUP_CERTIFICATE" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' cp -rf /root/tempspamassassin/usb/backup/spamassassin/$MY_USERNAME/.spamassassin /home/$MY_USERNAME/' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' cp -rf /root/tempspamassassin/usb/backup/spamassassin/$MY_USERNAME/.spamassassin /home/$MY_USERNAME/' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' if [ ! "$?" = "0" ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' if [ ! "$?" = "0" ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo " umount $USB_MOUNT" >> /usr/bin/$RESTORE_SCRIPT_NAME echo " umount $USB_MOUNT" >> /usr/bin/$RESTORE_SCRIPT_NAME
@ -3125,8 +3128,7 @@ function create_restore_script {
echo "if [ -d $USB_MOUNT/backup/readme ]; then" >> /usr/bin/$RESTORE_SCRIPT_NAME echo "if [ -d $USB_MOUNT/backup/readme ]; then" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' echo "Restoring README"' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' echo "Restoring README"' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' mkdir /root/tempreadme' >> /usr/bin/$RESTORE_SCRIPT_NAME restore_directory_from_usb /root/tempreadme readme
echo " rsyncrypto -v -d -r $USB_MOUNT/backup/readme /root/tempreadme $USB_MOUNT/backup/readme.keys $BACKUP_CERTIFICATE" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' cp -f /root/tempreadme/usb/backup/readme/$MY_USERNAME/tempbackup/README /home/$MY_USERNAME/' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' cp -f /root/tempreadme/usb/backup/readme/$MY_USERNAME/tempbackup/README /home/$MY_USERNAME/' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' if [ ! "$?" = "0" ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' if [ ! "$?" = "0" ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo " umount $USB_MOUNT" >> /usr/bin/$RESTORE_SCRIPT_NAME echo " umount $USB_MOUNT" >> /usr/bin/$RESTORE_SCRIPT_NAME
@ -3140,8 +3142,7 @@ function create_restore_script {
echo "if [ -d $USB_MOUNT/backup/ssh ]; then" >> /usr/bin/$RESTORE_SCRIPT_NAME echo "if [ -d $USB_MOUNT/backup/ssh ]; then" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' echo "Restoring ssh keys"' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' echo "Restoring ssh keys"' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' mkdir /root/tempssh' >> /usr/bin/$RESTORE_SCRIPT_NAME restore_directory_from_usb /root/tempssh ssh
echo " rsyncrypto -v -d -r $USB_MOUNT/backup/ssh /root/tempssh $USB_MOUNT/backup/ssh.keys $BACKUP_CERTIFICATE" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' cp -r /root/tempssh/usb/backup/ssh/$MY_USERNAME/.ssh /home/$MY_USERNAME/' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' cp -r /root/tempssh/usb/backup/ssh/$MY_USERNAME/.ssh /home/$MY_USERNAME/' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' if [ ! "$?" = "0" ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' if [ ! "$?" = "0" ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo " umount $USB_MOUNT" >> /usr/bin/$RESTORE_SCRIPT_NAME echo " umount $USB_MOUNT" >> /usr/bin/$RESTORE_SCRIPT_NAME
@ -3156,7 +3157,7 @@ function create_restore_script {
echo "if [ -d $USB_MOUNT/backup/ssl ]; then" >> /usr/bin/$RESTORE_SCRIPT_NAME echo "if [ -d $USB_MOUNT/backup/ssl ]; then" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' echo "Restoring certificates"' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' echo "Restoring certificates"' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' mkdir /root/tempssl' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' mkdir /root/tempssl' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo " rsyncrypto -v -d -r $USB_MOUNT/backup/ssl /root/tempssl $USB_MOUNT/backup/ssl.keys $BACKUP_CERTIFICATE" >> /usr/bin/$RESTORE_SCRIPT_NAME restore_directory_from_usb /root/tempssl ssl
echo ' cp -r /root/tempssl/usb/backup/ssl/ssl/* /etc/ssl' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' cp -r /root/tempssl/usb/backup/ssl/ssl/* /etc/ssl' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' if [ ! "$?" = "0" ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' if [ ! "$?" = "0" ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo " umount $USB_MOUNT" >> /usr/bin/$RESTORE_SCRIPT_NAME echo " umount $USB_MOUNT" >> /usr/bin/$RESTORE_SCRIPT_NAME
@ -3169,8 +3170,7 @@ function create_restore_script {
echo "if [ -d $USB_MOUNT/backup/projects ]; then" >> /usr/bin/$RESTORE_SCRIPT_NAME echo "if [ -d $USB_MOUNT/backup/projects ]; then" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' echo "Restoring projects"' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' echo "Restoring projects"' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' mkdir /root/tempprojects' >> /usr/bin/$RESTORE_SCRIPT_NAME restore_directory_from_usb /root/tempprojects projects
echo " rsyncrypto -v -d -r $USB_MOUNT/backup/projects /root/tempprojects $USB_MOUNT/backup/projects.keys $BACKUP_CERTIFICATE" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' if [ -d /home/$MY_USERNAME/projects ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' if [ -d /home/$MY_USERNAME/projects ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' rm -rf /home/$MY_USERNAME/projects' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' rm -rf /home/$MY_USERNAME/projects' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME
@ -3186,8 +3186,7 @@ function create_restore_script {
echo "if [ -d $USB_MOUNT/backup/personal ]; then" >> /usr/bin/$RESTORE_SCRIPT_NAME echo "if [ -d $USB_MOUNT/backup/personal ]; then" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' echo "Restoring personal settings"' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' echo "Restoring personal settings"' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' mkdir /root/temppersonal' >> /usr/bin/$RESTORE_SCRIPT_NAME restore_directory_from_usb /root/temppersonal personal
echo " rsyncrypto -v -d -r $USB_MOUNT/backup/personal /root/temppersonal $USB_MOUNT/backup/personal.keys $BACKUP_CERTIFICATE" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' if [ -d /home/$MY_USERNAME/personal ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' if [ -d /home/$MY_USERNAME/personal ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' rm -rf /home/$MY_USERNAME/personal' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' rm -rf /home/$MY_USERNAME/personal' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME
@ -3203,8 +3202,7 @@ function create_restore_script {
echo "if [ -d $PUBLIC_MAILING_LIST_DIRECTORY ]; then" >> /usr/bin/$RESTORE_SCRIPT_NAME echo "if [ -d $PUBLIC_MAILING_LIST_DIRECTORY ]; then" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' echo "Restoring public mailing list"' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' echo "Restoring public mailing list"' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' mkdir /root/tempmailinglist' >> /usr/bin/$RESTORE_SCRIPT_NAME restore_directory_from_usb /root/tempmailinglist mailinglist
echo " rsyncrypto -v -d -r $USB_MOUNT/backup/mailinglist /root/tempmailinglist $USB_MOUNT/backup/mailinglist.keys $BACKUP_CERTIFICATE" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo " cp -r /root/tempmailinglist/usb/backup/mailinglist/spool/mlmmj/* $PUBLIC_MAILING_LIST_DIRECTORY" >> /usr/bin/$RESTORE_SCRIPT_NAME echo " cp -r /root/tempmailinglist/usb/backup/mailinglist/spool/mlmmj/* $PUBLIC_MAILING_LIST_DIRECTORY" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' if [ ! "$?" = "0" ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' if [ ! "$?" = "0" ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo " umount $USB_MOUNT" >> /usr/bin/$RESTORE_SCRIPT_NAME echo " umount $USB_MOUNT" >> /usr/bin/$RESTORE_SCRIPT_NAME
@ -3217,8 +3215,7 @@ function create_restore_script {
echo "if [ -d $XMPP_DIRECTORY ]; then" >> /usr/bin/$RESTORE_SCRIPT_NAME echo "if [ -d $XMPP_DIRECTORY ]; then" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' echo "Restoring XMPP settings"' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' echo "Restoring XMPP settings"' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' mkdir /root/tempxmpp' >> /usr/bin/$RESTORE_SCRIPT_NAME restore_directory_from_usb /root/tempxmpp xmpp
echo " rsyncrypto -v -d -r $USB_MOUNT/backup/xmpp /root/tempxmpp $USB_MOUNT/backup/xmpp.keys $BACKUP_CERTIFICATE" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo " cp -r /root/tempxmpp/usb/backup/xmpp/lib/prosody/* $XMPP_DIRECTORY" >> /usr/bin/$RESTORE_SCRIPT_NAME echo " cp -r /root/tempxmpp/usb/backup/xmpp/lib/prosody/* $XMPP_DIRECTORY" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' if [ ! "$?" = "0" ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' if [ ! "$?" = "0" ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo " umount $USB_MOUNT" >> /usr/bin/$RESTORE_SCRIPT_NAME echo " umount $USB_MOUNT" >> /usr/bin/$RESTORE_SCRIPT_NAME
@ -3237,10 +3234,7 @@ function create_restore_script {
BACKUP_INCLUDES_WEBSITES="yes" BACKUP_INCLUDES_WEBSITES="yes"
echo "if [ -d $USB_MOUNT/backup/gnusocial ]; then" >> /usr/bin/$RESTORE_SCRIPT_NAME echo "if [ -d $USB_MOUNT/backup/gnusocial ]; then" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' echo "Restoring microblog database"' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' echo "Restoring microblog database"' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' if [ ! -d /root/tempgnusocialdata ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME restore_directory_from_usb /root/tempgnusocialdata gnusocialdata
echo ' mkdir /root/tempgnusocialdata' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo " rsyncrypto -v -d -r $USB_MOUNT/backup/gnusocialdata /root/tempgnusocialdata $USB_MOUNT/backup/gnusocialdata.keys $BACKUP_CERTIFICATE" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' if [ ! -f /root/tempgnusocialdata/usb/backup/gnusocialdata/tempgnusocialdata/gnusocial.sql ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' if [ ! -f /root/tempgnusocialdata/usb/backup/gnusocialdata/tempgnusocialdata/gnusocial.sql ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' echo "Unable to restore microblog database"' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' echo "Unable to restore microblog database"' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' rm -rf /root/tempgnusocialdata' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' rm -rf /root/tempgnusocialdata' >> /usr/bin/$RESTORE_SCRIPT_NAME
@ -3261,7 +3255,7 @@ function create_restore_script {
echo ' if [ ! -d /root/tempgnusocial ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' if [ ! -d /root/tempgnusocial ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' mkdir /root/tempgnusocial' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' mkdir /root/tempgnusocial' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo " rsyncrypto -v -d -r $USB_MOUNT/backup/gnusocial /root/tempgnusocial $USB_MOUNT/backup/gnusocial.keys $BACKUP_CERTIFICATE" >> /usr/bin/$RESTORE_SCRIPT_NAME restore_directory_from_usb /root/tempgnusocial gnusocial
echo " rm -rf /var/www/$MICROBLOG_DOMAIN_NAME/htdocs" >> /usr/bin/$RESTORE_SCRIPT_NAME echo " rm -rf /var/www/$MICROBLOG_DOMAIN_NAME/htdocs" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo " mv /root/tempgnusocial/usb/backup/gnusocial/www/$MICROBLOG_DOMAIN_NAME/htdocs /var/www/$MICROBLOG_DOMAIN_NAME/" >> /usr/bin/$RESTORE_SCRIPT_NAME echo " mv /root/tempgnusocial/usb/backup/gnusocial/www/$MICROBLOG_DOMAIN_NAME/htdocs /var/www/$MICROBLOG_DOMAIN_NAME/" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' if [ ! "$?" = "0" ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' if [ ! "$?" = "0" ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME
@ -3282,10 +3276,7 @@ function create_restore_script {
BACKUP_INCLUDES_WEBSITES="yes" BACKUP_INCLUDES_WEBSITES="yes"
echo "if [ -d $USB_MOUNT/backup/hubzilla ]; then" >> /usr/bin/$RESTORE_SCRIPT_NAME echo "if [ -d $USB_MOUNT/backup/hubzilla ]; then" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' echo "Restoring Hubzilla database"' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' echo "Restoring Hubzilla database"' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' if [ ! -d /root/temphubzilladata ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME restore_directory_from_usb /root/temphubzilladata hubzilladata
echo ' mkdir /root/temphubzilladata' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo " rsyncrypto -v -d -r $USB_MOUNT/backup/hubzilladata /root/temphubzilladata $USB_MOUNT/backup/hubzilladata.keys $BACKUP_CERTIFICATE" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' if [ ! -f /root/temphubzilladata/usb/backup/hubzilladata/temphubzilladata/hubzilla.sql ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' if [ ! -f /root/temphubzilladata/usb/backup/hubzilladata/temphubzilladata/hubzilla.sql ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' echo "Unable to restore Hubzilla database"' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' echo "Unable to restore Hubzilla database"' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' rm -rf /root/temphubzilladata' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' rm -rf /root/temphubzilladata' >> /usr/bin/$RESTORE_SCRIPT_NAME
@ -3303,10 +3294,7 @@ function create_restore_script {
echo ' shred -zu /root/temphubzilladata/usb/backup/hubzilladata/temphubzilladata/*' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' shred -zu /root/temphubzilladata/usb/backup/hubzilladata/temphubzilladata/*' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' rm -rf /root/temphubzilladata' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' rm -rf /root/temphubzilladata' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' echo "Restoring Hubzilla installation"' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' echo "Restoring Hubzilla installation"' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' if [ ! -d /root/temphubzilla ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME restore_directory_from_usb /root/temphubzilla hubzilla
echo ' mkdir /root/temphubzilla' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo " rsyncrypto -v -d -r $USB_MOUNT/backup/hubzilla /root/temphubzilla $USB_MOUNT/backup/hubzilla.keys $BACKUP_CERTIFICATE" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo " rm -rf /var/www/$HUBZILLA_DOMAIN_NAME/htdocs" >> /usr/bin/$RESTORE_SCRIPT_NAME echo " rm -rf /var/www/$HUBZILLA_DOMAIN_NAME/htdocs" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' if [ ! "$?" = "0" ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' if [ ! "$?" = "0" ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo " cp -r /root/temphubzilla/usb/backup/hubzilla/www/$HUBZILLA_DOMAIN_NAME/htdocs/* /var/www/$HUBZILLA_DOMAIN_NAME/htdocs/" >> /usr/bin/$RESTORE_SCRIPT_NAME echo " cp -r /root/temphubzilla/usb/backup/hubzilla/www/$HUBZILLA_DOMAIN_NAME/htdocs/* /var/www/$HUBZILLA_DOMAIN_NAME/htdocs/" >> /usr/bin/$RESTORE_SCRIPT_NAME
@ -3333,10 +3321,7 @@ function create_restore_script {
BACKUP_INCLUDES_WEBSITES="yes" BACKUP_INCLUDES_WEBSITES="yes"
echo "if [ -d $USB_MOUNT/backup/owncloud ]; then" >> /usr/bin/$RESTORE_SCRIPT_NAME echo "if [ -d $USB_MOUNT/backup/owncloud ]; then" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' echo "Restoring owncloud database"' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' echo "Restoring owncloud database"' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' if [ ! -d /root/tempownclouddata ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME restore_directory_from_usb /root/tempownclouddata ownclouddata
echo ' mkdir /root/tempownclouddata' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo " rsyncrypto -v -d -r $USB_MOUNT/backup/ownclouddata /root/tempownclouddata $USB_MOUNT/backup/ownclouddata.keys $BACKUP_CERTIFICATE" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' if [ ! -f /root/tempownclouddata/usb/backup/ownclouddata/tempownclouddata/owncloud.sql ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' if [ ! -f /root/tempownclouddata/usb/backup/ownclouddata/tempownclouddata/owncloud.sql ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' echo "Unable to restore Owncloud database"' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' echo "Unable to restore Owncloud database"' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' rm -rf /root/tempownclouddata' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' rm -rf /root/tempownclouddata' >> /usr/bin/$RESTORE_SCRIPT_NAME
@ -3352,20 +3337,14 @@ function create_restore_script {
echo ' exit 965' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' exit 965' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' echo "Restoring Owncloud installation"' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' echo "Restoring Owncloud installation"' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' if [ ! -d /root/tempowncloud ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME restore_directory_from_usb /root/tempowncloud owncloud
echo ' mkdir /root/tempowncloud' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' if [ ! -d /root/tempowncloud2 ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' mkdir /root/tempowncloud2' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo " rsyncrypto -v -d -r $USB_MOUNT/backup/owncloud /root/tempowncloud $USB_MOUNT/backup/owncloud.keys $BACKUP_CERTIFICATE" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo " cp -r /root/tempowncloud/usb/backup/owncloud/lib/owncloud/* /var/lib/owncloud/" >> /usr/bin/$RESTORE_SCRIPT_NAME echo " cp -r /root/tempowncloud/usb/backup/owncloud/lib/owncloud/* /var/lib/owncloud/" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' if [ ! "$?" = "0" ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' if [ ! "$?" = "0" ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo " umount $USB_MOUNT" >> /usr/bin/$RESTORE_SCRIPT_NAME echo " umount $USB_MOUNT" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo " rm -rf $USB_MOUNT" >> /usr/bin/$RESTORE_SCRIPT_NAME echo " rm -rf $USB_MOUNT" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' exit 981' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' exit 981' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo " rsyncrypto -v -d -r $USB_MOUNT/backup/owncloud2 /root/tempowncloud2 $USB_MOUNT/backup/owncloud2.keys $BACKUP_CERTIFICATE" >> /usr/bin/$RESTORE_SCRIPT_NAME restore_directory_from_usb /root/tempowncloud2 owncloud2
echo " cp -r /root/tempowncloud2/usb/backup/owncloud2/owncloud/* /etc/owncloud/" >> /usr/bin/$RESTORE_SCRIPT_NAME echo " cp -r /root/tempowncloud2/usb/backup/owncloud2/owncloud/* /etc/owncloud/" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' if [ ! "$?" = "0" ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' if [ ! "$?" = "0" ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo " umount $USB_MOUNT" >> /usr/bin/$RESTORE_SCRIPT_NAME echo " umount $USB_MOUNT" >> /usr/bin/$RESTORE_SCRIPT_NAME
@ -3391,10 +3370,7 @@ function create_restore_script {
BACKUP_INCLUDES_WEBSITES="yes" BACKUP_INCLUDES_WEBSITES="yes"
echo "if [ -d $USB_MOUNT/backup/gogs ]; then" >> /usr/bin/$RESTORE_SCRIPT_NAME echo "if [ -d $USB_MOUNT/backup/gogs ]; then" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' echo "Restoring gogs database"' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' echo "Restoring gogs database"' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' if [ ! -d /root/tempgogsdata ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME restore_directory_from_usb /root/tempgogsdata gogsdata
echo ' mkdir /root/tempgogsdata' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo " rsyncrypto -v -d -r $USB_MOUNT/backup/gogsdata /root/tempgogsdata $USB_MOUNT/backup/gogsdata.keys $BACKUP_CERTIFICATE" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' if [ ! -f /root/tempgogsdata/usb/backup/gogsdata/tempgogsdata/gogs.sql ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' if [ ! -f /root/tempgogsdata/usb/backup/gogsdata/tempgogsdata/gogs.sql ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' echo "Unable to restore Gogs database"' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' echo "Unable to restore Gogs database"' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' rm -rf /root/tempgogsdata' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' rm -rf /root/tempgogsdata' >> /usr/bin/$RESTORE_SCRIPT_NAME
@ -3410,10 +3386,7 @@ function create_restore_script {
echo ' exit 965' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' exit 965' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' echo "Restoring Gogs settings"' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' echo "Restoring Gogs settings"' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' if [ ! -d /root/tempgogs ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME restore_directory_from_usb /root/tempgogs gogs
echo ' mkdir /root/tempgogs' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo " rsyncrypto -v -d -r $USB_MOUNT/backup/gogs /root/tempgogs $USB_MOUNT/backup/gogs.keys $BACKUP_CERTIFICATE" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' if [ ! -d /home/git/go/src/github.com/gogits/gogs/custom ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' if [ ! -d /home/git/go/src/github.com/gogits/gogs/custom ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' mkdir -p /home/git/go/src/github.com/gogits/gogs/custom' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' mkdir -p /home/git/go/src/github.com/gogits/gogs/custom' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME
@ -3424,10 +3397,7 @@ function create_restore_script {
echo ' exit 981' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' exit 981' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' echo "Restoring Gogs repos"' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' echo "Restoring Gogs repos"' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' if [ ! -d /root/tempgogsrepos ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME restore_directory_from_usb /root/tempgogsrepos gogsrepos
echo ' mkdir /root/tempgogsrepos' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo " rsyncrypto -v -d -r $USB_MOUNT/backup/gogsrepos /root/tempgogsrepos $USB_MOUNT/backup/gogsrepos.keys $BACKUP_CERTIFICATE" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo " cp -r /root/tempgogsrepos/usb/backup/gogsrepos/git/gogs-repositories/* /home/git/gogs-repositories/" >> /usr/bin/$RESTORE_SCRIPT_NAME echo " cp -r /root/tempgogsrepos/usb/backup/gogsrepos/git/gogs-repositories/* /home/git/gogs-repositories/" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' if [ ! "$?" = "0" ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' if [ ! "$?" = "0" ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo " umount $USB_MOUNT" >> /usr/bin/$RESTORE_SCRIPT_NAME echo " umount $USB_MOUNT" >> /usr/bin/$RESTORE_SCRIPT_NAME
@ -3435,10 +3405,7 @@ function create_restore_script {
echo ' exit 67574' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' exit 67574' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' echo "Restoring Gogs authorized_keys"' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' echo "Restoring Gogs authorized_keys"' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' if [ ! -d /root/tempgogsssh ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME restore_directory_from_usb /root/tempgogsssh gogsssh
echo ' mkdir /root/tempgogsssh' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo " rsyncrypto -v -d -r $USB_MOUNT/backup/gogsssh /root/tempgogsssh $USB_MOUNT/backup/gogsssh.keys $BACKUP_CERTIFICATE" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' if [ ! -d /home/git/.ssh ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' if [ ! -d /home/git/.ssh ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' mkdir /home/git/.ssh' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' mkdir /home/git/.ssh' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME
@ -3463,16 +3430,14 @@ function create_restore_script {
echo "if [ -d $USB_MOUNT/backup/wiki ]; then" >> /usr/bin/$RESTORE_SCRIPT_NAME echo "if [ -d $USB_MOUNT/backup/wiki ]; then" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' echo "Restoring Wiki installation"' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' echo "Restoring Wiki installation"' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' mkdir /root/tempwiki' >> /usr/bin/$RESTORE_SCRIPT_NAME restore_directory_from_usb /root/tempwiki wiki
echo " rsyncrypto -v -d -r $USB_MOUNT/backup/wiki /root/tempwiki $USB_MOUNT/backup/wiki.keys $BACKUP_CERTIFICATE" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo " cp -r /root/tempwiki/usb/backup/wiki/lib/dokuwiki/* /var/lib/dokuwiki/" >> /usr/bin/$RESTORE_SCRIPT_NAME echo " cp -r /root/tempwiki/usb/backup/wiki/lib/dokuwiki/* /var/lib/dokuwiki/" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' if [ ! "$?" = "0" ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' if [ ! "$?" = "0" ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo " umount $USB_MOUNT" >> /usr/bin/$RESTORE_SCRIPT_NAME echo " umount $USB_MOUNT" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo " rm -rf $USB_MOUNT" >> /usr/bin/$RESTORE_SCRIPT_NAME echo " rm -rf $USB_MOUNT" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' exit 868' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' exit 868' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' mkdir /root/tempwiki2' >> /usr/bin/$RESTORE_SCRIPT_NAME restore_directory_from_usb /root/tempwiki2 wiki2
echo " rsyncrypto -v -d -r $USB_MOUNT/backup/wiki2 /root/tempwiki2 $USB_MOUNT/backup/wiki2.keys $BACKUP_CERTIFICATE" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo " cp -r /root/tempwiki2/usb/backup/wiki2/dokuwiki/* /etc/dokuwiki/" >> /usr/bin/$RESTORE_SCRIPT_NAME echo " cp -r /root/tempwiki2/usb/backup/wiki2/dokuwiki/* /etc/dokuwiki/" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' if [ ! "$?" = "0" ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' if [ ! "$?" = "0" ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo " umount $USB_MOUNT" >> /usr/bin/$RESTORE_SCRIPT_NAME echo " umount $USB_MOUNT" >> /usr/bin/$RESTORE_SCRIPT_NAME
@ -3491,8 +3456,7 @@ function create_restore_script {
echo "if [ -d $USB_MOUNT/backup/blog ]; then" >> /usr/bin/$RESTORE_SCRIPT_NAME echo "if [ -d $USB_MOUNT/backup/blog ]; then" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' echo "Restoring blog installation"' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' echo "Restoring blog installation"' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' mkdir /root/tempblog' >> /usr/bin/$RESTORE_SCRIPT_NAME restore_directory_from_usb /root/tempblog blog
echo " rsyncrypto -v -d -r $USB_MOUNT/backup/blog /root/tempblog $USB_MOUNT/backup/blog.keys $BACKUP_CERTIFICATE" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo " rm -rf /var/www/$FULLBLOG_DOMAIN_NAME/htdocs" >> /usr/bin/$RESTORE_SCRIPT_NAME echo " rm -rf /var/www/$FULLBLOG_DOMAIN_NAME/htdocs" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo " cp -r /root/tempblog/usb/backup/blog/www/$FULLBLOG_DOMAIN_NAME/htdocs /var/www/$FULLBLOG_DOMAIN_NAME/" >> /usr/bin/$RESTORE_SCRIPT_NAME echo " cp -r /root/tempblog/usb/backup/blog/www/$FULLBLOG_DOMAIN_NAME/htdocs /var/www/$FULLBLOG_DOMAIN_NAME/" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' if [ ! "$?" = "0" ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' if [ ! "$?" = "0" ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME
@ -3517,8 +3481,7 @@ function create_restore_script {
echo "if [ -d $USB_MOUNT/backup/cjdns ]; then" >> /usr/bin/$RESTORE_SCRIPT_NAME echo "if [ -d $USB_MOUNT/backup/cjdns ]; then" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' echo "Restoring cjdns installation"' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' echo "Restoring cjdns installation"' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' mkdir /root/tempcjdns' >> /usr/bin/$RESTORE_SCRIPT_NAME restore_directory_from_usb /root/tempcjdns cjdns
echo " rsyncrypto -v -d -r $USB_MOUNT/backup/cjdns /root/tempcjdns $USB_MOUNT/backup/cjdns.keys $BACKUP_CERTIFICATE" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo " rm -rf /etc/cjdns" >> /usr/bin/$RESTORE_SCRIPT_NAME echo " rm -rf /etc/cjdns" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo " cp -r /root/tempcjdns/usb/backup/cjdns/cjdns /etc/" >> /usr/bin/$RESTORE_SCRIPT_NAME echo " cp -r /root/tempcjdns/usb/backup/cjdns/cjdns /etc/" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' if [ ! "$?" = "0" ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' if [ ! "$?" = "0" ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME
@ -3532,8 +3495,7 @@ function create_restore_script {
echo "if [ -d $USB_MOUNT/backup/mail ]; then" >> /usr/bin/$RESTORE_SCRIPT_NAME echo "if [ -d $USB_MOUNT/backup/mail ]; then" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' echo "Restoring emails"' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' echo "Restoring emails"' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' mkdir /root/tempmail' >> /usr/bin/$RESTORE_SCRIPT_NAME restore_directory_from_usb /root/tempmail mail
echo " rsyncrypto -v -d -r $USB_MOUNT/backup/mail /root/tempmail $USB_MOUNT/backup/mail.keys $BACKUP_CERTIFICATE" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' if [ ! -d /home/$MY_USERNAME/Maildir ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' if [ ! -d /home/$MY_USERNAME/Maildir ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' mkdir /home/$MY_USERNAME/Maildir' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' mkdir /home/$MY_USERNAME/Maildir' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME
@ -3550,8 +3512,7 @@ function create_restore_script {
echo "if [ -d /var/cache/minidlna ]; then" >> /usr/bin/$RESTORE_SCRIPT_NAME echo "if [ -d /var/cache/minidlna ]; then" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo " if [ -d $USB_MOUNT/backup/dlna ]; then" >> /usr/bin/$RESTORE_SCRIPT_NAME echo " if [ -d $USB_MOUNT/backup/dlna ]; then" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' echo "Restoring DLNA cache"' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' echo "Restoring DLNA cache"' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' mkdir /root/tempdlna' >> /usr/bin/$RESTORE_SCRIPT_NAME restore_directory_from_usb /root/tempdlna dlna
echo " rsyncrypto -v -d -r $USB_MOUNT/backup/dlna /root/tempdlna $USB_MOUNT/backup/dlna.keys $BACKUP_CERTIFICATE" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo " cp -r /root/tempdlna/usb/backup/dlna/cache/minidlna/* /var/cache/minidlna/" >> /usr/bin/$RESTORE_SCRIPT_NAME echo " cp -r /root/tempdlna/usb/backup/dlna/cache/minidlna/* /var/cache/minidlna/" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' if [ ! "$?" = "0" ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' if [ ! "$?" = "0" ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo " umount $USB_MOUNT" >> /usr/bin/$RESTORE_SCRIPT_NAME echo " umount $USB_MOUNT" >> /usr/bin/$RESTORE_SCRIPT_NAME
@ -3565,8 +3526,7 @@ function create_restore_script {
echo "if [ -d $USB_MOUNT/backup/voip ]; then" >> /usr/bin/$RESTORE_SCRIPT_NAME echo "if [ -d $USB_MOUNT/backup/voip ]; then" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' echo "Restoring VoIP settings"' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' echo "Restoring VoIP settings"' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' mkdir /root/tempvoip' >> /usr/bin/$RESTORE_SCRIPT_NAME restore_directory_from_usb /root/tempvoip voip
echo " rsyncrypto -v -d -r $USB_MOUNT/backup/voip /root/tempvoip $USB_MOUNT/backup/voip.keys $BACKUP_CERTIFICATE" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo -n ' cp -f /root/tempvoip/usb/backup/voip/$MY_USERNAME/tempbackup/' >> /usr/bin/$RESTORE_SCRIPT_NAME echo -n ' cp -f /root/tempvoip/usb/backup/voip/$MY_USERNAME/tempbackup/' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo "$VOIP_CONFIG_FILE /etc/" >> /usr/bin/$RESTORE_SCRIPT_NAME echo "$VOIP_CONFIG_FILE /etc/" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo -n ' cp -f /root/tempvoip/usb/backup/voip/$MY_USERNAME/tempbackup/' >> /usr/bin/$RESTORE_SCRIPT_NAME echo -n ' cp -f /root/tempvoip/usb/backup/voip/$MY_USERNAME/tempbackup/' >> /usr/bin/$RESTORE_SCRIPT_NAME
@ -3586,7 +3546,7 @@ function create_restore_script {
echo "if [ -d $USB_MOUNT/backup/tox ]; then" >> /usr/bin/$RESTORE_SCRIPT_NAME echo "if [ -d $USB_MOUNT/backup/tox ]; then" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' echo "Restoring Tox node settings"' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' echo "Restoring Tox node settings"' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo " rsyncrypto -v -d -r $USB_MOUNT/backup/tox /var/lib/tox-bootstrapd $USB_MOUNT/backup/tox.keys $BACKUP_CERTIFICATE" >> /usr/bin/$RESTORE_SCRIPT_NAME restore_directory_from_usb /var/lib/tox-bootstrapd tox
echo ' if [ ! "$?" = "0" ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' if [ ! "$?" = "0" ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo " umount $USB_MOUNT" >> /usr/bin/$RESTORE_SCRIPT_NAME echo " umount $USB_MOUNT" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo " rm -rf $USB_MOUNT" >> /usr/bin/$RESTORE_SCRIPT_NAME echo " rm -rf $USB_MOUNT" >> /usr/bin/$RESTORE_SCRIPT_NAME