Restore email
This commit is contained in:
parent
ba7af2dba5
commit
c638f9c000
|
@ -3006,7 +3006,108 @@ function create_backup_script {
|
|||
echo " if [ ! -d $USB_MOUNT/backup/Maildir ]; then" >> /usr/bin/$BACKUP_SCRIPT_NAME
|
||||
echo " mkdir $USB_MOUNT/backup/Maildir" >> /usr/bin/$BACKUP_SCRIPT_NAME
|
||||
echo ' fi' >> /usr/bin/$BACKUP_SCRIPT_NAME
|
||||
echo " obnam -r $USB_MOUNT/backup/Maildir /home/$MY_USERNAME/Maildir /home/$MY_USERNAME/.gnupg /home/$MY_USERNAME/.muttrc /home/$MY_USERNAME/.procmailrc" >> /usr/bin/$BACKUP_SCRIPT_NAME
|
||||
echo " obnam -r $USB_MOUNT/backup/Maildir /home/$MY_USERNAME/Maildir" >> /usr/bin/$BACKUP_SCRIPT_NAME
|
||||
echo " if [ ! -d $USB_MOUNT/backup/gpg ]; then" >> /usr/bin/$BACKUP_SCRIPT_NAME
|
||||
echo " mkdir $USB_MOUNT/backup/gpg" >> /usr/bin/$BACKUP_SCRIPT_NAME
|
||||
echo ' fi' >> /usr/bin/$BACKUP_SCRIPT_NAME
|
||||
echo " obnam -r $USB_MOUNT/backup/gpg /home/$MY_USERNAME/.gnupg" >> /usr/bin/$BACKUP_SCRIPT_NAME
|
||||
echo " cp -f /home/$MY_USERNAME/.muttrc $USB_MOUNT/backup/gpg" >> /usr/bin/$BACKUP_SCRIPT_NAME
|
||||
echo " cp -f /home/$MY_USERNAME/.procmailrc $USB_MOUNT/backup/gpg" >> /usr/bin/$BACKUP_SCRIPT_NAME
|
||||
fi
|
||||
# dynamic dns
|
||||
echo " if [ -f /usr/bin/dynamicdns ]; then" >> /usr/bin/$BACKUP_SCRIPT_NAME
|
||||
echo " if [ ! -d $USB_MOUNT/backup/dynamicdns ]; then" >> /usr/bin/$BACKUP_SCRIPT_NAME
|
||||
echo " mkdir $USB_MOUNT/backup/dynamicdns" >> /usr/bin/$BACKUP_SCRIPT_NAME
|
||||
echo ' fi' >> /usr/bin/$BACKUP_SCRIPT_NAME
|
||||
echo " obnam -r $USB_MOUNT/backup/dynamicdns /usr/bin/dynamicdns" >> /usr/bin/$BACKUP_SCRIPT_NAME
|
||||
echo ' fi' >> /usr/bin/$BACKUP_SCRIPT_NAME
|
||||
# web server
|
||||
echo " if [ -d /etc/nginx ]; then" >> /usr/bin/$BACKUP_SCRIPT_NAME
|
||||
echo " if [ ! -d $USB_MOUNT/backup/webserver ]; then" >> /usr/bin/$BACKUP_SCRIPT_NAME
|
||||
echo " mkdir $USB_MOUNT/backup/webserver" >> /usr/bin/$BACKUP_SCRIPT_NAME
|
||||
echo ' fi' >> /usr/bin/$BACKUP_SCRIPT_NAME
|
||||
echo " obnam -r $USB_MOUNT/backup/webserver /etc/nginx/sites-available" >> /usr/bin/$BACKUP_SCRIPT_NAME
|
||||
echo ' fi' >> /usr/bin/$BACKUP_SCRIPT_NAME
|
||||
# owncloud
|
||||
if ! [[ $SYSTEM_TYPE == "$VARIANT_WRITER" || $SYSTEM_TYPE == "$VARIANT_MAILBOX" || $SYSTEM_TYPE == "$VARIANT_CHAT" || $SYSTEM_TYPE == "$VARIANT_SOCIAL" || $SYSTEM_TYPE == "$VARIANT_MEDIA" ]]; then
|
||||
if [ $OWNCLOUD_DOMAIN_NAME ]; then
|
||||
echo " if [ ! -d $USB_MOUNT/backup/owncloud ]; then" >> /usr/bin/$BACKUP_SCRIPT_NAME
|
||||
echo " mkdir $USB_MOUNT/backup/owncloud" >> /usr/bin/$BACKUP_SCRIPT_NAME
|
||||
echo ' fi' >> /usr/bin/$BACKUP_SCRIPT_NAME
|
||||
echo " obnam -r $USB_MOUNT/backup/owncloud /var/www/$OWNCLOUD_DOMAIN_NAME" >> /usr/bin/$BACKUP_SCRIPT_NAME
|
||||
fi
|
||||
fi
|
||||
# prosody
|
||||
echo 'if [ -d /var/lib/prosody ]; then' >> /usr/bin/$BACKUP_SCRIPT_NAME
|
||||
echo " if [ ! -d $USB_MOUNT/backup/prosody ]; then" >> /usr/bin/$BACKUP_SCRIPT_NAME
|
||||
echo " mkdir $USB_MOUNT/backup/prosody" >> /usr/bin/$BACKUP_SCRIPT_NAME
|
||||
echo ' fi' >> /usr/bin/$BACKUP_SCRIPT_NAME
|
||||
echo " obnam -r $USB_MOUNT/backup/prosody /var/lib/prosody" >> /usr/bin/$BACKUP_SCRIPT_NAME
|
||||
echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME
|
||||
# wiki / blog
|
||||
if ! [[ $SYSTEM_TYPE == "$VARIANT_CLOUD" || $SYSTEM_TYPE == "$VARIANT_MAILBOX" || $SYSTEM_TYPE == "$VARIANT_CHAT" || $SYSTEM_TYPE == "$VARIANT_SOCIAL" || $SYSTEM_TYPE == "$VARIANT_MEDIA" ]]; then
|
||||
if [ $WIKI_DOMAIN_NAME ]; then
|
||||
echo " if [ ! -d $USB_MOUNT/backup/wiki-blog ]; then" >> /usr/bin/$BACKUP_SCRIPT_NAME
|
||||
echo " mkdir $USB_MOUNT/backup/wiki-blog" >> /usr/bin/$BACKUP_SCRIPT_NAME
|
||||
echo ' fi' >> /usr/bin/$BACKUP_SCRIPT_NAME
|
||||
echo " obnam -r $USB_MOUNT/backup/wiki-blog /var/www/$WIKI_DOMAIN_NAME" >> /usr/bin/$BACKUP_SCRIPT_NAME
|
||||
fi
|
||||
fi
|
||||
# microblog
|
||||
if ! [[ $SYSTEM_TYPE == "$VARIANT_CLOUD" || $SYSTEM_TYPE == "$VARIANT_MAILBOX" || $SYSTEM_TYPE == "$VARIANT_CHAT" || $SYSTEM_TYPE == "$VARIANT_WRITER" || $SYSTEM_TYPE == "$VARIANT_MEDIA" ]]; then
|
||||
if [ $MICROBLOG_DOMAIN_NAME ]; then
|
||||
echo " if [ ! -d $USB_MOUNT/backup/gnusocial ]; then" >> /usr/bin/$BACKUP_SCRIPT_NAME
|
||||
echo " mkdir $USB_MOUNT/backup/gnusocial" >> /usr/bin/$BACKUP_SCRIPT_NAME
|
||||
echo ' fi' >> /usr/bin/$BACKUP_SCRIPT_NAME
|
||||
echo " obnam -r $USB_MOUNT/backup/gnusocial /var/www/$MICROBLOG_DOMAIN_NAME" >> /usr/bin/$BACKUP_SCRIPT_NAME
|
||||
echo " mysqldump --password=$MARIADB_PASSWORD gnusocial > $USB_MOUNT/backup/gnusocial/database.sql" >> /usr/bin/$BACKUP_SCRIPT_NAME
|
||||
fi
|
||||
fi
|
||||
# redmatrix
|
||||
if ! [[ $SYSTEM_TYPE == "$VARIANT_CLOUD" || $SYSTEM_TYPE == "$VARIANT_MAILBOX" || $SYSTEM_TYPE == "$VARIANT_CHAT" || $SYSTEM_TYPE == "$VARIANT_WRITER" || $SYSTEM_TYPE == "$VARIANT_MEDIA" ]]; then
|
||||
if [ $REDMATRIX_DOMAIN_NAME ]; then
|
||||
echo " if [ ! -d $USB_MOUNT/backup/redmatrix ]; then" >> /usr/bin/$BACKUP_SCRIPT_NAME
|
||||
echo " mkdir $USB_MOUNT/backup/redmatrix" >> /usr/bin/$BACKUP_SCRIPT_NAME
|
||||
echo ' fi' >> /usr/bin/$BACKUP_SCRIPT_NAME
|
||||
echo " obnam -r $USB_MOUNT/backup/redmatrix /var/www/$REDMATRIX_DOMAIN_NAME" >> /usr/bin/$BACKUP_SCRIPT_NAME
|
||||
echo " mysqldump --password=$MARIADB_PASSWORD redmatrix > $USB_MOUNT/backup/redmatrix/database.sql" >> /usr/bin/$BACKUP_SCRIPT_NAME
|
||||
fi
|
||||
fi
|
||||
# dlna
|
||||
if [[ $SYSTEM_TYPE == "$VARIANT_CLOUD" || $SYSTEM_TYPE == "$VARIANT_MAILBOX" || $SYSTEM_TYPE == "$VARIANT_CHAT" || $SYSTEM_TYPE == "$VARIANT_WRITER" || $SYSTEM_TYPE == "$VARIANT_SOCIAL" ]]; then
|
||||
echo " if [ ! -d $USB_MOUNT/backup/dlna ]; then" >> /usr/bin/$BACKUP_SCRIPT_NAME
|
||||
echo " mkdir $USB_MOUNT/backup/dlna" >> /usr/bin/$BACKUP_SCRIPT_NAME
|
||||
echo ' fi' >> /usr/bin/$BACKUP_SCRIPT_NAME
|
||||
echo " obnam -r $USB_MOUNT/backup/dlna /var/cache/minidlna" >> /usr/bin/$BACKUP_SCRIPT_NAME
|
||||
fi
|
||||
echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME
|
||||
chmod +x /usr/bin/$BACKUP_SCRIPT_NAME
|
||||
|
||||
echo 'create_backup_script' >> $COMPLETION_FILE
|
||||
}
|
||||
|
||||
function create_restore_script {
|
||||
if grep -Fxq "create_restore_script" $COMPLETION_FILE; then
|
||||
return
|
||||
fi
|
||||
apt-get -y --force-yes install obnam
|
||||
echo '#!/bin/bash' > /usr/bin/$BACKUP_SCRIPT_NAME
|
||||
echo "if [ -b $USB_DRIVE ]; then" >> /usr/bin/$BACKUP_SCRIPT_NAME
|
||||
echo " if [ ! -d $USB_MOUNT ]; then" >> /usr/bin/$BACKUP_SCRIPT_NAME
|
||||
echo " mkdir $USB_MOUNT" >> /usr/bin/$BACKUP_SCRIPT_NAME
|
||||
echo " mount $USB_DRIVE $USB_MOUNT" >> /usr/bin/$BACKUP_SCRIPT_NAME
|
||||
echo ' fi' >> /usr/bin/$BACKUP_SCRIPT_NAME
|
||||
echo " if [ ! -d $USB_MOUNT/backup ]; then" >> /usr/bin/$BACKUP_SCRIPT_NAME
|
||||
echo " mkdir $USB_MOUNT/backup" >> /usr/bin/$BACKUP_SCRIPT_NAME
|
||||
echo ' fi' >> /usr/bin/$BACKUP_SCRIPT_NAME
|
||||
# email
|
||||
if ! [[ $SYSTEM_TYPE == "$VARIANT_WRITER" || $SYSTEM_TYPE == "$VARIANT_CLOUD" || $SYSTEM_TYPE == "$VARIANT_CHAT" || $SYSTEM_TYPE == "$VARIANT_SOCIAL" || $SYSTEM_TYPE == "$VARIANT_MEDIA" || $SYSTEM_TYPE == "$VARIANT_NONMAILBOX" ]]; then
|
||||
echo " if [ -d $USB_MOUNT/backup/Maildir ]; then" >> /usr/bin/$BACKUP_SCRIPT_NAME
|
||||
echo " obnam restore --to /home/$MY_USERNAME/Maildir $USB_MOUNT/backup/Maildir" >> /usr/bin/$BACKUP_SCRIPT_NAME
|
||||
echo " obnam restore --to /home/$MY_USERNAME/.gnupg $USB_MOUNT/backup/gpg" >> /usr/bin/$BACKUP_SCRIPT_NAME
|
||||
echo " cp -f $USB_MOUNT/backup/gpg/.muttrc /home/$MY_USERNAME" >> /usr/bin/$BACKUP_SCRIPT_NAME
|
||||
echo " cp -f $USB_MOUNT/backup/gpg/.procmailrc /home/$MY_USERNAME" >> /usr/bin/$BACKUP_SCRIPT_NAME
|
||||
echo ' fi' >> /usr/bin/$BACKUP_SCRIPT_NAME
|
||||
fi
|
||||
# dynamic dns
|
||||
echo " if [ -f /usr/bin/dynamicdns ]; then" >> /usr/bin/$BACKUP_SCRIPT_NAME
|
||||
|
|
Loading…
Reference in New Issue