Browse Source

Use a fixed obnam client name

Bob Mottram 8 years ago
parent
commit
d79ad89c16

+ 9
- 0
src/freedombone-backup-local View File

@@ -68,6 +68,14 @@ if [ -f /root/dbpass ]; then
68 68
     DATABASE_PASSWORD=$(cat /root/dbpass)
69 69
 fi
70 70
 
71
+function set_obnam_client_name {
72
+    # obnam can backup multiple machines with different domain names to
73
+    # a repository. To be able to restore directories from different
74
+    # machines we need to enforce a single client name for all backups
75
+    echo '[config]' > /etc/obnam.conf
76
+    echo "client-name = ${PROJECT_NAME}" >> /etc/obnam.conf
77
+}
78
+
71 79
 function suspend_site {
72 80
     # suspends a given website
73 81
     if [[ $ENABLE_VERIFICATION != "yes" ]]; then
@@ -217,6 +225,7 @@ function backup_directory_to_usb {
217 225
         if [ ! -d $USB_MOUNT/backup/${2} ]; then
218 226
             mkdir -p $USB_MOUNT/backup/${2}
219 227
         fi
228
+        set_obnam_client_name
220 229
         obnam force-lock -r $USB_MOUNT/backup/${2} --encrypt-with $MY_BACKUP_KEY_ID ${1}
221 230
         obnam backup -r $USB_MOUNT/backup/${2} --encrypt-with $MY_BACKUP_KEY_ID ${1}
222 231
         if [[ $ENABLE_VERIFICATION == "yes" ]]; then

+ 541
- 532
src/freedombone-backup-remote
File diff suppressed because it is too large
View File


+ 9
- 0
src/freedombone-restore-local View File

@@ -71,6 +71,14 @@ GIT_DOMAIN_NAME=
71 71
 WIKI_DOMAIN_NAME=
72 72
 FULLBLOG_DOMAIN_NAME=
73 73
 
74
+function set_obnam_client_name {
75
+    # obnam can backup multiple machines with different domain names to
76
+    # a repository. To be able to restore directories from different
77
+    # machines we need to enforce a single client name for all backups
78
+    echo '[config]' > /etc/obnam.conf
79
+    echo "client-name = ${PROJECT_NAME}" >> /etc/obnam.conf
80
+}
81
+
74 82
 function mount_drive {
75 83
     if [ $1 ]; then
76 84
         USB_DRIVE=/dev/${1}1
@@ -169,6 +177,7 @@ function restore_directory_from_usb {
169 177
     if [ ! -d ${1} ]; then
170 178
         mkdir ${1}
171 179
     fi
180
+    set_obnam_client_name
172 181
     obnam restore -r $USB_MOUNT/backup/${2} --to ${1}
173 182
 }
174 183
 

+ 9
- 0
src/freedombone-restore-remote View File

@@ -97,10 +97,19 @@ fi
97 97
 # MariaDB password
98 98
 DATABASE_PASSWORD=$(cat /root/dbpass)
99 99
 
100
+function set_obnam_client_name {
101
+    # obnam can backup multiple machines with different domain names to
102
+    # a repository. To be able to restore directories from different
103
+    # machines we need to enforce a single client name for all backups
104
+    echo '[config]' > /etc/obnam.conf
105
+    echo "client-name = ${PROJECT_NAME}" >> /etc/obnam.conf
106
+}
107
+
100 108
 function restore_directory_from_friend {
101 109
     if [ ! -d ${1} ]; then
102 110
         mkdir ${1}
103 111
     fi
112
+    set_obnam_client_name
104 113
     obnam restore -r $SERVER_DIRECTORY/backup/${2} --to ${1}
105 114
 }
106 115