Better implementation of usb mount in local backup

This commit is contained in:
Bob Mottram 2015-09-25 22:36:44 +01:00
parent c0b7f49a8f
commit bb27e4a0b1
1 changed files with 172 additions and 172 deletions

View File

@ -2418,7 +2418,6 @@ function get_mariadb_owncloud_admin_password {
function backup_directory_to_usb { function backup_directory_to_usb {
echo 'function backup_directory_to_usb {' >> /usr/bin/$BACKUP_SCRIPT_NAME echo 'function backup_directory_to_usb {' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo " MY_NAME=\"$MY_NAME\"" >> /usr/bin/$BACKUP_SCRIPT_NAME echo " MY_NAME=\"$MY_NAME\"" >> /usr/bin/$BACKUP_SCRIPT_NAME
echo " USB_MOUNT=$USB_MOUNT" >> /usr/bin/$BACKUP_SCRIPT_NAME
echo '' >> /usr/bin/$BACKUP_SCRIPT_NAME echo '' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo ' if [ ! -d ${1} ]; then' >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' if [ ! -d ${1} ]; then' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo ' echo "WARNING: directory does not exist: ${1}"' >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' echo "WARNING: directory does not exist: ${1}"' >> /usr/bin/$BACKUP_SCRIPT_NAME
@ -2458,8 +2457,6 @@ function backup_directory_to_usb {
function backup_database { function backup_database {
echo '' >> /usr/bin/$BACKUP_SCRIPT_NAME echo '' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo 'function backup_database {' >> /usr/bin/$BACKUP_SCRIPT_NAME echo 'function backup_database {' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo " USB_MOUNT=$USB_MOUNT" >> /usr/bin/$BACKUP_SCRIPT_NAME
echo " DATABASE_PASSWORD='$DATABASE_PASSWORD'" >> /usr/bin/$BACKUP_SCRIPT_NAME
echo ' if [ ! -d $USB_MOUNT/backup/${1} ]; then' >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' if [ ! -d $USB_MOUNT/backup/${1} ]; then' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo ' mkdir -p $USB_MOUNT/backup/${1}' >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' mkdir -p $USB_MOUNT/backup/${1}' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo ' fi' >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' fi' >> /usr/bin/$BACKUP_SCRIPT_NAME
@ -2504,6 +2501,7 @@ function create_backup_script {
echo 'if [ $1 ]; then' >> /usr/bin/$BACKUP_SCRIPT_NAME echo 'if [ $1 ]; then' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo ' USB_DRIVE=/dev/${1}1' >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' USB_DRIVE=/dev/${1}1' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo "USB_MOUNT=$USB_MOUNT" >> /usr/bin/$BACKUP_SCRIPT_NAME
echo '' >> /usr/bin/$BACKUP_SCRIPT_NAME echo '' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo "ADMIN_USERNAME=$MY_USERNAME" >> /usr/bin/$BACKUP_SCRIPT_NAME echo "ADMIN_USERNAME=$MY_USERNAME" >> /usr/bin/$BACKUP_SCRIPT_NAME
echo "MY_USERNAME=$MY_USERNAME" >> /usr/bin/$BACKUP_SCRIPT_NAME echo "MY_USERNAME=$MY_USERNAME" >> /usr/bin/$BACKUP_SCRIPT_NAME
@ -2516,9 +2514,9 @@ function create_backup_script {
echo ' exit 1' >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' exit 1' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo '' >> /usr/bin/$BACKUP_SCRIPT_NAME echo '' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo "umount -f $USB_MOUNT" >> /usr/bin/$BACKUP_SCRIPT_NAME echo 'umount -f $USB_MOUNT' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo "if [ ! -d $USB_MOUNT ]; 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 ' mkdir $USB_MOUNT' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo 'if [ -f /dev/mapper/encrypted_usb ]; then' >> /usr/bin/$BACKUP_SCRIPT_NAME echo 'if [ -f /dev/mapper/encrypted_usb ]; then' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo ' rm -rf /dev/mapper/encrypted_usb' >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' rm -rf /dev/mapper/encrypted_usb' >> /usr/bin/$BACKUP_SCRIPT_NAME
@ -2529,21 +2527,27 @@ function create_backup_script {
echo ' USB_DRIVE=/dev/mapper/encrypted_usb' >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' USB_DRIVE=/dev/mapper/encrypted_usb' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo -n 'mount $USB_DRIVE ' >> /usr/bin/$BACKUP_SCRIPT_NAME echo -n 'mount $USB_DRIVE ' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo "$USB_MOUNT" >> /usr/bin/$BACKUP_SCRIPT_NAME echo '$USB_MOUNT' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo 'if [ ! "$?" = "0" ]; then' >> /usr/bin/$BACKUP_SCRIPT_NAME echo 'if [ ! "$?" = "0" ]; then' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo " echo 'There was a problem mounting the USB drive to $USB_MOUNT'" >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' echo "There was a problem mounting the USB drive to $USB_MOUNT"' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo " rm -rf $USB_MOUNT" >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' rm -rf $USB_MOUNT' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo ' exit 6392' >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' exit 6392' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo 'fi' >> /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 'if [ ! -d $USB_MOUNT/backup ]; then' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo " mkdir $USB_MOUNT/backup" >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' mkdir $USB_MOUNT/backup' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo 'fi' >> /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 'if [ ! -d $USB_MOUNT/backup ]; then' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo " echo 'There was a problem making the directory $USB_MOUNT/backup.'" >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' echo "There was a problem making the directory $USB_MOUNT/backup."' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo " umount $USB_MOUNT" >> /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 $USB_MOUNT' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo ' exit 27' >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' exit 27' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo '# MariaDB password' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo -n 'DATABASE_PASSWORD=$(cat ' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo "$DATABASE_PASSWORD_FILE)" >> /usr/bin/$BACKUP_SCRIPT_NAME
echo '' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo '' >> /usr/bin/$BACKUP_SCRIPT_NAME echo '' >> /usr/bin/$BACKUP_SCRIPT_NAME
backup_database backup_database
echo '' >> /usr/bin/$BACKUP_SCRIPT_NAME echo '' >> /usr/bin/$BACKUP_SCRIPT_NAME
@ -2560,14 +2564,11 @@ function create_backup_script {
echo ' echo "GPG encrypt the backup key"' >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' echo "GPG encrypt the backup key"' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo " gpg -c $BACKUP_CERTIFICATE" >> /usr/bin/$BACKUP_SCRIPT_NAME echo " gpg -c $BACKUP_CERTIFICATE" >> /usr/bin/$BACKUP_SCRIPT_NAME
echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo "cp $BACKUP_CERTIFICATE.gpg $USB_MOUNT/backup/key.gpg" >> /usr/bin/$BACKUP_SCRIPT_NAME echo -n "cp $BACKUP_CERTIFICATE.gpg " >> /usr/bin/$BACKUP_SCRIPT_NAME
echo '$USB_MOUNT/backup/key.gpg' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo '' >> /usr/bin/$BACKUP_SCRIPT_NAME echo '' >> /usr/bin/$BACKUP_SCRIPT_NAME
fi fi
echo '# MariaDB password' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo -n 'DATABASE_PASSWORD=$(cat ' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo "$DATABASE_PASSWORD_FILE)" >> /usr/bin/$BACKUP_SCRIPT_NAME
echo '' >> /usr/bin/$BACKUP_SCRIPT_NAME
if grep -Fxq "install_gnu_social" $COMPLETION_FILE; then if grep -Fxq "install_gnu_social" $COMPLETION_FILE; then
BACKUP_INCLUDES_DATABASES="yes" BACKUP_INCLUDES_DATABASES="yes"
echo 'backup_database gnusocial' >> /usr/bin/$BACKUP_SCRIPT_NAME echo 'backup_database gnusocial' >> /usr/bin/$BACKUP_SCRIPT_NAME
@ -2586,8 +2587,8 @@ function create_backup_script {
fi fi
if grep -Fxq "install_owncloud" $COMPLETION_FILE; then if grep -Fxq "install_owncloud" $COMPLETION_FILE; then
BACKUP_INCLUDES_DATABASES="yes" BACKUP_INCLUDES_DATABASES="yes"
echo "if [ ! -d $USB_MOUNT/backup/owncloud2 ]; then" >> /usr/bin/$BACKUP_SCRIPT_NAME echo 'if [ ! -d $USB_MOUNT/backup/owncloud2 ]; then' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo " mkdir -p $USB_MOUNT/backup/owncloud2" >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' mkdir -p $USB_MOUNT/backup/owncloud2' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo 'backup_database owncloud' >> /usr/bin/$BACKUP_SCRIPT_NAME echo 'backup_database owncloud' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo 'backup_directory_to_usb /root/tempownclouddata ownclouddata' >> /usr/bin/$BACKUP_SCRIPT_NAME echo 'backup_directory_to_usb /root/tempownclouddata ownclouddata' >> /usr/bin/$BACKUP_SCRIPT_NAME
@ -2598,11 +2599,11 @@ function create_backup_script {
fi fi
if grep -Fxq "install_gogs" $COMPLETION_FILE; then if grep -Fxq "install_gogs" $COMPLETION_FILE; then
BACKUP_INCLUDES_DATABASES="yes" BACKUP_INCLUDES_DATABASES="yes"
echo "if [ ! -d $USB_MOUNT/backup/gogsrepos ]; then" >> /usr/bin/$BACKUP_SCRIPT_NAME echo 'if [ ! -d $USB_MOUNT/backup/gogsrepos ]; then' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo " mkdir -p $USB_MOUNT/backup/gogsrepos" >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' mkdir -p $USB_MOUNT/backup/gogsrepos' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo "if [ ! -d $USB_MOUNT/backup/gogsssh ]; then" >> /usr/bin/$BACKUP_SCRIPT_NAME echo 'if [ ! -d $USB_MOUNT/backup/gogsssh ]; then' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo " mkdir -p $USB_MOUNT/backup/gogsssh" >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' mkdir -p $USB_MOUNT/backup/gogsssh' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo 'backup_database gogs' >> /usr/bin/$BACKUP_SCRIPT_NAME echo 'backup_database gogs' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo 'backup_directory_to_usb /root/tempgogsdata gogsdata' >> /usr/bin/$BACKUP_SCRIPT_NAME echo 'backup_directory_to_usb /root/tempgogsdata gogsdata' >> /usr/bin/$BACKUP_SCRIPT_NAME
@ -2616,11 +2617,11 @@ function create_backup_script {
echo '' >> /usr/bin/$BACKUP_SCRIPT_NAME echo '' >> /usr/bin/$BACKUP_SCRIPT_NAME
fi fi
if grep -Fxq "install_wiki" $COMPLETION_FILE; then if grep -Fxq "install_wiki" $COMPLETION_FILE; then
echo "if [ ! -d $USB_MOUNT/backup/wiki ]; then" >> /usr/bin/$BACKUP_SCRIPT_NAME echo 'if [ ! -d $USB_MOUNT/backup/wiki ]; then' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo " mkdir -p $USB_MOUNT/backup/wiki" >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' mkdir -p $USB_MOUNT/backup/wiki' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo "if [ ! -d $USB_MOUNT/backup/wiki2 ]; then" >> /usr/bin/$BACKUP_SCRIPT_NAME echo 'if [ ! -d $USB_MOUNT/backup/wiki2 ]; then' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo " mkdir -p $USB_MOUNT/backup/wiki2" >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' mkdir -p $USB_MOUNT/backup/wiki2' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo 'echo "Obtaining wiki data backup"' >> /usr/bin/$BACKUP_SCRIPT_NAME echo 'echo "Obtaining wiki data backup"' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo 'backup_directory_to_usb /var/lib/dokuwiki wiki' >> /usr/bin/$BACKUP_SCRIPT_NAME echo 'backup_directory_to_usb /var/lib/dokuwiki wiki' >> /usr/bin/$BACKUP_SCRIPT_NAME
@ -2628,16 +2629,16 @@ function create_backup_script {
echo '' >> /usr/bin/$BACKUP_SCRIPT_NAME echo '' >> /usr/bin/$BACKUP_SCRIPT_NAME
fi fi
if grep -Fxq "install_blog" $COMPLETION_FILE; then if grep -Fxq "install_blog" $COMPLETION_FILE; then
echo "if [ ! -d $USB_MOUNT/backup/blog ]; then" >> /usr/bin/$BACKUP_SCRIPT_NAME echo 'if [ ! -d $USB_MOUNT/backup/blog ]; then' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo " mkdir -p $USB_MOUNT/backup/blog" >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' mkdir -p $USB_MOUNT/backup/blog' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo 'echo "Obtaining blog backup"' >> /usr/bin/$BACKUP_SCRIPT_NAME echo 'echo "Obtaining blog backup"' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo "backup_directory_to_usb /var/www/$FULLBLOG_DOMAIN_NAME/htdocs blog" >> /usr/bin/$BACKUP_SCRIPT_NAME echo "backup_directory_to_usb /var/www/$FULLBLOG_DOMAIN_NAME/htdocs blog" >> /usr/bin/$BACKUP_SCRIPT_NAME
echo '' >> /usr/bin/$BACKUP_SCRIPT_NAME echo '' >> /usr/bin/$BACKUP_SCRIPT_NAME
fi fi
if grep -Fxq "mesh_cjdns" $COMPLETION_FILE; then if grep -Fxq "mesh_cjdns" $COMPLETION_FILE; then
echo "if [ ! -d $USB_MOUNT/backup/cjdns ]; then" >> /usr/bin/$BACKUP_SCRIPT_NAME echo 'if [ ! -d $USB_MOUNT/backup/cjdns ]; then' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo " mkdir -p $USB_MOUNT/backup/cjdns" >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' mkdir -p $USB_MOUNT/backup/cjdns' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo 'echo "Obtaining cjdns backup"' >> /usr/bin/$BACKUP_SCRIPT_NAME echo 'echo "Obtaining cjdns backup"' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo 'backup_directory_to_usb /etc/cjdns cjdns' >> /usr/bin/$BACKUP_SCRIPT_NAME echo 'backup_directory_to_usb /etc/cjdns cjdns' >> /usr/bin/$BACKUP_SCRIPT_NAME
@ -2648,8 +2649,8 @@ function create_backup_script {
echo '# Backup certificates' >> /usr/bin/$BACKUP_SCRIPT_NAME echo '# Backup certificates' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo "if [ -d /etc/ssl ]; then" >> /usr/bin/$BACKUP_SCRIPT_NAME echo "if [ -d /etc/ssl ]; then" >> /usr/bin/$BACKUP_SCRIPT_NAME
echo ' echo "Backing up certificates"' >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' echo "Backing up certificates"' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo " if [ ! -d $USB_MOUNT/backup/ssl ]; then" >> /usr/bin/$BACKUP_SCRIPT_NAME 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 ' mkdir -p $USB_MOUNT/backup/ssl' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo ' fi' >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' fi' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo ' backup_directory_to_usb /etc/ssl ssl' >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' backup_directory_to_usb /etc/ssl ssl' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME
@ -2658,8 +2659,8 @@ function create_backup_script {
echo '# Backup projects' >> /usr/bin/$BACKUP_SCRIPT_NAME echo '# Backup projects' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo 'if [ -d /home/$MY_USERNAME/projects ]; then' >> /usr/bin/$BACKUP_SCRIPT_NAME echo 'if [ -d /home/$MY_USERNAME/projects ]; then' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo ' echo "Backing up projects"' >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' echo "Backing up projects"' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo " if [ ! -d $USB_MOUNT/backup/projects ]; then" >> /usr/bin/$BACKUP_SCRIPT_NAME 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 ' mkdir -p $USB_MOUNT/backup/projects' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo ' fi' >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' fi' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo ' backup_directory_to_usb /home/$MY_USERNAME/projects projects' >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' backup_directory_to_usb /home/$MY_USERNAME/projects projects' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME
@ -2668,8 +2669,8 @@ function create_backup_script {
echo '# Backup personal settings' >> /usr/bin/$BACKUP_SCRIPT_NAME echo '# Backup personal settings' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo 'if [ -d /home/$MY_USERNAME/personal ]; then' >> /usr/bin/$BACKUP_SCRIPT_NAME echo 'if [ -d /home/$MY_USERNAME/personal ]; then' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo ' echo "Backing up personal settings"' >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' echo "Backing up personal settings"' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo " if [ ! -d $USB_MOUNT/backup/personal ]; then" >> /usr/bin/$BACKUP_SCRIPT_NAME 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 ' mkdir -p $USB_MOUNT/backup/personal' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo ' fi' >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' fi' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo ' backup_directory_to_usb /home/$MY_USERNAME/personal personal' >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' backup_directory_to_usb /home/$MY_USERNAME/personal personal' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME
@ -2678,8 +2679,8 @@ function create_backup_script {
echo '# Backup the public mailing list' >> /usr/bin/$BACKUP_SCRIPT_NAME echo '# Backup the public mailing list' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo "if [ -d $PUBLIC_MAILING_LIST_DIRECTORY ]; then" >> /usr/bin/$BACKUP_SCRIPT_NAME echo "if [ -d $PUBLIC_MAILING_LIST_DIRECTORY ]; then" >> /usr/bin/$BACKUP_SCRIPT_NAME
echo ' echo "Backing up the public mailing list"' >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' echo "Backing up the public mailing list"' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo " if [ ! -d $USB_MOUNT/backup/mailinglist ]; then" >> /usr/bin/$BACKUP_SCRIPT_NAME 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 ' mkdir -p $USB_MOUNT/backup/mailinglist' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo ' fi' >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' fi' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo " backup_directory_to_usb $PUBLIC_MAILING_LIST_DIRECTORY mailinglist" >> /usr/bin/$BACKUP_SCRIPT_NAME echo " backup_directory_to_usb $PUBLIC_MAILING_LIST_DIRECTORY mailinglist" >> /usr/bin/$BACKUP_SCRIPT_NAME
echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME
@ -2688,8 +2689,8 @@ function create_backup_script {
echo '# Backup xmpp settings' >> /usr/bin/$BACKUP_SCRIPT_NAME echo '# Backup xmpp settings' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo "if [ -d $XMPP_DIRECTORY ]; then" >> /usr/bin/$BACKUP_SCRIPT_NAME echo "if [ -d $XMPP_DIRECTORY ]; then" >> /usr/bin/$BACKUP_SCRIPT_NAME
echo ' echo "Backing up the XMPP settings"' >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' echo "Backing up the XMPP settings"' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo " if [ ! -d $USB_MOUNT/backup/xmpp ]; then" >> /usr/bin/$BACKUP_SCRIPT_NAME 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 ' mkdir -p $USB_MOUNT/backup/xmpp' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo ' fi' >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' fi' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo " backup_directory_to_usb $XMPP_DIRECTORY xmpp" >> /usr/bin/$BACKUP_SCRIPT_NAME echo " backup_directory_to_usb $XMPP_DIRECTORY xmpp" >> /usr/bin/$BACKUP_SCRIPT_NAME
echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME
@ -2698,8 +2699,8 @@ function create_backup_script {
echo '# Backup gpg keys' >> /usr/bin/$BACKUP_SCRIPT_NAME echo '# Backup gpg keys' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo 'if [ -d /home/$MY_USERNAME/.gnupg ]; then' >> /usr/bin/$BACKUP_SCRIPT_NAME echo 'if [ -d /home/$MY_USERNAME/.gnupg ]; then' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo ' echo "Backing up gpg keys"' >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' echo "Backing up gpg keys"' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo " if [ ! -d $USB_MOUNT/backup/gnupg ]; then" >> /usr/bin/$BACKUP_SCRIPT_NAME 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 ' mkdir -p $USB_MOUNT/backup/gnupg' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo ' fi' >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' fi' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo ' backup_directory_to_usb /home/$MY_USERNAME/.gnupg gnupg' >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' backup_directory_to_usb /home/$MY_USERNAME/.gnupg gnupg' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME
@ -2708,8 +2709,8 @@ function create_backup_script {
echo '# Backup ssh keys' >> /usr/bin/$BACKUP_SCRIPT_NAME echo '# Backup ssh keys' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo 'if [ -d /home/$MY_USERNAME/.ssh ]; then' >> /usr/bin/$BACKUP_SCRIPT_NAME echo 'if [ -d /home/$MY_USERNAME/.ssh ]; then' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo ' echo "Backing up ssh keys"' >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' echo "Backing up ssh keys"' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo " if [ ! -d $USB_MOUNT/backup/ssh ]; then" >> /usr/bin/$BACKUP_SCRIPT_NAME 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 ' mkdir -p $USB_MOUNT/backup/ssh' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo ' fi' >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' fi' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo ' backup_directory_to_usb /home/$MY_USERNAME/.ssh ssh' >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' backup_directory_to_usb /home/$MY_USERNAME/.ssh ssh' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME
@ -2718,8 +2719,8 @@ function create_backup_script {
echo '# Backup web sites' >> /usr/bin/$BACKUP_SCRIPT_NAME echo '# Backup web sites' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo "if [ -d /etc/nginx ]; then" >> /usr/bin/$BACKUP_SCRIPT_NAME echo "if [ -d /etc/nginx ]; then" >> /usr/bin/$BACKUP_SCRIPT_NAME
echo ' echo "Backing up web settings"' >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' echo "Backing up web settings"' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo " if [ ! -d $USB_MOUNT/backup/web ]; then" >> /usr/bin/$BACKUP_SCRIPT_NAME 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 ' mkdir -p $USB_MOUNT/backup/web' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo ' fi' >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' fi' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo ' backup_directory_to_usb /etc/nginx/sites-available web' >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' backup_directory_to_usb /etc/nginx/sites-available web' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME
@ -2728,8 +2729,8 @@ function create_backup_script {
echo '# Backup README file' >> /usr/bin/$BACKUP_SCRIPT_NAME echo '# Backup README file' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo 'if [ -f /home/$MY_USERNAME/README ]; then' >> /usr/bin/$BACKUP_SCRIPT_NAME echo 'if [ -f /home/$MY_USERNAME/README ]; then' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo ' echo "Backing up README"' >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' echo "Backing up README"' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo " if [ ! -d $USB_MOUNT/backup/readme ]; then" >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' if [ ! -d $USB_MOUNT/backup/readme ]; then' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo " mkdir -p $USB_MOUNT/backup/readme" >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' mkdir -p $USB_MOUNT/backup/readme' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo ' fi' >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' fi' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo ' if [ ! -d /home/$MY_USERNAME/tempbackup ]; then' >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' if [ ! -d /home/$MY_USERNAME/tempbackup ]; then' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo ' mkdir -p /home/$MY_USERNAME/tempbackup' >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' mkdir -p /home/$MY_USERNAME/tempbackup' >> /usr/bin/$BACKUP_SCRIPT_NAME
@ -2742,8 +2743,8 @@ function create_backup_script {
echo '# Backup IPFS' >> /usr/bin/$BACKUP_SCRIPT_NAME echo '# Backup IPFS' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo 'if [ -d /home/$MY_USERNAME/.ipfs ]; then' >> /usr/bin/$BACKUP_SCRIPT_NAME echo 'if [ -d /home/$MY_USERNAME/.ipfs ]; then' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo ' echo "Backing up IPFS"' >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' echo "Backing up IPFS"' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo " if [ ! -d $USB_MOUNT/backup/ipfs ]; then" >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' if [ ! -d $USB_MOUNT/backup/ipfs ]; then' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo " mkdir -p $USB_MOUNT/backup/ipfs" >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' mkdir -p $USB_MOUNT/backup/ipfs' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo ' fi' >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' fi' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo ' backup_directory_to_usb /home/$MY_USERNAME/.ipfs ipfs' >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' backup_directory_to_usb /home/$MY_USERNAME/.ipfs ipfs' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME
@ -2759,8 +2760,8 @@ function create_backup_script {
echo ' if [ -f /etc/Muttrc ]; then' >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' if [ -f /etc/Muttrc ]; then' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo ' cp /etc/Muttrc /home/$MY_USERNAME/tempbackup' >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' cp /etc/Muttrc /home/$MY_USERNAME/tempbackup' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo ' fi' >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' fi' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo " if [ ! -d $USB_MOUNT/backup/mutt ]; then" >> /usr/bin/$BACKUP_SCRIPT_NAME 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 ' mkdir -p $USB_MOUNT/backup/mutt' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo ' fi' >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' fi' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo ' backup_directory_to_usb /home/$MY_USERNAME/tempbackup mutt' >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' backup_directory_to_usb /home/$MY_USERNAME/tempbackup mutt' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME
@ -2773,8 +2774,8 @@ function create_backup_script {
echo ' mkdir -p /home/$MY_USERNAME/tempbackup' >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' mkdir -p /home/$MY_USERNAME/tempbackup' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo ' fi' >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' fi' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo ' cp /home/$MY_USERNAME/.procmailrc /home/$MY_USERNAME/tempbackup' >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' cp /home/$MY_USERNAME/.procmailrc /home/$MY_USERNAME/tempbackup' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo " if [ ! -d $USB_MOUNT/backup/procmail ]; then" >> /usr/bin/$BACKUP_SCRIPT_NAME 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 ' mkdir -p $USB_MOUNT/backup/procmail' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo ' fi' >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' fi' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo ' backup_directory_to_usb /home/$MY_USERNAME/tempbackup procmail' >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' backup_directory_to_usb /home/$MY_USERNAME/tempbackup procmail' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME
@ -2783,8 +2784,8 @@ function create_backup_script {
echo '# Backup spamassassin settings' >> /usr/bin/$BACKUP_SCRIPT_NAME echo '# Backup spamassassin settings' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo 'if [ -d /home/$MY_USERNAME/.spamassassin ]; then' >> /usr/bin/$BACKUP_SCRIPT_NAME echo 'if [ -d /home/$MY_USERNAME/.spamassassin ]; then' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo ' echo "Backing up spamassassin settings"' >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' echo "Backing up spamassassin settings"' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo " if [ ! -d $USB_MOUNT/backup/spamassassin ]; then" >> /usr/bin/$BACKUP_SCRIPT_NAME 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 ' mkdir -p $USB_MOUNT/backup/spamassassin' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo ' fi' >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' fi' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo ' backup_directory_to_usb /home/$MY_USERNAME/.spamassassin spamassassin' >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' backup_directory_to_usb /home/$MY_USERNAME/.spamassassin spamassassin' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME
@ -2798,8 +2799,8 @@ function create_backup_script {
echo ' fi' >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' fi' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo ' tar -czvf /root/tempbackupemail/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 ' echo "Backing up emails"' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo " if [ ! -d $USB_MOUNT/backup/mail ]; then" >> /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 ' mkdir -p $USB_MOUNT/backup/mail' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo ' fi' >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' fi' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo ' backup_directory_to_usb /root/tempbackupemail mail' >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' backup_directory_to_usb /root/tempbackupemail mail' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME
@ -2808,8 +2809,8 @@ function create_backup_script {
echo '# Backup DLNA cache' >> /usr/bin/$BACKUP_SCRIPT_NAME echo '# Backup DLNA cache' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo "if [ -d /var/cache/minidlna ]; then" >> /usr/bin/$BACKUP_SCRIPT_NAME echo "if [ -d /var/cache/minidlna ]; then" >> /usr/bin/$BACKUP_SCRIPT_NAME
echo ' echo "Backing up DLNA cache"' >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' echo "Backing up DLNA cache"' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo " if [ ! -d $USB_MOUNT/backup/dlna ]; then" >> /usr/bin/$BACKUP_SCRIPT_NAME 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 ' mkdir -p $USB_MOUNT/backup/dlna' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo ' fi' >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' fi' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo ' backup_directory_to_usb /var/cache/minidlna dlna' >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' backup_directory_to_usb /var/cache/minidlna dlna' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME
@ -2825,8 +2826,8 @@ function create_backup_script {
echo '/home/$MY_USERNAME/tempbackup' >> /usr/bin/$BACKUP_SCRIPT_NAME echo '/home/$MY_USERNAME/tempbackup' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo -n " cp -f /var/lib/mumble-server/$VOIP_DATABASE " >> /usr/bin/$BACKUP_SCRIPT_NAME echo -n " cp -f /var/lib/mumble-server/$VOIP_DATABASE " >> /usr/bin/$BACKUP_SCRIPT_NAME
echo '/home/$MY_USERNAME/tempbackup' >> /usr/bin/$BACKUP_SCRIPT_NAME echo '/home/$MY_USERNAME/tempbackup' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo " if [ ! -d $USB_MOUNT/backup/voip ]; then" >> /usr/bin/$BACKUP_SCRIPT_NAME 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 ' mkdir -p $USB_MOUNT/backup/voip' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo ' fi' >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' fi' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo ' backup_directory_to_usb /home/$MY_USERNAME/tempbackup voip' >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' backup_directory_to_usb /home/$MY_USERNAME/tempbackup voip' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME
@ -2834,8 +2835,8 @@ function create_backup_script {
if [[ $BACKUP_INCLUDES_DATABASES == "yes" ]]; then if [[ $BACKUP_INCLUDES_DATABASES == "yes" ]]; then
echo '# Mysql settings' >> /usr/bin/$BACKUP_SCRIPT_NAME echo '# Mysql settings' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo "if [ ! -d $USB_MOUNT/backup/mariadb ]; then" >> /usr/bin/$BACKUP_SCRIPT_NAME echo 'if [ ! -d $USB_MOUNT/backup/mariadb ]; then' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo " mkdir -p $USB_MOUNT/backup/mariadb" >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' mkdir -p $USB_MOUNT/backup/mariadb' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo 'if [ ! -d /root/tempmariadb ]; then' >> /usr/bin/$BACKUP_SCRIPT_NAME echo 'if [ ! -d /root/tempmariadb ]; then' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo ' mkdir /root/tempmariadb' >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' mkdir /root/tempmariadb' >> /usr/bin/$BACKUP_SCRIPT_NAME
@ -2844,8 +2845,8 @@ function create_backup_script {
echo "if [ ! -s /root/tempmariadb/mysql.sql ]; then" >> /usr/bin/$BACKUP_SCRIPT_NAME echo "if [ ! -s /root/tempmariadb/mysql.sql ]; then" >> /usr/bin/$BACKUP_SCRIPT_NAME
echo ' echo "Unable to backup mysql settings"' >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' echo "Unable to backup mysql settings"' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo ' rm -rf /root/tempmariadb' >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' rm -rf /root/tempmariadb' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo " umount $USB_MOUNT" >> /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 $USB_MOUNT' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo ' exit 653' >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' exit 653' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo 'echo "$DATABASE_PASSWORD" > /root/tempmariadb/db' >> /usr/bin/$BACKUP_SCRIPT_NAME echo 'echo "$DATABASE_PASSWORD" > /root/tempmariadb/db' >> /usr/bin/$BACKUP_SCRIPT_NAME
@ -2857,8 +2858,8 @@ function create_backup_script {
echo '# Backup Tox node settings' >> /usr/bin/$BACKUP_SCRIPT_NAME echo '# Backup Tox node settings' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo "if [ -d /var/lib/tox-bootstrapd ]; then" >> /usr/bin/$BACKUP_SCRIPT_NAME echo "if [ -d /var/lib/tox-bootstrapd ]; then" >> /usr/bin/$BACKUP_SCRIPT_NAME
echo ' echo "Backing up Tox node settings"' >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' echo "Backing up Tox node settings"' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo " if [ ! -d $USB_MOUNT/backup/tox ]; then" >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' if [ ! -d $USB_MOUNT/backup/tox ]; then' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo " mkdir -p $USB_MOUNT/backup/tox" >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' mkdir -p $USB_MOUNT/backup/tox' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo ' fi' >> /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 " cp /etc/tox-bootstrapd.conf /var/lib/tox-bootstrapd" >> /usr/bin/$BACKUP_SCRIPT_NAME
echo ' backup_directory_to_usb /var/lib/tox-bootstrapd tox' >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' backup_directory_to_usb /var/lib/tox-bootstrapd tox' >> /usr/bin/$BACKUP_SCRIPT_NAME
@ -2866,13 +2867,13 @@ function create_backup_script {
echo '' >> /usr/bin/$BACKUP_SCRIPT_NAME echo '' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo 'sync' >> /usr/bin/$BACKUP_SCRIPT_NAME echo 'sync' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo "umount $USB_MOUNT" >> /usr/bin/$BACKUP_SCRIPT_NAME echo 'umount $USB_MOUNT' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo 'if [ ! "$?" = "0" ]; then' >> /usr/bin/$BACKUP_SCRIPT_NAME echo 'if [ ! "$?" = "0" ]; then' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo ' echo "Unable to unmount the drive. This means that the backup did not work"' >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' echo "Unable to unmount the drive. This means that the backup did not work"' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo " rm -rf $USB_MOUNT" >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' rm -rf $USB_MOUNT' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo ' exit 46994' >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' exit 46994' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME echo 'fi' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo "rm -rf $USB_MOUNT" >> /usr/bin/$BACKUP_SCRIPT_NAME echo 'rm -rf $USB_MOUNT' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo 'if [[ $USB_DRIVE == /dev/mapper/encrypted_usb ]]; then' >> /usr/bin/$BACKUP_SCRIPT_NAME echo 'if [[ $USB_DRIVE == /dev/mapper/encrypted_usb ]]; then' >> /usr/bin/$BACKUP_SCRIPT_NAME
echo ' echo "Unmount encrypted USB"' >> /usr/bin/$BACKUP_SCRIPT_NAME echo ' echo "Unmount encrypted USB"' >> /usr/bin/$BACKUP_SCRIPT_NAME
@ -2892,7 +2893,6 @@ function create_backup_script {
function restore_directory_from_usb { function restore_directory_from_usb {
echo 'function restore_directory_from_usb {' >> /usr/bin/$RESTORE_SCRIPT_NAME echo 'function restore_directory_from_usb {' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo " USB_MOUNT=$USB_MOUNT" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo " BACKUP_CERTIFICATE=$BACKUP_CERTIFICATE" >> /usr/bin/$RESTORE_SCRIPT_NAME echo " BACKUP_CERTIFICATE=$BACKUP_CERTIFICATE" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' if [ ! -d ${1} ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' if [ ! -d ${1} ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' mkdir ${1}' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' mkdir ${1}' >> /usr/bin/$RESTORE_SCRIPT_NAME
@ -2908,7 +2908,6 @@ function restore_directory_from_usb {
function restore_database { function restore_database {
echo 'function restore_database {' >> /usr/bin/$RESTORE_SCRIPT_NAME echo 'function restore_database {' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo " USB_MOUNT=$USB_MOUNT" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo " DATABASE_PASSWORD=\"$DATABASE_PASSWORD\"" >> /usr/bin/$RESTORE_SCRIPT_NAME echo " DATABASE_PASSWORD=\"$DATABASE_PASSWORD\"" >> /usr/bin/$RESTORE_SCRIPT_NAME
if [[ $BACKUP_TYPE == 'obnam' ]]; then if [[ $BACKUP_TYPE == 'obnam' ]]; then
echo ' RESTORE_SUBDIR="root"' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' RESTORE_SUBDIR="root"' >> /usr/bin/$RESTORE_SCRIPT_NAME
@ -2983,6 +2982,7 @@ function create_restore_script {
echo 'if [ $1 ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME echo 'if [ $1 ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' USB_DRIVE=/dev/${1}1' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' USB_DRIVE=/dev/${1}1' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo 'fi' >> /usr/bin/$RESTORE_SCRIPT_NAME echo 'fi' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo "USB_MOUNT=$USB_MOUNT" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo '' >> /usr/bin/$RESTORE_SCRIPT_NAME echo '' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo "ADMIN_USERNAME=$MY_USERNAME" >> /usr/bin/$RESTORE_SCRIPT_NAME echo "ADMIN_USERNAME=$MY_USERNAME" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo "MY_USERNAME=$MY_USERNAME" >> /usr/bin/$RESTORE_SCRIPT_NAME echo "MY_USERNAME=$MY_USERNAME" >> /usr/bin/$RESTORE_SCRIPT_NAME
@ -2995,8 +2995,8 @@ function create_restore_script {
echo ' exit 1' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' exit 1' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo 'fi' >> /usr/bin/$RESTORE_SCRIPT_NAME echo 'fi' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo '' >> /usr/bin/$RESTORE_SCRIPT_NAME echo '' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo "if [ ! -d $USB_MOUNT ]; then" >> /usr/bin/$RESTORE_SCRIPT_NAME echo 'if [ ! -d $USB_MOUNT ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo " mkdir $USB_MOUNT" >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' mkdir $USB_MOUNT' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' if [ -f /dev/mapper/encrypted_usb ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' if [ -f /dev/mapper/encrypted_usb ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' rm -rf /dev/mapper/encrypted_usb' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' rm -rf /dev/mapper/encrypted_usb' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME
@ -3006,12 +3006,12 @@ function create_restore_script {
echo ' USB_DRIVE=/dev/mapper/encrypted_usb' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' USB_DRIVE=/dev/mapper/encrypted_usb' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo -n ' mount $USB_DRIVE ' >> /usr/bin/$RESTORE_SCRIPT_NAME echo -n ' mount $USB_DRIVE ' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo "$USB_MOUNT" >> /usr/bin/$RESTORE_SCRIPT_NAME echo '$USB_MOUNT' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo 'fi' >> /usr/bin/$RESTORE_SCRIPT_NAME echo 'fi' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo "if [ ! -d $USB_MOUNT/backup ]; then" >> /usr/bin/$RESTORE_SCRIPT_NAME echo 'if [ ! -d $USB_MOUNT/backup ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' echo "No backup directory found on the USB drive."' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' echo "No backup directory found on the USB drive."' >> /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 2' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' exit 2' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo 'fi' >> /usr/bin/$RESTORE_SCRIPT_NAME echo 'fi' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo '' >> /usr/bin/$RESTORE_SCRIPT_NAME echo '' >> /usr/bin/$RESTORE_SCRIPT_NAME
@ -3019,8 +3019,8 @@ function create_restore_script {
echo 'echo "Checking that user exists"' >> /usr/bin/$RESTORE_SCRIPT_NAME echo 'echo "Checking that user exists"' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo 'if [ ! -d /home/$MY_USERNAME ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME echo 'if [ ! -d /home/$MY_USERNAME ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' echo "Username $MY_USERNAME not found. Reinstall Freedombone with this username."' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' echo "Username $MY_USERNAME not found. Reinstall Freedombone with this username."' >> /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 295' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' exit 295' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo 'fi' >> /usr/bin/$RESTORE_SCRIPT_NAME echo 'fi' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo '' >> /usr/bin/$RESTORE_SCRIPT_NAME echo '' >> /usr/bin/$RESTORE_SCRIPT_NAME
@ -3035,11 +3035,11 @@ function create_restore_script {
echo '' >> /usr/bin/$RESTORE_SCRIPT_NAME echo '' >> /usr/bin/$RESTORE_SCRIPT_NAME
if [[ $BACKUP_TYPE != 'obnam' ]]; then if [[ $BACKUP_TYPE != 'obnam' ]]; then
echo "if [ -f $USB_MOUNT/backup/key.gpg ]; then" >> /usr/bin/$RESTORE_SCRIPT_NAME echo 'if [ -f $USB_MOUNT/backup/key.gpg ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo " if [ -f $BACKUP_CERTIFICATE.new ]; then" >> /usr/bin/$RESTORE_SCRIPT_NAME echo " if [ -f $BACKUP_CERTIFICATE.new ]; then" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo " rm $BACKUP_CERTIFICATE.new" >> /usr/bin/$RESTORE_SCRIPT_NAME echo " rm $BACKUP_CERTIFICATE.new" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo " cp $USB_MOUNT/backup/key.gpg /root/tempbackupkey.gpg" >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' cp $USB_MOUNT/backup/key.gpg /root/tempbackupkey.gpg' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo " gpg /root/tempbackupkey.gpg" >> /usr/bin/$RESTORE_SCRIPT_NAME echo " gpg /root/tempbackupkey.gpg" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo " if [ -f /root/tempbackupkey ]; then" >> /usr/bin/$RESTORE_SCRIPT_NAME echo " if [ -f /root/tempbackupkey ]; then" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' echo "Backup key decrypted"' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' echo "Backup key decrypted"' >> /usr/bin/$RESTORE_SCRIPT_NAME
@ -3049,8 +3049,8 @@ function create_restore_script {
echo ' echo "Backup certificate installed"' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' echo "Backup certificate installed"' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' else' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' else' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' echo "Unable to decrypt the backup key"' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' echo "Unable to decrypt the backup key"' >> /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 735' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' exit 735' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo 'fi' >> /usr/bin/$RESTORE_SCRIPT_NAME echo 'fi' >> /usr/bin/$RESTORE_SCRIPT_NAME
@ -3058,8 +3058,8 @@ function create_restore_script {
echo "if [ ! -f $BACKUP_CERTIFICATE ]; then" >> /usr/bin/$RESTORE_SCRIPT_NAME echo "if [ ! -f $BACKUP_CERTIFICATE ]; then" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo " echo 'No backup key was found. Copy your backup key to $BACKUP_CERTIFICATE'" >> /usr/bin/$RESTORE_SCRIPT_NAME echo " echo 'No backup key was found. Copy your backup key to $BACKUP_CERTIFICATE'" >> /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 563' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' exit 563' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo 'fi' >> /usr/bin/$RESTORE_SCRIPT_NAME echo 'fi' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo '' >> /usr/bin/$RESTORE_SCRIPT_NAME echo '' >> /usr/bin/$RESTORE_SCRIPT_NAME
@ -3083,7 +3083,7 @@ function create_restore_script {
if [[ $BACKUP_TYPE != 'obnam' ]]; then if [[ $BACKUP_TYPE != 'obnam' ]]; then
RESTORE_SUBDIR='usb/backup/mariadb/' RESTORE_SUBDIR='usb/backup/mariadb/'
fi fi
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 ' restore_directory_from_usb /root/tempmariadb mariadb' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' restore_directory_from_usb /root/tempmariadb mariadb' >> /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
@ -3104,8 +3104,8 @@ function create_restore_script {
echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' if [ ! "$?" = "0" ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' if [ ! "$?" = "0" ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' echo "$mysqlsuccess"' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' echo "$mysqlsuccess"' >> /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 962' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' exit 962' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' echo "Restarting database"' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' echo "Restarting database"' >> /usr/bin/$RESTORE_SCRIPT_NAME
@ -3128,7 +3128,7 @@ function create_restore_script {
if [[ $BACKUP_TYPE != 'obnam' ]]; then if [[ $BACKUP_TYPE != 'obnam' ]]; then
RESTORE_SUBDIR='usb/backup/mutt/' RESTORE_SUBDIR='usb/backup/mutt/'
fi fi
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 ' restore_directory_from_usb /root/tempmutt mutt' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' restore_directory_from_usb /root/tempmutt mutt' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo -n " if [ -f /root/tempmutt/${RESTORE_SUBDIR}" >> /usr/bin/$RESTORE_SCRIPT_NAME echo -n " if [ -f /root/tempmutt/${RESTORE_SUBDIR}" >> /usr/bin/$RESTORE_SCRIPT_NAME
@ -3142,8 +3142,8 @@ function create_restore_script {
echo '$MY_USERNAME/tempbackup/Muttrc /etc/Muttrc' >> /usr/bin/$RESTORE_SCRIPT_NAME echo '$MY_USERNAME/tempbackup/Muttrc /etc/Muttrc' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' fi' >> /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 ' rm -rf /root/tempmutt' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' rm -rf /root/tempmutt' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' exit 276' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' exit 276' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME
@ -3155,22 +3155,22 @@ function create_restore_script {
if [[ $BACKUP_TYPE != 'obnam' ]]; then if [[ $BACKUP_TYPE != 'obnam' ]]; then
RESTORE_SUBDIR='usb/backup/gnupg/' RESTORE_SUBDIR='usb/backup/gnupg/'
fi fi
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 ' restore_directory_from_usb /root/tempgnupg gnupg' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' restore_directory_from_usb /root/tempgnupg gnupg' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo -n " cp -r /root/tempgnupg/${RESTORE_SUBDIR}" >> /usr/bin/$RESTORE_SCRIPT_NAME echo -n " cp -r /root/tempgnupg/${RESTORE_SUBDIR}" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo '$MY_USERNAME/.gnupg /home/$MY_USERNAME/' >> /usr/bin/$RESTORE_SCRIPT_NAME echo '$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
echo " rm -rf $USB_MOUNT" >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' rm -rf $USB_MOUNT' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' rm -rf /root/tempgnupg' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' rm -rf /root/tempgnupg' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' exit 276' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' exit 276' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' rm -rf /root/tempgnupg' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' rm -rf /root/tempgnupg' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' cp -r /home/$MY_USERNAME/.gnupg /root' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' cp -r /home/$MY_USERNAME/.gnupg /root' >> /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 283' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' exit 283' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo 'fi' >> /usr/bin/$RESTORE_SCRIPT_NAME echo 'fi' >> /usr/bin/$RESTORE_SCRIPT_NAME
@ -3180,14 +3180,14 @@ function create_restore_script {
if [[ $BACKUP_TYPE != 'obnam' ]]; then if [[ $BACKUP_TYPE != 'obnam' ]]; then
RESTORE_SUBDIR='usb/backup/procmail/' RESTORE_SUBDIR='usb/backup/procmail/'
fi fi
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 ' restore_directory_from_usb /root/tempprocmail procmail' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' restore_directory_from_usb /root/tempprocmail procmail' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo -n " cp -f /root/tempprocmail/${RESTORE_SUBDIR}" >> /usr/bin/$RESTORE_SCRIPT_NAME echo -n " cp -f /root/tempprocmail/${RESTORE_SUBDIR}" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo '$MY_USERNAME/tempbackup/.procmailrc /home/$MY_USERNAME/' >> /usr/bin/$RESTORE_SCRIPT_NAME echo '$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
echo " rm -rf $USB_MOUNT" >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' rm -rf $USB_MOUNT' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' rm -rf /root/tempprocmail' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' rm -rf /root/tempprocmail' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' exit 276' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' exit 276' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME
@ -3199,14 +3199,14 @@ function create_restore_script {
if [[ $BACKUP_TYPE != 'obnam' ]]; then if [[ $BACKUP_TYPE != 'obnam' ]]; then
RESTORE_SUBDIR='usb/backup/spamassassin/' RESTORE_SUBDIR='usb/backup/spamassassin/'
fi fi
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 'restore_directory_from_usb /root/tempspamassassin spamassassin' >> /usr/bin/$RESTORE_SCRIPT_NAME echo 'restore_directory_from_usb /root/tempspamassassin spamassassin' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo -n " cp -rf /root/tempspamassassin/${RESTORE_SUBDIR}" >> /usr/bin/$RESTORE_SCRIPT_NAME echo -n " cp -rf /root/tempspamassassin/${RESTORE_SUBDIR}" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo '$MY_USERNAME/.spamassassin /home/$MY_USERNAME/' >> /usr/bin/$RESTORE_SCRIPT_NAME echo '$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
echo " rm -rf $USB_MOUNT" >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' rm -rf $USB_MOUNT' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' rm -rf /root/tempspamassassin' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' rm -rf /root/tempspamassassin' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' exit 276' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' exit 276' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME
@ -3218,14 +3218,14 @@ function create_restore_script {
if [[ $BACKUP_TYPE != 'obnam' ]]; then if [[ $BACKUP_TYPE != 'obnam' ]]; then
RESTORE_SUBDIR='usb/backup/readme/' RESTORE_SUBDIR='usb/backup/readme/'
fi fi
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 ' restore_directory_from_usb /root/tempreadme readme' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' restore_directory_from_usb /root/tempreadme readme' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo -n " cp -f /root/tempreadme/${RESTORE_SUBDIR}" >> /usr/bin/$RESTORE_SCRIPT_NAME echo -n " cp -f /root/tempreadme/${RESTORE_SUBDIR}" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo '$MY_USERNAME/tempbackup/README /home/$MY_USERNAME/' >> /usr/bin/$RESTORE_SCRIPT_NAME echo '$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
echo " rm -rf $USB_MOUNT" >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' rm -rf $USB_MOUNT' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' rm -rf /root/tempreadme' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' rm -rf /root/tempreadme' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' exit 276' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' exit 276' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME
@ -3237,14 +3237,14 @@ function create_restore_script {
if [[ $BACKUP_TYPE != 'obnam' ]]; then if [[ $BACKUP_TYPE != 'obnam' ]]; then
RESTORE_SUBDIR='usb/backup/ipfs/' RESTORE_SUBDIR='usb/backup/ipfs/'
fi fi
echo "if [ -d $USB_MOUNT/backup/ipfs ]; then" >> /usr/bin/$RESTORE_SCRIPT_NAME echo 'if [ -d $USB_MOUNT/backup/ipfs ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' echo "Restoring IPFS"' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' echo "Restoring IPFS"' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' restore_directory_from_usb /root/tempipfs ipfs' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' restore_directory_from_usb /root/tempipfs ipfs' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo -n " cp -f /root/tempipfs/${RESTORE_SUBDIR}" >> /usr/bin/$RESTORE_SCRIPT_NAME echo -n " cp -f /root/tempipfs/${RESTORE_SUBDIR}" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo '$MY_USERNAME/tempbackup/ipfs/* /home/$MY_USERNAME/.ipfs' >> /usr/bin/$RESTORE_SCRIPT_NAME echo '$MY_USERNAME/tempbackup/ipfs/* /home/$MY_USERNAME/.ipfs' >> /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 ' rm -rf /root/tempipfs' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' rm -rf /root/tempipfs' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' exit 276' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' exit 276' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME
@ -3256,14 +3256,14 @@ function create_restore_script {
if [[ $BACKUP_TYPE != 'obnam' ]]; then if [[ $BACKUP_TYPE != 'obnam' ]]; then
RESTORE_SUBDIR='usb/backup/ssh/' RESTORE_SUBDIR='usb/backup/ssh/'
fi fi
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 ' restore_directory_from_usb /root/tempssh ssh' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' restore_directory_from_usb /root/tempssh ssh' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo -n " cp -r /root/tempssh/${RESTORE_SUBDIR}" >> /usr/bin/$RESTORE_SCRIPT_NAME echo -n " cp -r /root/tempssh/${RESTORE_SUBDIR}" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo '$MY_USERNAME/.ssh /home/$MY_USERNAME/' >> /usr/bin/$RESTORE_SCRIPT_NAME echo '$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
echo " rm -rf $USB_MOUNT" >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' rm -rf $USB_MOUNT' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' rm -rf /root/tempssh' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' rm -rf /root/tempssh' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' exit 664' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' exit 664' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME
@ -3275,14 +3275,14 @@ function create_restore_script {
if [[ $BACKUP_TYPE != 'obnam' ]]; then if [[ $BACKUP_TYPE != 'obnam' ]]; then
RESTORE_SUBDIR='usb/backup/ssl/' RESTORE_SUBDIR='usb/backup/ssl/'
fi fi
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 ' restore_directory_from_usb /root/tempssl ssl' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' restore_directory_from_usb /root/tempssl ssl' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo " cp -r /root/tempssl/${RESTORE_SUBDIR}ssl/* /etc/ssl" >> /usr/bin/$RESTORE_SCRIPT_NAME echo " cp -r /root/tempssl/${RESTORE_SUBDIR}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
echo " rm -rf $USB_MOUNT" >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' rm -rf $USB_MOUNT' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' exit 276' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' exit 276' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' rm -rf /root/tempssl' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' rm -rf /root/tempssl' >> /usr/bin/$RESTORE_SCRIPT_NAME
@ -3293,7 +3293,7 @@ function create_restore_script {
if [[ $BACKUP_TYPE != 'obnam' ]]; then if [[ $BACKUP_TYPE != 'obnam' ]]; then
RESTORE_SUBDIR='usb/backup/projects/' RESTORE_SUBDIR='usb/backup/projects/'
fi fi
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 ' restore_directory_from_usb /root/tempprojects projects' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' restore_directory_from_usb /root/tempprojects projects' >> /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
@ -3302,8 +3302,8 @@ function create_restore_script {
echo -n " mv /root/tempprojects/${RESTORE_SUBDIR}" >> /usr/bin/$RESTORE_SCRIPT_NAME echo -n " mv /root/tempprojects/${RESTORE_SUBDIR}" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo '$MY_USERNAME/projects /home/$MY_USERNAME' >> /usr/bin/$RESTORE_SCRIPT_NAME echo '$MY_USERNAME/projects /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
echo " rm -rf $USB_MOUNT" >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' rm -rf $USB_MOUNT' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' exit 166' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' exit 166' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' rm -rf /root/tempprojects' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' rm -rf /root/tempprojects' >> /usr/bin/$RESTORE_SCRIPT_NAME
@ -3314,7 +3314,7 @@ function create_restore_script {
if [[ $BACKUP_TYPE != 'obnam' ]]; then if [[ $BACKUP_TYPE != 'obnam' ]]; then
RESTORE_SUBDIR='usb/backup/personal/' RESTORE_SUBDIR='usb/backup/personal/'
fi fi
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 ' restore_directory_from_usb /root/temppersonal personal' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' restore_directory_from_usb /root/temppersonal personal' >> /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
@ -3323,8 +3323,8 @@ function create_restore_script {
echo -n " mv /root/temppersonal/${RESTORE_SUBDIR}" >> /usr/bin/$RESTORE_SCRIPT_NAME echo -n " mv /root/temppersonal/${RESTORE_SUBDIR}" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo '$MY_USERNAME/personal /home/$MY_USERNAME' >> /usr/bin/$RESTORE_SCRIPT_NAME echo '$MY_USERNAME/personal /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
echo " rm -rf $USB_MOUNT" >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' rm -rf $USB_MOUNT' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' exit 184' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' exit 184' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' rm -rf /root/temppersonal' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' rm -rf /root/temppersonal' >> /usr/bin/$RESTORE_SCRIPT_NAME
@ -3340,8 +3340,8 @@ function create_restore_script {
echo ' restore_directory_from_usb /root/tempmailinglist mailinglist' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' restore_directory_from_usb /root/tempmailinglist mailinglist' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo " cp -r /root/tempmailinglist/${RESTORE_SUBDIR}spool/mlmmj/* $PUBLIC_MAILING_LIST_DIRECTORY" >> /usr/bin/$RESTORE_SCRIPT_NAME echo " cp -r /root/tempmailinglist/${RESTORE_SUBDIR}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
echo " rm -rf $USB_MOUNT" >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' rm -rf $USB_MOUNT' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' exit 526' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' exit 526' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' rm -rf /root/tempmailinglist' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' rm -rf /root/tempmailinglist' >> /usr/bin/$RESTORE_SCRIPT_NAME
@ -3357,8 +3357,8 @@ function create_restore_script {
echo ' restore_directory_from_usb /root/tempxmpp xmpp' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' restore_directory_from_usb /root/tempxmpp xmpp' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo " cp -r /root/tempxmpp/${RESTORE_SUBDIR}lib/prosody/* $XMPP_DIRECTORY" >> /usr/bin/$RESTORE_SCRIPT_NAME echo " cp -r /root/tempxmpp/${RESTORE_SUBDIR}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
echo " rm -rf $USB_MOUNT" >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' rm -rf $USB_MOUNT' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' exit 725' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' exit 725' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' rm -rf /root/tempxmpp' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' rm -rf /root/tempxmpp' >> /usr/bin/$RESTORE_SCRIPT_NAME
@ -3380,7 +3380,7 @@ function create_restore_script {
if grep -Fxq "install_hubzilla" $COMPLETION_FILE; then if grep -Fxq "install_hubzilla" $COMPLETION_FILE; then
BACKUP_INCLUDES_WEBSITES="yes" BACKUP_INCLUDES_WEBSITES="yes"
echo "restore_database hubzilla $HUBZILLA_DOMAIN_NAME" >> /usr/bin/$RESTORE_SCRIPT_NAME echo "restore_database hubzilla $HUBZILLA_DOMAIN_NAME" >> /usr/bin/$RESTORE_SCRIPT_NAME
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 " if [ ! -d /var/www/$HUBZILLA_DOMAIN_NAME/htdocs/store/[data]/smarty3 ]; then" >> /usr/bin/$RESTORE_SCRIPT_NAME echo " if [ ! -d /var/www/$HUBZILLA_DOMAIN_NAME/htdocs/store/[data]/smarty3 ]; then" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo " mkdir -p /var/www/$HUBZILLA_DOMAIN_NAME/htdocs/store/[data]/smarty3" >> /usr/bin/$RESTORE_SCRIPT_NAME echo " mkdir -p /var/www/$HUBZILLA_DOMAIN_NAME/htdocs/store/[data]/smarty3" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo " fi" >> /usr/bin/$RESTORE_SCRIPT_NAME echo " fi" >> /usr/bin/$RESTORE_SCRIPT_NAME
@ -3396,7 +3396,7 @@ function create_restore_script {
if grep -Fxq "install_owncloud" $COMPLETION_FILE; then if grep -Fxq "install_owncloud" $COMPLETION_FILE; then
BACKUP_INCLUDES_WEBSITES="yes" BACKUP_INCLUDES_WEBSITES="yes"
echo "restore_database owncloud $OWNCLOUD_DOMAIN_NAME" >> /usr/bin/$RESTORE_SCRIPT_NAME echo "restore_database owncloud $OWNCLOUD_DOMAIN_NAME" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo "if [ -d $USB_MOUNT/backup/owncloud2 ]; then" >> /usr/bin/$RESTORE_SCRIPT_NAME echo 'if [ -d $USB_MOUNT/backup/owncloud2 ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo 'restore_directory_from_usb /root/tempowncloud2 owncloud2' >> /usr/bin/$RESTORE_SCRIPT_NAME echo 'restore_directory_from_usb /root/tempowncloud2 owncloud2' >> /usr/bin/$RESTORE_SCRIPT_NAME
RESTORE_SUBDIR='etc/' RESTORE_SUBDIR='etc/'
if [[ $BACKUP_TYPE != 'obnam' ]]; then if [[ $BACKUP_TYPE != 'obnam' ]]; then
@ -3404,8 +3404,8 @@ function create_restore_script {
fi fi
echo " cp -r /root/tempowncloud2/${RESTORE_SUBDIR}owncloud/* /etc/owncloud/" >> /usr/bin/$RESTORE_SCRIPT_NAME echo " cp -r /root/tempowncloud2/${RESTORE_SUBDIR}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
echo " rm -rf $USB_MOUNT" >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' rm -rf $USB_MOUNT' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' exit 982' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' exit 982' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' rm -rf /root/tempowncloud' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' rm -rf /root/tempowncloud' >> /usr/bin/$RESTORE_SCRIPT_NAME
@ -3426,15 +3426,15 @@ function create_restore_script {
if [[ $BACKUP_TYPE != 'obnam' ]]; then if [[ $BACKUP_TYPE != 'obnam' ]]; then
RESTORE_SUBDIR='usb/backup/gogs' RESTORE_SUBDIR='usb/backup/gogs'
fi fi
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 settings"' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' echo "Restoring Gogs settings"' >> /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
echo " cp -r /root/tempgogs/${RESTORE_SUBDIR}/git/go/src/github.com/gogits/gogs/custom/* /home/git/go/src/github.com/gogits/gogs/custom" >> /usr/bin/$RESTORE_SCRIPT_NAME echo " cp -r /root/tempgogs/${RESTORE_SUBDIR}/git/go/src/github.com/gogits/gogs/custom/* /home/git/go/src/github.com/gogits/gogs/custom" >> /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 ' echo "Restoring Gogs repos"' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' echo "Restoring Gogs repos"' >> /usr/bin/$RESTORE_SCRIPT_NAME
@ -3444,8 +3444,8 @@ function create_restore_script {
fi fi
echo " cp -r /root/tempgogsrepos/${RESTORE_SUBDIR}/git/gogs-repositories/* /home/git/gogs-repositories/" >> /usr/bin/$RESTORE_SCRIPT_NAME echo " cp -r /root/tempgogsrepos/${RESTORE_SUBDIR}/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
echo " rm -rf $USB_MOUNT" >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' rm -rf $USB_MOUNT' >> /usr/bin/$RESTORE_SCRIPT_NAME
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
@ -3458,8 +3458,8 @@ function create_restore_script {
fi fi
echo " cp -r /root/tempgogsssh/${RESTORE_SUBDIR}/git/.ssh/* /home/git/.ssh/" >> /usr/bin/$RESTORE_SCRIPT_NAME echo " cp -r /root/tempgogsssh/${RESTORE_SUBDIR}/git/.ssh/* /home/git/.ssh/" >> /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 8463' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' exit 8463' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' rm -rf /root/tempgogs' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' rm -rf /root/tempgogs' >> /usr/bin/$RESTORE_SCRIPT_NAME
@ -3474,13 +3474,13 @@ function create_restore_script {
if [[ $BACKUP_TYPE != 'obnam' ]]; then if [[ $BACKUP_TYPE != 'obnam' ]]; then
RESTORE_SUBDIR='usb/backup/wiki' RESTORE_SUBDIR='usb/backup/wiki'
fi fi
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 ' restore_directory_from_usb /root/tempwiki wiki' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' restore_directory_from_usb /root/tempwiki wiki' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo " cp -r /root/tempwiki/${RESTORE_SUBDIR}/lib/dokuwiki/* /var/lib/dokuwiki/" >> /usr/bin/$RESTORE_SCRIPT_NAME echo " cp -r /root/tempwiki/${RESTORE_SUBDIR}/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 ' restore_directory_from_usb /root/tempwiki2 wiki2' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' restore_directory_from_usb /root/tempwiki2 wiki2' >> /usr/bin/$RESTORE_SCRIPT_NAME
@ -3490,8 +3490,8 @@ function create_restore_script {
fi fi
echo " cp -r /root/tempwiki2/${RESTORE_SUBDIR}/dokuwiki/* /etc/dokuwiki/" >> /usr/bin/$RESTORE_SCRIPT_NAME echo " cp -r /root/tempwiki2/${RESTORE_SUBDIR}/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
echo " rm -rf $USB_MOUNT" >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' rm -rf $USB_MOUNT' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' exit 869' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' exit 869' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' rm -rf /root/tempwiki' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' rm -rf /root/tempwiki' >> /usr/bin/$RESTORE_SCRIPT_NAME
@ -3508,21 +3508,21 @@ function create_restore_script {
if [[ $BACKUP_TYPE != 'obnam' ]]; then if [[ $BACKUP_TYPE != 'obnam' ]]; then
RESTORE_SUBDIR='usb/backup/blog' RESTORE_SUBDIR='usb/backup/blog'
fi fi
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 ' restore_directory_from_usb /root/tempblog blog' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' restore_directory_from_usb /root/tempblog blog' >> /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/${RESTORE_SUBDIR}/www/$FULLBLOG_DOMAIN_NAME/htdocs /var/www/$FULLBLOG_DOMAIN_NAME/" >> /usr/bin/$RESTORE_SCRIPT_NAME echo " cp -r /root/tempblog/${RESTORE_SUBDIR}/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
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 593' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' exit 593' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' rm -rf /root/tempblog' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' rm -rf /root/tempblog' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo " if [ ! -d /var/www/$FULLBLOG_DOMAIN_NAME/htdocs/content ]; then" >> /usr/bin/$RESTORE_SCRIPT_NAME echo " if [ ! -d /var/www/$FULLBLOG_DOMAIN_NAME/htdocs/content ]; then" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' echo "No content directory found after restoring blog"' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' echo "No content directory found after restoring blog"' >> /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 287' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' exit 287' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo " chown -R www-data:www-data /var/www/$FULLBLOG_DOMAIN_NAME/htdocs" >> /usr/bin/$RESTORE_SCRIPT_NAME echo " chown -R www-data:www-data /var/www/$FULLBLOG_DOMAIN_NAME/htdocs" >> /usr/bin/$RESTORE_SCRIPT_NAME
@ -3537,14 +3537,14 @@ function create_restore_script {
if [[ $BACKUP_TYPE != 'obnam' ]]; then if [[ $BACKUP_TYPE != 'obnam' ]]; then
RESTORE_SUBDIR='usb/backup/cjdns' RESTORE_SUBDIR='usb/backup/cjdns'
fi fi
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 ' restore_directory_from_usb /root/tempcjdns cjdns' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' restore_directory_from_usb /root/tempcjdns cjdns' >> /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/${RESTORE_SUBDIR}/cjdns /etc/" >> /usr/bin/$RESTORE_SCRIPT_NAME echo " cp -r /root/tempcjdns/${RESTORE_SUBDIR}/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
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 8472' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' exit 8472' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' rm -rf /root/tempcjdns' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' rm -rf /root/tempcjdns' >> /usr/bin/$RESTORE_SCRIPT_NAME
@ -3555,7 +3555,7 @@ function create_restore_script {
if [[ $BACKUP_TYPE != 'obnam' ]]; then if [[ $BACKUP_TYPE != 'obnam' ]]; then
RESTORE_SUBDIR='usb/backup/mail' RESTORE_SUBDIR='usb/backup/mail'
fi fi
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 ' restore_directory_from_usb /root/tempmail mail' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' restore_directory_from_usb /root/tempmail mail' >> /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
@ -3563,8 +3563,8 @@ function create_restore_script {
echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo " tar -xzvf /root/tempmail/${RESTORE_SUBDIR}/tempbackupemail/maildir.tar.gz -C /" >> /usr/bin/$RESTORE_SCRIPT_NAME echo " tar -xzvf /root/tempmail/${RESTORE_SUBDIR}/tempbackupemail/maildir.tar.gz -C /" >> /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 927' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' exit 927' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' rm -rf /root/tempmail' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' rm -rf /root/tempmail' >> /usr/bin/$RESTORE_SCRIPT_NAME
@ -3576,13 +3576,13 @@ function create_restore_script {
RESTORE_SUBDIR='usb/backup/dlna' RESTORE_SUBDIR='usb/backup/dlna'
fi fi
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 ' restore_directory_from_usb /root/tempdlna dlna' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' restore_directory_from_usb /root/tempdlna dlna' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo " cp -r /root/tempdlna/${RESTORE_SUBDIR}/cache/minidlna/* /var/cache/minidlna/" >> /usr/bin/$RESTORE_SCRIPT_NAME echo " cp -r /root/tempdlna/${RESTORE_SUBDIR}/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
echo " rm -rf $USB_MOUNT" >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' rm -rf $USB_MOUNT' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' exit 982' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' exit 982' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' rm -rf /root/tempdlna' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' rm -rf /root/tempdlna' >> /usr/bin/$RESTORE_SCRIPT_NAME
@ -3590,7 +3590,7 @@ function create_restore_script {
echo 'fi' >> /usr/bin/$RESTORE_SCRIPT_NAME echo 'fi' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo '' >> /usr/bin/$RESTORE_SCRIPT_NAME echo '' >> /usr/bin/$RESTORE_SCRIPT_NAME
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 ' restore_directory_from_usb /root/tempvoip voip' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' restore_directory_from_usb /root/tempvoip voip' >> /usr/bin/$RESTORE_SCRIPT_NAME
RESTORE_SUBDIR='home' RESTORE_SUBDIR='home'
@ -3601,8 +3601,8 @@ function create_restore_script {
echo -n '$MY_USERNAME/tempbackup/' >> /usr/bin/$RESTORE_SCRIPT_NAME echo -n '$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 ' 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 ' rm -rf /root/tempvoip' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' rm -rf /root/tempvoip' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' exit 3679' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' exit 3679' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME
@ -3610,8 +3610,8 @@ function create_restore_script {
echo -n '$MY_USERNAME/tempbackup/' >> /usr/bin/$RESTORE_SCRIPT_NAME echo -n '$MY_USERNAME/tempbackup/' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo "$VOIP_DATABASE /var/lib/mumble-server/" >> /usr/bin/$RESTORE_SCRIPT_NAME echo "$VOIP_DATABASE /var/lib/mumble-server/" >> /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 ' rm -rf /root/tempvoip' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' rm -rf /root/tempvoip' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' exit 276' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' exit 276' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME
@ -3622,20 +3622,20 @@ function create_restore_script {
echo 'fi' >> /usr/bin/$RESTORE_SCRIPT_NAME echo 'fi' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo '' >> /usr/bin/$RESTORE_SCRIPT_NAME echo '' >> /usr/bin/$RESTORE_SCRIPT_NAME
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 ' restore_directory_from_usb /var/lib/tox-bootstrapd tox' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' restore_directory_from_usb /var/lib/tox-bootstrapd tox' >> /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 6393' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' exit 6393' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' cp /var/lib/tox-bootstrapd/tox-bootstrapd.conf /etc/tox-bootstrapd.conf' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' cp /var/lib/tox-bootstrapd/tox-bootstrapd.conf /etc/tox-bootstrapd.conf' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' systemctl restart tox-bootstrapd.service' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' systemctl restart tox-bootstrapd.service' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' if [ ! "$?" = "0" ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' if [ ! "$?" = "0" ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' systemctl status tox-bootstrapd.service' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' systemctl status tox-bootstrapd.service' >> /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 59369' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' exit 59369' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo 'fi' >> /usr/bin/$RESTORE_SCRIPT_NAME echo 'fi' >> /usr/bin/$RESTORE_SCRIPT_NAME
@ -3644,8 +3644,8 @@ function create_restore_script {
echo 'sync' >> /usr/bin/$RESTORE_SCRIPT_NAME echo 'sync' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo '' >> /usr/bin/$RESTORE_SCRIPT_NAME echo '' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo "# Unmount the USB drive" >> /usr/bin/$RESTORE_SCRIPT_NAME echo "# Unmount the USB drive" >> /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 '' >> /usr/bin/$RESTORE_SCRIPT_NAME echo '' >> /usr/bin/$RESTORE_SCRIPT_NAME
if [[ $BACKUP_INCLUDES_WEBSITES == "yes" ]]; then if [[ $BACKUP_INCLUDES_WEBSITES == "yes" ]]; then
echo "# Restart the web server" >> /usr/bin/$RESTORE_SCRIPT_NAME echo "# Restart the web server" >> /usr/bin/$RESTORE_SCRIPT_NAME