Remote backup and restore with multiple users
This commit is contained in:
parent
138db8e90f
commit
aa2e173fbc
472
src/freedombone
472
src/freedombone
|
@ -4105,23 +4105,33 @@ function backup_to_friends_servers {
|
||||||
echo '' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo '' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
|
|
||||||
echo '# Backup projects' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo '# Backup projects' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
echo 'if [ -d /home/$MY_USERNAME/projects ]; then' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo 'for d in /home/*/ ; do' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
echo ' echo "Backing up projects"' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo ' USERNAME=$(echo "$d" | awk -F "/" "{print $3}")' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
echo ' if [ ! -d $SERVER_DIRECTORY/backup/projects ]; then' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo ' if [[ $USERNAME != "git" ]]; then' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
echo ' mkdir -p $SERVER_DIRECTORY/backup/projects' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo ' if [ -d /home/$USERNAME/projects ]; then' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
|
echo ' echo "Backing up projects for $USERNAME"' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
|
echo ' if [ ! -d $SERVER_DIRECTORY/backup/projects/$USERNAME ]; then' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
|
echo ' mkdir -p $SERVER_DIRECTORY/backup/projects/$USERNAME' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
|
echo ' fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
|
echo ' backup_directory_to_friend /home/$USERNAME/projects projects/$USERNAME' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
|
echo ' fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
echo ' fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo ' fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
echo ' backup_directory_to_friend /home/$MY_USERNAME/projects projects' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo 'done' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
echo 'fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
|
||||||
echo '' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo '' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
|
|
||||||
echo '# Backup personal settings' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo '# Backup personal settings' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
echo 'if [ -d /home/$MY_USERNAME/personal ]; then' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo 'for d in /home/*/ ; do' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
echo ' echo "Backing up personal settings"' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo ' USERNAME=$(echo "$d" | awk -F "/" "{print $3}")' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
echo ' if [ ! -d $SERVER_DIRECTORY/backup/personal ]; then' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo ' if [[ $USERNAME != "git" ]]; then' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
echo ' mkdir -p $SERVER_DIRECTORY/backup/personal' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo ' if [ -d /home/$USERNAME/personal ]; then' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
|
echo ' echo "Backing up personal settings for $USERNAME"' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
|
echo ' if [ ! -d $SERVER_DIRECTORY/backup/personal/$USERNAME ]; then' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
|
echo ' mkdir -p $SERVER_DIRECTORY/backup/personal/$USERNAME' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
|
echo ' fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
|
echo ' backup_directory_to_friend /home/$USERNAME/personal personal/$USERNAME' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
|
echo ' fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
echo ' fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo ' fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
echo ' backup_directory_to_friend /home/$MY_USERNAME/personal personal' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo 'done' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
echo 'fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
|
||||||
echo '' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo '' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
|
|
||||||
echo '# Backup the public mailing list' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo '# Backup the public mailing list' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
|
@ -4145,23 +4155,33 @@ function backup_to_friends_servers {
|
||||||
echo '' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo '' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
|
|
||||||
echo '# Backup gpg keys' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo '# Backup gpg keys' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
echo 'if [ -d /home/$MY_USERNAME/.gnupg ]; then' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo 'for d in /home/*/ ; do' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
echo ' echo "Backing up gpg keys"' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo ' USERNAME=$(echo "$d" | awk -F "/" "{print $3}")' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
echo ' if [ ! -d $SERVER_DIRECTORY/backup/gnupg ]; then' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo ' if [[ $USERNAME != "git" ]]; then' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
echo ' mkdir -p $SERVER_DIRECTORY/backup/gnupg' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo ' if [ -d /home/$USERNAME/.gnupg ]; then' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
|
echo ' echo "Backing up gpg keys for $USERNAME"' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
|
echo ' if [ ! -d $SERVER_DIRECTORY/backup/gnupg/$USERNAME ]; then' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
|
echo ' mkdir -p $SERVER_DIRECTORY/backup/gnupg/$USERNAME' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
|
echo ' fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
|
echo ' backup_directory_to_friend /home/$USERNAME/.gnupg gnupg/$USERNAME' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
|
echo ' fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
echo ' fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo ' fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
echo ' backup_directory_to_friend /home/$MY_USERNAME/.gnupg gnupg' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo 'done' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
echo 'fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
|
||||||
echo '' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo '' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
|
|
||||||
echo '# Backup ssh keys' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo '# Backup ssh keys' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
echo 'if [ -d /home/$MY_USERNAME/.ssh ]; then' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo 'for d in /home/*/ ; do' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
echo ' echo "Backing up ssh keys"' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo ' USERNAME=$(echo "$d" | awk -F "/" "{print $3}")' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
echo ' if [ ! -d $SERVER_DIRECTORY/backup/ssh ]; then' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo ' if [[ $USERNAME != "git" ]]; then' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
echo ' mkdir -p $SERVER_DIRECTORY/backup/ssh' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo ' if [ -d /home/$USERNAME/.ssh ]; then' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
|
echo ' echo "Backing up ssh keys for $USERNAME"' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
|
echo ' if [ ! -d $SERVER_DIRECTORY/backup/ssh/$USERNAME ]; then' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
|
echo ' mkdir -p $SERVER_DIRECTORY/backup/ssh/$USERNAME' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
|
echo ' fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
|
echo ' backup_directory_to_friend /home/$USERNAME/.ssh ssh/$USERNAME' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
|
echo ' fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
echo ' fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo ' fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
echo ' backup_directory_to_friend /home/$MY_USERNAME/.ssh ssh' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo 'done' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
echo 'fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
|
||||||
echo '' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo '' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
|
|
||||||
echo '# Backup web sites' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo '# Backup web sites' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
|
@ -4199,59 +4219,79 @@ function backup_to_friends_servers {
|
||||||
echo '' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo '' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
|
|
||||||
echo '# Backup Mutt settings' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo '# Backup Mutt settings' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
echo 'if [ -f /home/$MY_USERNAME/.muttrc ]; then' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo 'for d in /home/*/ ; do' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
echo ' echo "Backing up Mutt settings"' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo ' USERNAME=$(echo "$d" | awk -F "/" "{print $3}")' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
echo ' if [ ! -d /home/$MY_USERNAME/tempbackup ]; then' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo ' if [[ $USERNAME != "git" ]]; then' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
echo ' mkdir -p /home/$MY_USERNAME/tempbackup' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo ' if [ -f /home/$USERNAME/.muttrc ]; then' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
|
echo ' echo "Backing up Mutt settings for $USERNAME"' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
|
echo ' if [ ! -d /home/$USERNAME/tempbackup ]; then' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
|
echo ' mkdir -p /home/$USERNAME/tempbackup' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
|
echo ' fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
|
echo ' cp /home/$USERNAME/.muttrc /home/$USERNAME/tempbackup' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
|
echo ' if [ -f /etc/Muttrc ]; then' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
|
echo ' cp /etc/Muttrc /home/$USERNAME/tempbackup' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
|
echo ' fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
|
echo ' if [ ! -d $SERVER_DIRECTORY/backup/mutt/$USERNAME ]; then' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
|
echo ' mkdir -p $SERVER_DIRECTORY/backup/mutt/$USERNAME' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
|
echo ' fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
|
echo ' backup_directory_to_friend /home/$USERNAME/tempbackup mutt/$USERNAME' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
|
echo ' fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
echo ' fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo ' fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
echo ' cp /home/$MY_USERNAME/.muttrc /home/$MY_USERNAME/tempbackup' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo 'done' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
echo ' if [ -f /etc/Muttrc ]; then' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
|
||||||
echo ' cp /etc/Muttrc /home/$MY_USERNAME/tempbackup' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
|
||||||
echo ' fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
|
||||||
echo ' if [ ! -d $SERVER_DIRECTORY/backup/mutt ]; then' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
|
||||||
echo ' mkdir -p $SERVER_DIRECTORY/backup/mutt' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
|
||||||
echo ' fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
|
||||||
echo ' backup_directory_to_friend /home/$MY_USERNAME/tempbackup mutt' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
|
||||||
echo 'fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
|
||||||
echo '' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo '' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
|
|
||||||
echo '# Backup procmail settings' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo '# Backup procmail settings' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
echo 'if [ -f /home/$MY_USERNAME/.procmailrc ]; then' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo 'for d in /home/*/ ; do' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
echo ' echo "Backing up procmail settings"' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo ' USERNAME=$(echo "$d" | awk -F "/" "{print $3}")' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
echo ' if [ ! -d /home/$MY_USERNAME/tempbackup ]; then' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo ' if [[ $USERNAME != "git" ]]; then' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
echo ' mkdir -p /home/$MY_USERNAME/tempbackup' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo ' if [ -f /home/$USERNAME/.procmailrc ]; then' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
|
echo ' echo "Backing up procmail settings for $USERNAME"' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
|
echo ' if [ ! -d /home/$USERNAME/tempbackup ]; then' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
|
echo ' mkdir -p /home/$USERNAME/tempbackup' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
|
echo ' fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
|
echo ' cp /home/$USERNAME/.procmailrc /home/$USERNAME/tempbackup' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
|
echo ' if [ ! -d $SERVER_DIRECTORY/backup/procmail/$USERNAME ]; then' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
|
echo ' mkdir -p $SERVER_DIRECTORY/backup/procmail/$USERNAME' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
|
echo ' fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
|
echo ' backup_directory_to_friend /home/$USERNAME/tempbackup procmail/$USERNAME' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
|
echo ' fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
echo ' fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo ' fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
echo ' cp /home/$MY_USERNAME/.procmailrc /home/$MY_USERNAME/tempbackup' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo 'done' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
echo ' if [ ! -d $SERVER_DIRECTORY/backup/procmail ]; then' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
|
||||||
echo ' mkdir -p $SERVER_DIRECTORY/backup/procmail' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
|
||||||
echo ' fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
|
||||||
echo ' backup_directory_to_friend /home/$MY_USERNAME/tempbackup procmail' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
|
||||||
echo 'fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
|
||||||
echo '' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo '' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
|
|
||||||
echo '# Backup spamassassin settings' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo '# Backup spamassassin settings' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
echo 'if [ -d /home/$MY_USERNAME/.spamassassin ]; then' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo 'for d in /home/*/ ; do' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
echo ' echo "Backing up spamassassin settings"' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo ' USERNAME=$(echo "$d" | awk -F "/" "{print $3}")' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
echo ' if [ ! -d $SERVER_DIRECTORY/backup/spamassassin ]; then' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo ' if [[ $USERNAME != "git" ]]; then' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
echo ' mkdir -p $SERVER_DIRECTORY/backup/spamassassin' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo ' if [ -d /home/$USERNAME/.spamassassin ]; then' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
|
echo ' echo "Backing up spamassassin settings for $USERNAME"' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
|
echo ' if [ ! -d $SERVER_DIRECTORY/backup/spamassassin/$USERNAME ]; then' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
|
echo ' mkdir -p $SERVER_DIRECTORY/backup/spamassassin/$USERNAME' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
|
echo ' fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
|
echo ' backup_directory_to_friend /home/$USERNAME/.spamassassin spamassassin/$USERNAME' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
|
echo ' fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
echo ' fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo ' fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
echo ' backup_directory_to_friend /home/$MY_USERNAME/.spamassassin spamassassin' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo 'done' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
echo 'fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
|
||||||
echo '' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo '' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
|
|
||||||
echo '# Backup email' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo '# Backup email' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
echo 'if [ -d /home/$MY_USERNAME/Maildir ]; then' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo 'for d in /home/*/ ; do' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
echo ' echo "Creating an email archive"' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo ' USERNAME=$(echo "$d" | awk -F "/" "{print $3}")' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
echo ' if [ ! -d /root/backupemail ]; then' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo ' if [[ $USERNAME != "git" ]]; then' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
echo " mkdir -p /root/backupemail" >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo ' if [ -d /home/$USERNAME/Maildir ]; then' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
|
echo ' echo "Creating an email archive"' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
|
echo ' if [ ! -d /root/backupemail/$USERNAME ]; then' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
|
echo " mkdir -p /root/backupemail/$USERNAME" >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
|
echo ' fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
|
echo ' tar -czvf /root/backupemail/$USERNAME/maildir.tar.gz /home/$USERNAME/Maildir' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
|
echo ' echo "Backing up emails for $USERNAME"' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
|
echo ' if [ ! -d $SERVER_DIRECTORY/backup/mail/$USERNAME ]; then' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
|
echo ' mkdir -p $SERVER_DIRECTORY/backup/mail/$USERNAME' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
|
echo ' fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
|
echo ' backup_directory_to_friend /root/backupemail/$USERNAME mail/$USERNAME' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
|
echo ' fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
echo ' fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo ' fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
echo ' tar -czvf /root/backupemail/maildir.tar.gz /home/$MY_USERNAME/Maildir' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo 'done' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
echo ' echo "Backing up emails"' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
|
||||||
echo ' if [ ! -d $SERVER_DIRECTORY/backup/mail ]; then' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
|
||||||
echo ' mkdir -p $SERVER_DIRECTORY/backup/mail' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
|
||||||
echo ' fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
|
||||||
echo ' backup_directory_to_friend /root/backupemail mail' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
|
||||||
echo 'fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
|
||||||
echo '' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo '' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
|
|
||||||
echo '# Backup DLNA cache' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo '# Backup DLNA cache' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
|
@ -4352,9 +4392,12 @@ function backup_to_friends_servers {
|
||||||
if [[ $ENABLE_SOCIAL_KEY_MANAGEMENT == "yes" ]]; then
|
if [[ $ENABLE_SOCIAL_KEY_MANAGEMENT == "yes" ]]; then
|
||||||
echo '' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo '' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
echo ' # Social key management' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo ' # Social key management' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
echo ' if [ -d /home/$MY_USERNAME/.gnupg_fragments ]; then' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo ' for d in /home/*/ ; do' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
echo ' if [ $REMOTE_DOMAIN ]; then' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo ' USERNAME=$(echo "$d" | awk -F "/" "{print $3}")' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
echo ' cd /home/$MY_USERNAME/.gnupg_fragments' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo ' if [[ $USERNAME != "git" ]]; then' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
|
echo ' if [ -d /home/$USERNAME/.gnupg_fragments ]; then' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
|
echo ' if [ $REMOTE_DOMAIN ]; then' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
|
echo ' cd /home/$USERNAME/.gnupg_fragments' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
echo ' no_of_shares=$(ls -afq keyshare.asc.* | wc -l)' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo ' no_of_shares=$(ls -afq keyshare.asc.* | wc -l)' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
echo ' if (( no_of_shares > 0 )); then' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo ' if (( no_of_shares > 0 )); then' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
echo ' # Pick a share index based on the domain name' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo ' # Pick a share index based on the domain name' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
|
@ -4363,17 +4406,17 @@ function backup_to_friends_servers {
|
||||||
echo ' share_index=$(echo $((0x${sharenumstr%% *} % ${no_of_shares})) | tr -d -)' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo ' share_index=$(echo $((0x${sharenumstr%% *} % ${no_of_shares})) | tr -d -)' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
echo '' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo '' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
echo ' # get the share filename' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo ' # get the share filename' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
echo ' share_files=(/home/$MY_USERNAME/.gnupg_fragments/keyshare.asc.*)' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo ' share_files=(/home/$USERNAME/.gnupg_fragments/keyshare.asc.*)' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
echo ' share_filename=${share_files[share_index]}' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo ' share_filename=${share_files[share_index]}' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
echo '' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo '' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
echo ' # create a temp directory containing the share' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo ' # create a temp directory containing the share' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
echo ' mkdir -p /home/$MY_USERNAME/tempkey/.gnupg_fragments' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo ' mkdir -p /home/$USERNAME/tempkey/.gnupg_fragments_$USERNAME' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
echo ' cp $share_filename /home/$MY_USERNAME/tempkey/.gnupg_fragments/' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo ' cp $share_filename /home/$USERNAME/tempkey/.gnupg_fragments_$USERNAME/' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
echo '' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo '' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
echo ' # copy the fragments directory to the remote server' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo ' # copy the fragments directory to the remote server' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
echo -n ' /usr/bin/sshpass -p $REMOTE_PASSWORD ' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo -n ' /usr/bin/sshpass -p $REMOTE_PASSWORD ' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
echo -n 'scp -r -P $REMOTE_SSH_PORT ' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo -n 'scp -r -P $REMOTE_SSH_PORT ' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
echo -n '/home/$MY_USERNAME/tempkey/.gnupg_fragments ' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo -n '/home/$USERNAME/tempkey/.gnupg_fragments_$USERNAME ' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
echo '$REMOTE_SERVER' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo '$REMOTE_SERVER' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
echo ' if [ ! "$?" = "0" ]; then' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo ' if [ ! "$?" = "0" ]; then' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
echo ' # Send a warning email' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo ' # Send a warning email' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
|
@ -4382,15 +4425,17 @@ function backup_to_friends_servers {
|
||||||
echo ' fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo ' fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
echo '' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo '' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
echo ' # remove the temp file/directory' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo ' # remove the temp file/directory' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
echo ' shred -zu /home/$MY_USERNAME/tempkey/.gnupg_fragments/*' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo ' shred -zu /home/$USERNAME/tempkey/.gnupg_fragments_$USERNAME/*' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
echo ' rm -rf /home/$MY_USERNAME/tempkey' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo ' rm -rf /home/$USERNAME/tempkey' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
echo '' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo '' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
echo ' # Send a confirmation email' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo ' # Send a confirmation email' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
echo -n ' echo "Key shared to $REMOTE_SERVER" | mail -s "Freedombone social key management" ' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo -n ' echo "Key shared to $REMOTE_SERVER" | mail -s "Freedombone social key management" ' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
echo "$MY_EMAIL_ADDRESS" >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo "$MY_EMAIL_ADDRESS" >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
echo ' fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo ' fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
|
echo ' fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
echo ' fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo ' fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
echo ' fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo ' fi' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
|
echo ' done' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo '' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
echo '' >> /usr/bin/$BACKUP_TO_FRIENDS_SCRIPT_NAME
|
||||||
|
@ -4644,80 +4689,100 @@ function restore_from_friend {
|
||||||
if [[ $BACKUP_TYPE != 'obnam' ]]; then
|
if [[ $BACKUP_TYPE != 'obnam' ]]; then
|
||||||
RESTORE_SUBDIR='remoterestore/backup/mutt/'
|
RESTORE_SUBDIR='remoterestore/backup/mutt/'
|
||||||
fi
|
fi
|
||||||
echo 'if [ -d $SERVER_DIRECTORY/backup/mutt ]; then' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
echo 'for d in /home/*/ ; do' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
echo ' echo "Restoring Mutt settings"' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
echo ' USERNAME=$(echo "$d" | awk -F "/" "{print $3}")' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
echo ' restore_directory_from_friend /root/tempmutt mutt' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
echo ' if [[ $USERNAME != "git" ]]; then' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
echo -n " if [ -f /root/tempmutt/${RESTORE_SUBDIR}" >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
echo ' if [ -d $SERVER_DIRECTORY/backup/mutt/$USERNAME ]; then' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
echo '$MY_USERNAME/tempbackup/.muttrc ]; then' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
echo ' echo "Restoring Mutt settings for $USERNAME"' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
echo -n " cp -f /root/tempmutt/${RESTORE_SUBDIR}" >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
echo ' restore_directory_from_friend /root/tempmutt mutt/$USERNAME' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
echo '$MY_USERNAME/tempbackup/.muttrc /home/$MY_USERNAME/.muttrc' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
echo -n " if [ -f /root/tempmutt/${RESTORE_SUBDIR}" >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
echo '$USERNAME/tempbackup/.muttrc ]; then' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
echo -n " cp -f /root/tempmutt/${RESTORE_SUBDIR}" >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
echo '$USERNAME/tempbackup/.muttrc /home/$USERNAME/.muttrc' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
echo ' fi' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
echo -n " if [ -f /root/tempmutt/${RESTORE_SUBDIR}" >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
echo '$USERNAME/tempbackup/Muttrc ]; then' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
echo -n " cp -f /root/tempmutt/${RESTORE_SUBDIR}" >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
echo '$USERNAME/tempbackup/Muttrc /etc/Muttrc' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
echo ' fi' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
echo ' if [ ! "$?" = "0" ]; then' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
echo ' rm -rf /root/tempmutt' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
echo ' exit 276' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
echo ' fi' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
echo ' rm -rf /root/tempmutt' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
echo ' fi' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
echo ' fi' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
echo ' fi' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
echo -n " if [ -f /root/tempmutt/${RESTORE_SUBDIR}" >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
echo 'done' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
echo '$MY_USERNAME/tempbackup/Muttrc ]; then' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
|
||||||
echo -n " cp -f /root/tempmutt/${RESTORE_SUBDIR}" >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
|
||||||
echo '$MY_USERNAME/tempbackup/Muttrc /etc/Muttrc' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
|
||||||
echo ' fi' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
|
||||||
echo ' if [ ! "$?" = "0" ]; then' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
|
||||||
echo ' rm -rf /root/tempmutt' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
|
||||||
echo ' exit 276' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
|
||||||
echo ' fi' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
|
||||||
echo ' rm -rf /root/tempmutt' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
|
||||||
echo 'fi' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
|
||||||
echo '' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
echo '' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
|
||||||
RESTORE_SUBDIR='home'
|
RESTORE_SUBDIR='home'
|
||||||
if [[ $BACKUP_TYPE != 'obnam' ]]; then
|
if [[ $BACKUP_TYPE != 'obnam' ]]; then
|
||||||
RESTORE_SUBDIR='remoterestore/backup/gnupg'
|
RESTORE_SUBDIR='remoterestore/backup/gnupg'
|
||||||
fi
|
fi
|
||||||
echo 'if [ -d $SERVER_DIRECTORY/backup/gnupg ]; then' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
echo 'for d in /home/*/ ; do' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
echo ' echo "Restoring gnupg settings"' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
echo ' USERNAME=$(echo "$d" | awk -F "/" "{print $3}")' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
echo ' restore_directory_from_friend /root/tempgnupg gnupg' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
echo ' if [[ $USERNAME != "git" ]]; then' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
echo -n " cp -r /root/tempgnupg/${RESTORE_SUBDIR}/" >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
echo ' if [ -d $SERVER_DIRECTORY/backup/gnupg/$USERNAME ]; then' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
echo '$MY_USERNAME/.gnupg /home/$MY_USERNAME/' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
echo ' echo "Restoring gnupg settings for $USERNAME"' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
echo ' if [ ! "$?" = "0" ]; then' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
echo ' restore_directory_from_friend /root/tempgnupg gnupg/$USERNAME' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
echo ' rm -rf /root/tempgnupg' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
echo -n " cp -r /root/tempgnupg/${RESTORE_SUBDIR}/" >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
echo ' exit 276' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
echo '$USERNAME/.gnupg /home/$USERNAME/' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
echo ' if [ ! "$?" = "0" ]; then' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
echo ' rm -rf /root/tempgnupg' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
echo ' exit 276' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
echo ' fi' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
echo ' rm -rf /root/tempgnupg' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
echo ' cp -r /home/$USERNAME/.gnupg /root' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
echo ' if [ ! "$?" = "0" ]; then' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
echo ' exit 283' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
echo ' fi' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
echo ' fi' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
echo ' fi' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
echo ' fi' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
echo ' rm -rf /root/tempgnupg' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
echo 'done' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
echo ' cp -r /home/$MY_USERNAME/.gnupg /root' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
|
||||||
echo ' if [ ! "$?" = "0" ]; then' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
|
||||||
echo ' exit 283' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
|
||||||
echo ' fi' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
|
||||||
echo 'fi' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
|
||||||
echo '' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
echo '' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
|
||||||
RESTORE_SUBDIR='home'
|
RESTORE_SUBDIR='home'
|
||||||
if [[ $BACKUP_TYPE != 'obnam' ]]; then
|
if [[ $BACKUP_TYPE != 'obnam' ]]; then
|
||||||
RESTORE_SUBDIR='remoterestore/backup/procmail'
|
RESTORE_SUBDIR='remoterestore/backup/procmail'
|
||||||
fi
|
fi
|
||||||
echo 'if [ -d $SERVER_DIRECTORY/backup/procmail ]; then' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
echo 'for d in /home/*/ ; do' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
echo ' echo "Restoring procmail settings"' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
echo ' USERNAME=$(echo "$d" | awk -F "/" "{print $3}")' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
echo ' restore_directory_from_friend /root/tempprocmail procmail' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
echo ' if [[ $USERNAME != "git" ]]; then' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
echo -n " cp -f /root/tempprocmail/${RESTORE_SUBDIR}" >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
echo ' if [ -d $SERVER_DIRECTORY/backup/procmail/$USERNAME ]; then' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
echo '/$MY_USERNAME/tempbackup/.procmailrc /home/$MY_USERNAME/' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
echo ' echo "Restoring procmail settings for $USERNAME"' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
echo ' if [ ! "$?" = "0" ]; then' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
echo ' restore_directory_from_friend /root/tempprocmail procmail/$USERNAME' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
echo ' rm -rf /root/tempprocmail' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
echo -n " cp -f /root/tempprocmail/${RESTORE_SUBDIR}" >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
echo ' exit 276' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
echo '/$USERNAME/tempbackup/.procmailrc /home/$USERNAME/' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
echo ' if [ ! "$?" = "0" ]; then' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
echo ' rm -rf /root/tempprocmail' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
echo ' exit 276' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
echo ' fi' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
echo ' rm -rf /root/tempprocmail' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
echo ' fi' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
echo ' fi' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
echo ' fi' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
echo ' rm -rf /root/tempprocmail' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
echo 'done' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
echo 'fi' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
|
||||||
echo '' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
echo '' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
|
||||||
RESTORE_SUBDIR='home'
|
RESTORE_SUBDIR='home'
|
||||||
if [[ $BACKUP_TYPE != 'obnam' ]]; then
|
if [[ $BACKUP_TYPE != 'obnam' ]]; then
|
||||||
RESTORE_SUBDIR='remoterestore/backup/spamassassin'
|
RESTORE_SUBDIR='remoterestore/backup/spamassassin'
|
||||||
fi
|
fi
|
||||||
echo 'if [ -d $SERVER_DIRECTORY/backup/spamassassin ]; then' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
echo 'for d in /home/*/ ; do' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
echo ' echo "Restoring spamassassin settings"' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
echo ' USERNAME=$(echo "$d" | awk -F "/" "{print $3}")' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
echo ' restore_directory_from_friend /root/tempspamassassin spamassassin' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
echo ' if [[ $USERNAME != "git" ]]; then' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
echo -n " cp -rf /root/tempspamassassin/${RESTORE_SUBDIR}/" >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
echo ' if [ -d $SERVER_DIRECTORY/backup/spamassassin/$USERNAME ]; then' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
echo '$MY_USERNAME/.spamassassin /home/$MY_USERNAME/' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
echo ' echo "Restoring spamassassin settings for $USERNAME"' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
echo ' if [ ! "$?" = "0" ]; then' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
echo ' restore_directory_from_friend /root/tempspamassassin spamassassin/$USERNAME' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
echo ' rm -rf /root/tempspamassassin' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
echo -n " cp -rf /root/tempspamassassin/${RESTORE_SUBDIR}/" >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
echo ' exit 276' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
echo '$USERNAME/.spamassassin /home/$USERNAME/' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
echo ' if [ ! "$?" = "0" ]; then' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
echo ' rm -rf /root/tempspamassassin' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
echo ' exit 276' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
echo ' fi' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
echo ' rm -rf /root/tempspamassassin' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
echo ' fi' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
echo ' fi' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
echo ' fi' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
echo ' rm -rf /root/tempspamassassin' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
echo 'done' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
echo 'fi' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
|
||||||
echo '' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
echo '' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
|
||||||
RESTORE_SUBDIR='home'
|
RESTORE_SUBDIR='home'
|
||||||
|
@ -4758,17 +4823,22 @@ function restore_from_friend {
|
||||||
if [[ $BACKUP_TYPE != 'obnam' ]]; then
|
if [[ $BACKUP_TYPE != 'obnam' ]]; then
|
||||||
RESTORE_SUBDIR='remoterestore/backup/ssh'
|
RESTORE_SUBDIR='remoterestore/backup/ssh'
|
||||||
fi
|
fi
|
||||||
echo 'if [ -d $SERVER_DIRECTORY/backup/ssh ]; then' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
echo 'for d in /home/*/ ; do' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
echo ' echo "Restoring ssh keys"' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
echo ' USERNAME=$(echo "$d" | awk -F "/" "{print $3}")' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
echo ' restore_directory_from_friend /root/tempssh ssh' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
echo ' if [[ $USERNAME != "git" ]]; then' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
echo -n " cp -r /root/tempssh/${RESTORE_SUBDIR}/" >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
echo ' if [ -d $SERVER_DIRECTORY/backup/ssh/$USERNAME ]; then' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
echo '$MY_USERNAME/.ssh /home/$MY_USERNAME/' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
echo ' echo "Restoring ssh keys for $USERNAME"' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
echo ' if [ ! "$?" = "0" ]; then' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
echo ' restore_directory_from_friend /root/tempssh ssh/$USERNAME' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
echo ' rm -rf /root/tempssh' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
echo -n " cp -r /root/tempssh/${RESTORE_SUBDIR}/" >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
echo ' exit 664' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
echo '$USERNAME/.ssh /home/$USERNAME/' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
echo ' if [ ! "$?" = "0" ]; then' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
echo ' rm -rf /root/tempssh' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
echo ' exit 664' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
echo ' fi' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
echo ' rm -rf /root/tempssh' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
echo ' fi' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
echo ' fi' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
echo ' fi' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
echo ' rm -rf /root/tempssh' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
echo 'done' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
echo 'fi' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
|
||||||
echo '' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
echo '' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
|
||||||
RESTORE_SUBDIR='etc'
|
RESTORE_SUBDIR='etc'
|
||||||
|
@ -4791,38 +4861,48 @@ function restore_from_friend {
|
||||||
if [[ $BACKUP_TYPE != 'obnam' ]]; then
|
if [[ $BACKUP_TYPE != 'obnam' ]]; then
|
||||||
RESTORE_SUBDIR='remoterestore/backup/projects'
|
RESTORE_SUBDIR='remoterestore/backup/projects'
|
||||||
fi
|
fi
|
||||||
echo 'if [ -d $SERVER_DIRECTORY/backup/projects ]; then' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
echo 'for d in /home/*/ ; do' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
echo ' echo "Restoring projects"' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
echo ' USERNAME=$(echo "$d" | awk -F "/" "{print $3}")' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
echo ' restore_directory_from_friend /root/tempprojects projects' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
echo ' if [[ $USERNAME != "git" ]]; then' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
echo ' if [ -d /home/$MY_USERNAME/projects ]; then' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
echo ' if [ -d $SERVER_DIRECTORY/backup/projects/$USERNAME ]; then' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
echo ' rm -rf /home/$MY_USERNAME/projects' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
echo ' echo "Restoring projects for $USERNAME"' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
echo ' restore_directory_from_friend /root/tempprojects projects/$USERNAME' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
echo ' if [ -d /home/$USERNAME/projects ]; then' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
echo ' rm -rf /home/$USERNAME/projects' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
echo ' fi' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
echo -n " mv /root/tempprojects/${RESTORE_SUBDIR}/" >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
echo '$USERNAME/projects /home/$USERNAME' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
echo ' if [ ! "$?" = "0" ]; then' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
echo ' exit 166' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
echo ' fi' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
echo ' rm -rf /root/tempprojects' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
echo ' fi' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
echo ' fi' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
echo ' fi' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
echo -n " mv /root/tempprojects/${RESTORE_SUBDIR}/" >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
echo 'done' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
echo '$MY_USERNAME/projects /home/$MY_USERNAME' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
|
||||||
echo ' if [ ! "$?" = "0" ]; then' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
|
||||||
echo ' exit 166' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
|
||||||
echo ' fi' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
|
||||||
echo ' rm -rf /root/tempprojects' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
|
||||||
echo 'fi' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
|
||||||
echo '' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
echo '' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
|
||||||
RESTORE_SUBDIR='home'
|
RESTORE_SUBDIR='home'
|
||||||
if [[ $BACKUP_TYPE != 'obnam' ]]; then
|
if [[ $BACKUP_TYPE != 'obnam' ]]; then
|
||||||
RESTORE_SUBDIR='remoterestore/backup/personal'
|
RESTORE_SUBDIR='remoterestore/backup/personal'
|
||||||
fi
|
fi
|
||||||
echo 'if [ -d $SERVER_DIRECTORY/backup/personal ]; then' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
echo 'for d in /home/*/ ; do' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
echo ' echo "Restoring personal settings"' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
echo ' USERNAME=$(echo "$d" | awk -F "/" "{print $3}")' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
echo ' restore_directory_from_friend /root/temppersonal personal' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
echo ' if [[ $USERNAME != "git" ]]; then' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
echo ' if [ -d /home/$MY_USERNAME/personal ]; then' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
echo ' if [ -d $SERVER_DIRECTORY/backup/personal/$USERNAME ]; then' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
echo ' rm -rf /home/$MY_USERNAME/personal' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
echo ' echo "Restoring personal settings for $USERNAME"' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
echo ' restore_directory_from_friend /root/temppersonal personal/$USERNAME' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
echo ' if [ -d /home/$USERNAME/personal ]; then' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
echo ' rm -rf /home/$USERNAME/personal' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
echo ' fi' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
echo -n " mv /root/temppersonal/${RESTORE_SUBDIR}/" >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
echo '$USERNAME/personal /home/$USERNAME' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
echo ' if [ ! "$?" = "0" ]; then' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
echo ' exit 184' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
echo ' fi' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
echo ' rm -rf /root/temppersonal' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
echo ' fi' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
echo ' fi' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
echo ' fi' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
echo -n " mv /root/temppersonal/${RESTORE_SUBDIR}/" >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
echo 'done' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
echo '$MY_USERNAME/personal /home/$MY_USERNAME' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
|
||||||
echo ' if [ ! "$?" = "0" ]; then' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
|
||||||
echo ' exit 184' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
|
||||||
echo ' fi' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
|
||||||
echo ' rm -rf /root/temppersonal' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
|
||||||
echo 'fi' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
|
||||||
echo '' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
echo '' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
|
||||||
RESTORE_SUBDIR='root'
|
RESTORE_SUBDIR='root'
|
||||||
|
@ -4910,7 +4990,12 @@ function restore_from_friend {
|
||||||
echo ' chown -R www-data:www-data /var/lib/owncloud/data' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
echo ' chown -R www-data:www-data /var/lib/owncloud/data' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
echo ' chown -R www-data:www-data /var/lib/owncloud/backup' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
echo ' chown -R www-data:www-data /var/lib/owncloud/backup' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
echo ' chown -R www-data:www-data /var/lib/owncloud/assets' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
echo ' chown -R www-data:www-data /var/lib/owncloud/assets' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
echo ' occ files:scan $MY_USERNAME' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
echo ' for d in /home/*/ ; do' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
echo ' USERNAME=$(echo "$d" | awk -F "/" "{print $3}")' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
echo ' if [[ $USERNAME != "git" ]]; then' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
echo ' occ files:scan $USERNAME' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
echo ' fi' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
echo ' done' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
echo " ln -s /usr/share/owncloud /var/www/$OWNCLOUD_DOMAIN_NAME/htdocs" >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
echo " ln -s /usr/share/owncloud /var/www/$OWNCLOUD_DOMAIN_NAME/htdocs" >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
echo 'fi' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
echo 'fi' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
echo '' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
echo '' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
@ -5014,12 +5099,19 @@ function restore_from_friend {
|
||||||
echo " if [ -f /etc/ssl/certs/$FULLBLOG_DOMAIN_NAME.bundle.crt ]; then" >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
echo " if [ -f /etc/ssl/certs/$FULLBLOG_DOMAIN_NAME.bundle.crt ]; then" >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
echo " sed -i 's|$FULLBLOG_DOMAIN_NAME.crt|$FULLBLOG_DOMAIN_NAME.bundle.crt|g' /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME" >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
echo " sed -i 's|$FULLBLOG_DOMAIN_NAME.crt|$FULLBLOG_DOMAIN_NAME.bundle.crt|g' /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME" >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
echo ' fi' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
echo ' fi' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
echo -n " if [ -d /var/www/$FULLBLOG_DOMAIN_NAME/htdocs/content" >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
|
||||||
echo '/$MY_USERNAME/blog/uncategorized/post ]; then' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
echo ' for d in /home/*/ ; do' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
echo -n " mv /var/www/$FULLBLOG_DOMAIN_NAME/htdocs/content" >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
echo ' USERNAME=$(echo "$d" | awk -F "/" "{print $3}")' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
echo -n '/$MY_USERNAME/blog/*.md ' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
echo ' if [[ $USERNAME != "git" ]]; then' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
|
||||||
|
echo -n " if [ -d /var/www/$FULLBLOG_DOMAIN_NAME/htdocs/content" >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
echo '/$USERNAME/blog/uncategorized/post ]; then' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
echo -n " mv /var/www/$FULLBLOG_DOMAIN_NAME/htdocs/content" >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
echo -n '/$USERNAME/blog/*.md ' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
echo -n "/var/www/$FULLBLOG_DOMAIN_NAME/htdocs/content" >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
echo -n "/var/www/$FULLBLOG_DOMAIN_NAME/htdocs/content" >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
echo '/$MY_USERNAME/blog/uncategorized/post ' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
echo '/$USERNAME/blog/uncategorized/post ' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
echo ' fi' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
echo ' done' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
echo 'fi' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
echo 'fi' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
echo '' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
echo '' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
|
||||||
|
@ -5086,18 +5178,23 @@ function restore_from_friend {
|
||||||
if [[ $BACKUP_TYPE != 'obnam' ]]; then
|
if [[ $BACKUP_TYPE != 'obnam' ]]; then
|
||||||
RESTORE_SUBDIR='remoterestore/backup/mail'
|
RESTORE_SUBDIR='remoterestore/backup/mail'
|
||||||
fi
|
fi
|
||||||
echo 'if [ -d $SERVER_DIRECTORY/backup/mail ]; then' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
echo 'for d in /home/*/ ; do' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
echo ' echo "Restoring emails"' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
echo ' USERNAME=$(echo "$d" | awk -F "/" "{print $3}")' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
echo ' restore_directory_from_friend /root/tempmail mail' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
echo ' if [[ $USERNAME != "git" ]]; then' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
echo ' if [ ! -d /home/$MY_USERNAME/Maildir ]; then' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
echo ' if [ -d $SERVER_DIRECTORY/backup/mail/$USERNAME ]; then' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
echo ' mkdir /home/$MY_USERNAME/Maildir' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
echo ' echo "Restoring emails for $USERNAME"' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
echo ' restore_directory_from_friend /root/tempmail mail/$USERNAME' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
echo ' if [ ! -d /home/$USERNAME/Maildir ]; then' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
echo ' mkdir /home/$USERNAME/Maildir' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
echo ' fi' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
echo " tar -xzvf /root/tempmail/${RESTORE_SUBDIR}/tempbackupemail/maildir.tar.gz -C /" >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
echo ' if [ ! "$?" = "0" ]; then' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
echo ' exit 927' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
echo ' fi' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
echo ' rm -rf /root/tempmail' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
echo ' fi' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
echo ' fi' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
echo ' fi' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
echo " tar -xzvf /root/tempmail/${RESTORE_SUBDIR}/tempbackupemail/maildir.tar.gz -C /" >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
echo 'done' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
echo ' if [ ! "$?" = "0" ]; then' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
|
||||||
echo ' exit 927' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
|
||||||
echo ' fi' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
|
||||||
echo ' rm -rf /root/tempmail' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
|
||||||
echo 'fi' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
|
||||||
echo '' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
echo '' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
|
||||||
RESTORE_SUBDIR='var'
|
RESTORE_SUBDIR='var'
|
||||||
|
@ -5118,10 +5215,23 @@ function restore_from_friend {
|
||||||
|
|
||||||
if [[ $ENABLE_SOCIAL_KEY_MANAGEMENT == "yes" ]]; then
|
if [[ $ENABLE_SOCIAL_KEY_MANAGEMENT == "yes" ]]; then
|
||||||
echo '' >> /usr/bin/$RESTORE_FROM_FRIENDS_SCRIPT_NAME
|
echo '' >> /usr/bin/$RESTORE_FROM_FRIENDS_SCRIPT_NAME
|
||||||
echo '# Retrieve key fragments' >> /usr/bin/$RESTORE_FROM_FRIENDS_SCRIPT_NAME
|
echo 'for d in /home/*/ ; do' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
echo -n '/usr/bin/sshpass -p $REMOTE_PASSWORD ' >> /usr/bin/$RESTORE_FROM_FRIENDS_SCRIPT_NAME
|
echo ' USERNAME=$(echo "$d" | awk -F "/" "{print $3}")' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
echo -n "scp -r -P $REMOTE_SSH_PORT $REMOTE_SERVER/.gnupg_fragments " >> /usr/bin/$RESTORE_FROM_FRIENDS_SCRIPT_NAME
|
echo ' if [[ $USERNAME != "git" ]]; then' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
echo '/home/$MY_USERNAME/' >> /usr/bin/$RESTORE_FROM_FRIENDS_SCRIPT_NAME
|
echo ' # Retrieve key fragments for $USERNAME' >> /usr/bin/$RESTORE_FROM_FRIENDS_SCRIPT_NAME
|
||||||
|
echo -n ' /usr/bin/sshpass -p $REMOTE_PASSWORD ' >> /usr/bin/$RESTORE_FROM_FRIENDS_SCRIPT_NAME
|
||||||
|
echo -n "scp -r -P $REMOTE_SSH_PORT $REMOTE_SERVER/.gnupg_fragments_$USERNAME " >> /usr/bin/$RESTORE_FROM_FRIENDS_SCRIPT_NAME
|
||||||
|
echo '/home/$USERNAME/' >> /usr/bin/$RESTORE_FROM_FRIENDS_SCRIPT_NAME
|
||||||
|
echo ' if [ -d /home/$USERNAME/.gnupg_fragments_$USERNAME ]; then' >> /usr/bin/$RESTORE_FROM_FRIENDS_SCRIPT_NAME
|
||||||
|
echo ' if [ -d /home/$USERNAME/.gnupg_fragments ]; then' >> /usr/bin/$RESTORE_FROM_FRIENDS_SCRIPT_NAME
|
||||||
|
echo ' cp /home/$USERNAME/.gnupg_fragments_$USERNAME/* /home/$USERNAME/.gnupg_fragments' >> /usr/bin/$RESTORE_FROM_FRIENDS_SCRIPT_NAME
|
||||||
|
echo ' rm -rf /home/$USERNAME/.gnupg_fragments_$USERNAME' >> /usr/bin/$RESTORE_FROM_FRIENDS_SCRIPT_NAME
|
||||||
|
echo ' else' >> /usr/bin/$RESTORE_FROM_FRIENDS_SCRIPT_NAME
|
||||||
|
echo ' mv /home/$USERNAME/.gnupg_fragments_$USERNAME /home/$USERNAME/.gnupg_fragments' >> /usr/bin/$RESTORE_FROM_FRIENDS_SCRIPT_NAME
|
||||||
|
echo ' fi' >> /usr/bin/$RESTORE_FROM_FRIENDS_SCRIPT_NAME
|
||||||
|
echo ' fi' >> /usr/bin/$RESTORE_FROM_FRIENDS_SCRIPT_NAME
|
||||||
|
echo ' fi' >> /usr/bin/$RESTORE_FROM_FRIENDS_SCRIPT_NAME
|
||||||
|
echo 'done' >> /usr/bin/$RESTORE_FROM_FRIENDS_SCRIPT_NAME
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo '' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
echo '' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
|
||||||
|
|
Loading…
Reference in New Issue