diff --git a/src/freedombone b/src/freedombone index 6e33f71f..6a2dab0b 100755 --- a/src/freedombone +++ b/src/freedombone @@ -2409,6 +2409,27 @@ function get_mariadb_owncloud_admin_password { fi } +BACKUP_TYPE='rsync' + +function backup_directory_to_usb { + if [[ $BACKUP_TYPE == 'rsync' ]]; then + echo "rsyncrypto -v -r ${1} $USB_MOUNT/backup/${2} $USB_MOUNT/backup/${2}.keys $BACKUP_CERTIFICATE" >> /usr/bin/$BACKUP_SCRIPT_NAME + echo 'if [ ! "$?" = "0" ]; then' >> /usr/bin/$BACKUP_SCRIPT_NAME + echo " umount $USB_MOUNT" >> /usr/bin/$BACKUP_SCRIPT_NAME + echo " rm -rf $USB_MOUNT" >> /usr/bin/$BACKUP_SCRIPT_NAME + if [[ ${1} == "/root/temp"* ]]; then + echo " shred -zu ${1}/*" >> /usr/bin/$BACKUP_SCRIPT_NAME + echo " rm -rf ${1}" >> /usr/bin/$BACKUP_SCRIPT_NAME + fi + echo ' exit 853' >> /usr/bin/$BACKUP_SCRIPT_NAME + echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME + if [[ ${1} == "/root/temp"* ]]; then + echo "shred -zu ${1}/*" >> /usr/bin/$BACKUP_SCRIPT_NAME + echo "rm -rf ${1}" >> /usr/bin/$BACKUP_SCRIPT_NAME + fi + fi +} + # For rsyncrypto usage see http://archive09.linux.com/feature/125322 function create_backup_script { if grep -Fxq "create_backup_script" $COMPLETION_FILE; then @@ -2511,23 +2532,9 @@ function create_backup_script { echo " rm -rf $USB_MOUNT" >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' exit 296' >> /usr/bin/$BACKUP_SCRIPT_NAME echo "fi" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo "rsyncrypto -v -r /root/tempgnusocialdata $USB_MOUNT/backup/gnusocialdata $USB_MOUNT/backup/gnusocialdata.keys $BACKUP_CERTIFICATE" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo 'if [ ! "$?" = "0" ]; then' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo " umount $USB_MOUNT" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo " rm -rf $USB_MOUNT" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo ' shred -zu /root/tempgnusocialdata/*' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo ' rm -rf /root/tempgnusocialdata' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo ' exit 853' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo 'shred -zu /root/tempgnusocialdata/*' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo 'rm -rf /root/tempgnusocialdata' >> /usr/bin/$BACKUP_SCRIPT_NAME + backup_directory_to_usb /root/tempgnusocialdata gnusocialdata echo 'echo "Backing up GNU social installation"' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo "rsyncrypto -v -r /var/www/$MICROBLOG_DOMAIN_NAME/htdocs $USB_MOUNT/backup/gnusocial $USB_MOUNT/backup/gnusocial.keys $BACKUP_CERTIFICATE" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo 'if [ ! "$?" = "0" ]; then' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo " umount $USB_MOUNT" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo " rm -rf $USB_MOUNT" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo ' exit 846' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME + backup_directory_to_usb /var/www/$MICROBLOG_DOMAIN_NAME/htdocs gnusocial echo '' >> /usr/bin/$BACKUP_SCRIPT_NAME fi if grep -Fxq "install_hubzilla" $COMPLETION_FILE; then @@ -2554,21 +2561,9 @@ function create_backup_script { echo " rm -rf $USB_MOUNT" >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' exit 378' >> /usr/bin/$BACKUP_SCRIPT_NAME echo "fi" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo "rsyncrypto -v -r /root/temphubzilladata $USB_MOUNT/backup/hubzilladata $USB_MOUNT/backup/hubzilladata.keys $BACKUP_CERTIFICATE" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo 'if [ ! "$?" = "0" ]; then' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo " umount $USB_MOUNT" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo " rm -rf $USB_MOUNT" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo ' exit 285' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo 'shred -zu /root/temphubzilladata/*' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo 'rm -rf /root/temphubzilladata' >> /usr/bin/$BACKUP_SCRIPT_NAME + backup_directory_to_usb /root/temphubzilladata hubzilladata echo 'echo "Backing up Hubzilla installation"' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo "rsyncrypto -v -r /var/www/$HUBZILLA_DOMAIN_NAME/htdocs $USB_MOUNT/backup/hubzilla $USB_MOUNT/backup/hubzilla.keys $BACKUP_CERTIFICATE" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo 'if [ ! "$?" = "0" ]; then' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo " umount $USB_MOUNT" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo " rm -rf $USB_MOUNT" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo ' exit 593' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME + backup_directory_to_usb /var/www/$HUBZILLA_DOMAIN_NAME/htdocs hubzilla echo '' >> /usr/bin/$BACKUP_SCRIPT_NAME fi if grep -Fxq "install_owncloud" $COMPLETION_FILE; then @@ -2597,27 +2592,10 @@ function create_backup_script { echo " rm -rf $USB_MOUNT" >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' exit 377' >> /usr/bin/$BACKUP_SCRIPT_NAME echo "fi" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo "rsyncrypto -v -r /root/tempownclouddata $USB_MOUNT/backup/ownclouddata $USB_MOUNT/backup/ownclouddata.keys $BACKUP_CERTIFICATE" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo 'if [ ! "$?" = "0" ]; then' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo " umount $USB_MOUNT" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo " rm -rf $USB_MOUNT" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo ' exit 188' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo 'shred -zu /root/tempownclouddata/*' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo 'rm -rf /root/tempownclouddata' >> /usr/bin/$BACKUP_SCRIPT_NAME + backup_directory_to_usb /root/tempownclouddata ownclouddata echo 'echo "Obtaining Owncloud data backup"' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo "rsyncrypto -v -r /var/lib/owncloud $USB_MOUNT/backup/owncloud $USB_MOUNT/backup/owncloud.keys $BACKUP_CERTIFICATE" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo 'if [ ! "$?" = "0" ]; then' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo " umount $USB_MOUNT" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo " rm -rf $USB_MOUNT" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo ' exit 632' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo "rsyncrypto -v -r /etc/owncloud $USB_MOUNT/backup/owncloud2 $USB_MOUNT/backup/owncloud2.keys $BACKUP_CERTIFICATE" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo 'if [ ! "$?" = "0" ]; then' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo " umount $USB_MOUNT" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo " rm -rf $USB_MOUNT" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo ' exit 632' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME + backup_directory_to_usb /var/lib/owncloud owncloud + backup_directory_to_usb /etc/owncloud owncloud2 echo '' >> /usr/bin/$BACKUP_SCRIPT_NAME fi if grep -Fxq "install_gogs" $COMPLETION_FILE; then @@ -2646,35 +2624,13 @@ function create_backup_script { echo " rm -rf $USB_MOUNT" >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' exit 377' >> /usr/bin/$BACKUP_SCRIPT_NAME echo "fi" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo "rsyncrypto -v -r /root/tempgogsdata $USB_MOUNT/backup/gogsdata $USB_MOUNT/backup/gogsdata.keys $BACKUP_CERTIFICATE" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo 'if [ ! "$?" = "0" ]; then' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo " umount $USB_MOUNT" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo " rm -rf $USB_MOUNT" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo ' exit 188' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo 'shred -zu /root/tempgogsdata/*' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo 'rm -rf /root/tempgogsdata' >> /usr/bin/$BACKUP_SCRIPT_NAME + backup_directory_to_usb /root/tempgogsdata gogsdata echo 'echo "Obtaining Gogs settings backup"' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo "rsyncrypto -v -r /home/git/go/src/github.com/gogits/gogs/custom $USB_MOUNT/backup/gogs $USB_MOUNT/backup/gogs.keys $BACKUP_CERTIFICATE" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo 'if [ ! "$?" = "0" ]; then' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo " umount $USB_MOUNT" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo " rm -rf $USB_MOUNT" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo ' exit 632' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME + backup_directory_to_usb /home/git/go/src/github.com/gogits/gogs/custom gogs echo 'echo "Obtaining Gogs repos backup"' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo "rsyncrypto -v -r /home/git/gogs-repositories $USB_MOUNT/backup/gogsrepos $USB_MOUNT/backup/gogsrepos.keys $BACKUP_CERTIFICATE" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo 'if [ ! "$?" = "0" ]; then' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo " umount $USB_MOUNT" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo " rm -rf $USB_MOUNT" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo ' exit 6784' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME + backup_directory_to_usb /home/git/gogs-repositories gogsrepos echo 'echo "Obtaining Gogs authorized_keys backup"' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo "rsyncrypto -v -r /home/git/.ssh $USB_MOUNT/backup/gogsssh $USB_MOUNT/backup/gogsssh.keys $BACKUP_CERTIFICATE" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo 'if [ ! "$?" = "0" ]; then' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo " umount $USB_MOUNT" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo " rm -rf $USB_MOUNT" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo ' exit 58932' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME + backup_directory_to_usb /home/git/.ssh gogsssh echo '' >> /usr/bin/$BACKUP_SCRIPT_NAME fi if grep -Fxq "install_wiki" $COMPLETION_FILE; then @@ -2685,18 +2641,8 @@ function create_backup_script { echo " mkdir -p $USB_MOUNT/backup/wiki2" >> /usr/bin/$BACKUP_SCRIPT_NAME echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME echo 'echo "Obtaining wiki data backup"' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo "rsyncrypto -v -r /var/lib/dokuwiki $USB_MOUNT/backup/wiki $USB_MOUNT/backup/wiki.keys $BACKUP_CERTIFICATE" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo 'if [ ! "$?" = "0" ]; then' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo " umount $USB_MOUNT" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo " rm -rf $USB_MOUNT" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo ' exit 964' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo "rsyncrypto -v -r /etc/dokuwiki $USB_MOUNT/backup/wiki2 $USB_MOUNT/backup/wiki2.keys $BACKUP_CERTIFICATE" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo 'if [ ! "$?" = "0" ]; then' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo " umount $USB_MOUNT" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo " rm -rf $USB_MOUNT" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo ' exit 964' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME + backup_directory_to_usb /var/lib/dokuwiki wiki + backup_directory_to_usb /etc/dokuwiki wiki2 echo '' >> /usr/bin/$BACKUP_SCRIPT_NAME fi if grep -Fxq "install_blog" $COMPLETION_FILE; then @@ -2704,12 +2650,7 @@ function create_backup_script { echo " mkdir -p $USB_MOUNT/backup/blog" >> /usr/bin/$BACKUP_SCRIPT_NAME echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME echo 'echo "Obtaining blog backup"' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo "rsyncrypto -v -r /var/www/$FULLBLOG_DOMAIN_NAME/htdocs $USB_MOUNT/backup/blog $USB_MOUNT/backup/blog.keys $BACKUP_CERTIFICATE" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo 'if [ ! "$?" = "0" ]; then' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo " umount $USB_MOUNT" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo " rm -rf $USB_MOUNT" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo ' exit 854' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME + backup_directory_to_usb /var/www/$FULLBLOG_DOMAIN_NAME/htdocs blog echo '' >> /usr/bin/$BACKUP_SCRIPT_NAME fi if grep -Fxq "mesh_cjdns" $COMPLETION_FILE; then @@ -2717,12 +2658,7 @@ function create_backup_script { echo " mkdir -p $USB_MOUNT/backup/cjdns" >> /usr/bin/$BACKUP_SCRIPT_NAME echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME echo 'echo "Obtaining cjdns backup"' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo "rsyncrypto -v -r /etc/cjdns $USB_MOUNT/backup/blog $USB_MOUNT/backup/cjdns.keys $BACKUP_CERTIFICATE" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo 'if [ ! "$?" = "0" ]; then' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo " umount $USB_MOUNT" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo " rm -rf $USB_MOUNT" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo ' exit 7438' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME + backup_directory_to_usb /etc/cjdns cjdns echo '' >> /usr/bin/$BACKUP_SCRIPT_NAME fi @@ -2733,12 +2669,7 @@ function create_backup_script { echo " if [ ! -d $USB_MOUNT/backup/ssl ]; then" >> /usr/bin/$BACKUP_SCRIPT_NAME echo " mkdir -p $USB_MOUNT/backup/ssl" >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' fi' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo " rsyncrypto -v -r /etc/ssl $USB_MOUNT/backup/ssl $USB_MOUNT/backup/ssl.keys $BACKUP_CERTIFICATE" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo ' if [ ! "$?" = "0" ]; then' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo " umount $USB_MOUNT" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo " rm -rf $USB_MOUNT" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo ' exit 343' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo ' fi' >> /usr/bin/$BACKUP_SCRIPT_NAME + backup_directory_to_usb /etc/ssl ssl echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME echo '' >> /usr/bin/$BACKUP_SCRIPT_NAME @@ -2748,13 +2679,7 @@ function create_backup_script { echo " if [ ! -d $USB_MOUNT/backup/projects ]; then" >> /usr/bin/$BACKUP_SCRIPT_NAME echo " mkdir -p $USB_MOUNT/backup/projects" >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' fi' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo -n ' rsyncrypto -v -r /home/$MY_USERNAME/projects ' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo "$USB_MOUNT/backup/projects $USB_MOUNT/backup/projects.keys $BACKUP_CERTIFICATE" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo ' if [ ! "$?" = "0" ]; then' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo " umount $USB_MOUNT" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo " rm -rf $USB_MOUNT" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo ' exit 873' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo ' fi' >> /usr/bin/$BACKUP_SCRIPT_NAME + backup_directory_to_usb '/home/$MY_USERNAME/projects' projects echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME echo '' >> /usr/bin/$BACKUP_SCRIPT_NAME @@ -2764,13 +2689,7 @@ function create_backup_script { echo " if [ ! -d $USB_MOUNT/backup/personal ]; then" >> /usr/bin/$BACKUP_SCRIPT_NAME echo " mkdir -p $USB_MOUNT/backup/personal" >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' fi' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo -n ' rsyncrypto -v -r /home/$MY_USERNAME/personal ' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo "$USB_MOUNT/backup/personal $USB_MOUNT/backup/personal.keys $BACKUP_CERTIFICATE" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo ' if [ ! "$?" = "0" ]; then' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo " umount $USB_MOUNT" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo " rm -rf $USB_MOUNT" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo ' exit 649' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo ' fi' >> /usr/bin/$BACKUP_SCRIPT_NAME + backup_directory_to_usb '/home/$MY_USERNAME/personal' personal echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME echo '' >> /usr/bin/$BACKUP_SCRIPT_NAME @@ -2780,12 +2699,7 @@ function create_backup_script { echo " if [ ! -d $USB_MOUNT/backup/mailinglist ]; then" >> /usr/bin/$BACKUP_SCRIPT_NAME echo " mkdir -p $USB_MOUNT/backup/mailinglist" >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' fi' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo " rsyncrypto -v -r $PUBLIC_MAILING_LIST_DIRECTORY $USB_MOUNT/backup/mailinglist $USB_MOUNT/backup/mailinglist.keys $BACKUP_CERTIFICATE" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo ' if [ ! "$?" = "0" ]; then' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo " umount $USB_MOUNT" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo " rm -rf $USB_MOUNT" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo ' exit 938' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo ' fi' >> /usr/bin/$BACKUP_SCRIPT_NAME + backup_directory_to_usb $PUBLIC_MAILING_LIST_DIRECTORY mailinglist echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME echo '' >> /usr/bin/$BACKUP_SCRIPT_NAME @@ -2795,12 +2709,7 @@ function create_backup_script { echo " if [ ! -d $USB_MOUNT/backup/xmpp ]; then" >> /usr/bin/$BACKUP_SCRIPT_NAME echo " mkdir -p $USB_MOUNT/backup/xmpp" >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' fi' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo " rsyncrypto -v -r $XMPP_DIRECTORY $USB_MOUNT/backup/xmpp $USB_MOUNT/backup/xmpp.keys $BACKUP_CERTIFICATE" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo ' if [ ! "$?" = "0" ]; then' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo " umount $USB_MOUNT" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo " rm -rf $USB_MOUNT" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo ' exit 593' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo ' fi' >> /usr/bin/$BACKUP_SCRIPT_NAME + backup_directory_to_usb $XMPP_DIRECTORY xmpp echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME echo '' >> /usr/bin/$BACKUP_SCRIPT_NAME @@ -2810,13 +2719,7 @@ function create_backup_script { echo " if [ ! -d $USB_MOUNT/backup/gnupg ]; then" >> /usr/bin/$BACKUP_SCRIPT_NAME echo " mkdir -p $USB_MOUNT/backup/gnupg" >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' fi' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo -n ' rsyncrypto -v -r /home/$MY_USERNAME/.gnupg ' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo "$USB_MOUNT/backup/gnupg $USB_MOUNT/backup/gnupg.keys $BACKUP_CERTIFICATE" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo ' if [ ! "$?" = "0" ]; then' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo " umount $USB_MOUNT" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo " rm -rf $USB_MOUNT" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo ' exit 491' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo ' fi' >> /usr/bin/$BACKUP_SCRIPT_NAME + backup_directory_to_usb '/home/$MY_USERNAME/.gnupg' gnupg echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME echo '' >> /usr/bin/$BACKUP_SCRIPT_NAME @@ -2826,13 +2729,7 @@ function create_backup_script { echo " if [ ! -d $USB_MOUNT/backup/ssh ]; then" >> /usr/bin/$BACKUP_SCRIPT_NAME echo " mkdir -p $USB_MOUNT/backup/ssh" >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' fi' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo -n ' rsyncrypto -v -r /home/$MY_USERNAME/.ssh ' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo "$USB_MOUNT/backup/ssh $USB_MOUNT/backup/ssh.keys $BACKUP_CERTIFICATE" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo ' if [ ! "$?" = "0" ]; then' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo " umount $USB_MOUNT" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo " rm -rf $USB_MOUNT" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo ' exit 731' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo ' fi' >> /usr/bin/$BACKUP_SCRIPT_NAME + backup_directory_to_usb '/home/$MY_USERNAME/.ssh' ssh echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME echo '' >> /usr/bin/$BACKUP_SCRIPT_NAME @@ -2842,12 +2739,7 @@ function create_backup_script { echo " if [ ! -d $USB_MOUNT/backup/web ]; then" >> /usr/bin/$BACKUP_SCRIPT_NAME echo " mkdir -p $USB_MOUNT/backup/web" >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' fi' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo " rsyncrypto -v -r /etc/nginx/sites-available $USB_MOUNT/backup/web $USB_MOUNT/backup/web.keys $BACKUP_CERTIFICATE" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo ' if [ ! "$?" = "0" ]; then' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo " umount $USB_MOUNT" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo " rm -rf $USB_MOUNT" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo ' exit 848' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo ' fi' >> /usr/bin/$BACKUP_SCRIPT_NAME + backup_directory_to_usb /etc/nginx/sites-available web echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME echo '' >> /usr/bin/$BACKUP_SCRIPT_NAME @@ -2861,14 +2753,7 @@ function create_backup_script { echo ' mkdir -p /home/$MY_USERNAME/tempbackup' >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' fi' >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' cp -f /home/$MY_USERNAME/README /home/$MY_USERNAME/tempbackup' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo -n ' rsyncrypto -v -r /home/$MY_USERNAME/tempbackup ' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo "$USB_MOUNT/backup/readme $USB_MOUNT/backup/readme.keys $BACKUP_CERTIFICATE" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo ' if [ ! "$?" = "0" ]; then' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo " umount $USB_MOUNT" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo " rm -rf $USB_MOUNT" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo ' rm -rf /home/$MY_USERNAME/tempbackup' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo ' exit 848' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo ' fi' >> /usr/bin/$BACKUP_SCRIPT_NAME + backup_directory_to_usb '/home/$MY_USERNAME/tempbackup' readme echo ' rm -rf /home/$MY_USERNAME/tempbackup' >> /usr/bin/$BACKUP_SCRIPT_NAME echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME echo '' >> /usr/bin/$BACKUP_SCRIPT_NAME @@ -2886,14 +2771,7 @@ function create_backup_script { echo " if [ ! -d $USB_MOUNT/backup/mutt ]; then" >> /usr/bin/$BACKUP_SCRIPT_NAME echo " mkdir -p $USB_MOUNT/backup/mutt" >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' fi' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo -n ' rsyncrypto -v -r /home/$MY_USERNAME/tempbackup ' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo "$USB_MOUNT/backup/mutt $USB_MOUNT/backup/mutt.keys $BACKUP_CERTIFICATE" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo ' if [ ! "$?" = "0" ]; then' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo " umount $USB_MOUNT" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo " rm -rf $USB_MOUNT" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo ' rm -rf /home/$MY_USERNAME/tempbackup' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo ' exit 492' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo ' fi' >> /usr/bin/$BACKUP_SCRIPT_NAME + backup_directory_to_usb '/home/$MY_USERNAME/tempbackup' mutt echo ' rm -rf /home/$MY_USERNAME/tempbackup' >> /usr/bin/$BACKUP_SCRIPT_NAME echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME echo '' >> /usr/bin/$BACKUP_SCRIPT_NAME @@ -2908,14 +2786,7 @@ function create_backup_script { echo " if [ ! -d $USB_MOUNT/backup/procmail ]; then" >> /usr/bin/$BACKUP_SCRIPT_NAME echo " mkdir -p $USB_MOUNT/backup/procmail" >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' fi' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo -n ' rsyncrypto -v -r /home/$MY_USERNAME/tempbackup ' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo "$USB_MOUNT/backup/procmail $USB_MOUNT/backup/procmail.keys $BACKUP_CERTIFICATE" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo ' if [ ! "$?" = "0" ]; then' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo " umount $USB_MOUNT" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo " rm -rf $USB_MOUNT" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo ' rm -rf /home/$MY_USERNAME/tempbackup' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo ' exit 492' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo ' fi' >> /usr/bin/$BACKUP_SCRIPT_NAME + backup_directory_to_usb '/home/$MY_USERNAME/tempbackup' procmail echo ' rm -rf /home/$MY_USERNAME/tempbackup' >> /usr/bin/$BACKUP_SCRIPT_NAME echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME echo '' >> /usr/bin/$BACKUP_SCRIPT_NAME @@ -2926,35 +2797,22 @@ function create_backup_script { echo " if [ ! -d $USB_MOUNT/backup/spamassassin ]; then" >> /usr/bin/$BACKUP_SCRIPT_NAME echo " mkdir -p $USB_MOUNT/backup/spamassassin" >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' fi' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo -n ' rsyncrypto -v -r /home/$MY_USERNAME/.spamassassin ' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo "$USB_MOUNT/backup/spamassassin $USB_MOUNT/backup/spamassassin.keys $BACKUP_CERTIFICATE" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo ' if [ ! "$?" = "0" ]; then' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo " umount $USB_MOUNT" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo " rm -rf $USB_MOUNT" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo ' exit 492' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo ' fi' >> /usr/bin/$BACKUP_SCRIPT_NAME + backup_directory_to_usb '/home/$MY_USERNAME/.spamassassin' spamassassin echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME echo '' >> /usr/bin/$BACKUP_SCRIPT_NAME echo '# Backup email' >> /usr/bin/$BACKUP_SCRIPT_NAME echo 'if [ -d /home/$MY_USERNAME/Maildir ]; then' >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' echo "Creating an email archive"' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo ' if [ ! -d /root/backupemail ]; then' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo " mkdir -p /root/backupemail" >> /usr/bin/$BACKUP_SCRIPT_NAME + echo ' if [ ! -d /root/tempbackupemail ]; then' >> /usr/bin/$BACKUP_SCRIPT_NAME + echo " mkdir -p /root/tempbackupemail" >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' fi' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo ' tar -czvf /root/backupemail/maildir.tar.gz /home/$MY_USERNAME/Maildir' >> /usr/bin/$BACKUP_SCRIPT_NAME + echo ' tar -czvf /root/tempbackupemail/maildir.tar.gz /home/$MY_USERNAME/Maildir' >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' echo "Backing up emails"' >> /usr/bin/$BACKUP_SCRIPT_NAME echo " if [ ! -d $USB_MOUNT/backup/mail ]; then" >> /usr/bin/$BACKUP_SCRIPT_NAME echo " mkdir -p $USB_MOUNT/backup/mail" >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' fi' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo " rsyncrypto -v -r /root/backupemail $USB_MOUNT/backup/mail $USB_MOUNT/backup/mail.keys $BACKUP_CERTIFICATE" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo ' if [ ! "$?" = "0" ]; then' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo " umount $USB_MOUNT" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo " rm -rf $USB_MOUNT" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo ' rm -rf /root/backupemail' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo ' exit 396' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo ' fi' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo ' rm -rf /root/backupemail' >> /usr/bin/$BACKUP_SCRIPT_NAME + backup_directory_to_usb /root/tempbackupemail mail echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME echo '' >> /usr/bin/$BACKUP_SCRIPT_NAME @@ -2964,12 +2822,7 @@ function create_backup_script { echo " if [ ! -d $USB_MOUNT/backup/dlna ]; then" >> /usr/bin/$BACKUP_SCRIPT_NAME echo " mkdir -p $USB_MOUNT/backup/dlna" >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' fi' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo " rsyncrypto -v -r /var/cache/minidlna $USB_MOUNT/backup/dlna $USB_MOUNT/backup/dlna.keys $BACKUP_CERTIFICATE" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo ' if [ ! "$?" = "0" ]; then' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo " umount $USB_MOUNT" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo " rm -rf $USB_MOUNT" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo ' exit 498' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo ' fi' >> /usr/bin/$BACKUP_SCRIPT_NAME + backup_directory_to_usb /var/cache/minidlna dlna echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME echo '' >> /usr/bin/$BACKUP_SCRIPT_NAME @@ -2986,14 +2839,7 @@ function create_backup_script { echo " if [ ! -d $USB_MOUNT/backup/voip ]; then" >> /usr/bin/$BACKUP_SCRIPT_NAME echo " mkdir -p $USB_MOUNT/backup/voip" >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' fi' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo -n ' rsyncrypto -v -r /home/$MY_USERNAME/tempbackup ' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo "$USB_MOUNT/backup/voip $USB_MOUNT/backup/voip.keys $BACKUP_CERTIFICATE" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo ' if [ ! "$?" = "0" ]; then' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo " umount $USB_MOUNT" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo " rm -rf $USB_MOUNT" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo ' rm -rf /home/$MY_USERNAME/tempbackup' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo ' exit 2492' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo ' fi' >> /usr/bin/$BACKUP_SCRIPT_NAME + backup_directory_to_usb '/home/$MY_USERNAME/tempbackup' voip echo ' rm -rf /home/$MY_USERNAME/tempbackup' >> /usr/bin/$BACKUP_SCRIPT_NAME echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME echo '' >> /usr/bin/$BACKUP_SCRIPT_NAME @@ -3016,14 +2862,7 @@ function create_backup_script { echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME echo 'echo "$DATABASE_PASSWORD" > /root/tempmariadb/db' >> /usr/bin/$BACKUP_SCRIPT_NAME echo 'chmod 400 /root/tempmariadb/db' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo "rsyncrypto -v -r /root/tempmariadb $USB_MOUNT/backup/mariadb $USB_MOUNT/backup/mariadb.keys $BACKUP_CERTIFICATE" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo 'if [ ! "$?" = "0" ]; then' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo " umount $USB_MOUNT" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo " rm -rf $USB_MOUNT" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo ' exit 794' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo 'shred -zu /root/tempmariadb/*' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo 'rm -rf /root/tempmariadb' >> /usr/bin/$BACKUP_SCRIPT_NAME + backup_directory_to_usb /root/tempmariadb mariadb echo '' >> /usr/bin/$BACKUP_SCRIPT_NAME fi @@ -3034,12 +2873,7 @@ function create_backup_script { echo " mkdir -p $USB_MOUNT/backup/tox" >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' fi' >> /usr/bin/$BACKUP_SCRIPT_NAME echo " cp /etc/tox-bootstrapd.conf /var/lib/tox-bootstrapd" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo " rsyncrypto -v -r /var/lib/tox-bootstrapd $USB_MOUNT/backup/tox $USB_MOUNT/backup/tox.keys $BACKUP_CERTIFICATE" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo ' if [ ! "$?" = "0" ]; then' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo " umount $USB_MOUNT" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo " rm -rf $USB_MOUNT" >> /usr/bin/$BACKUP_SCRIPT_NAME - echo ' exit 75379' >> /usr/bin/$BACKUP_SCRIPT_NAME - echo ' fi' >> /usr/bin/$BACKUP_SCRIPT_NAME + backup_directory_to_usb /var/lib/tox-bootstrapd tox echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME echo '' >> /usr/bin/$BACKUP_SCRIPT_NAME