|
@@ -255,63 +255,19 @@ function backup_directories {
|
255
|
255
|
|
256
|
256
|
# directories to be backed up (source,dest)
|
257
|
257
|
backup_dirs=(
|
258
|
|
- "none, none, /etc/letsencrypt, letsencrypt"
|
259
|
|
- "none, none, /var/lib/dokuwiki, wiki"
|
260
|
|
- "none, none, /etc/dokuwiki, wiki2"
|
261
|
|
- "none, none, /etc/ssl, ssl"
|
262
|
|
- "/etc/share/tt-rss, ttrss, /root/tempttrssdata, ttrss"
|
263
|
|
- "none, none, /var/spool/mlmmj, mailinglist"
|
264
|
|
- "none, none, /var/lib/prosody, xmpp"
|
265
|
|
- "none, none, /etc/nginx/sites-available, web"
|
266
|
|
- "none, none, /home/$ADMIN_USERNAME/.ipfs, ipfs"
|
267
|
|
- "none, none, /var/cache/minidlna, dlna"
|
268
|
|
- "$GOPATH/src/github.com/gogits, gogs, /root/tempgogsdata, gogsdata"
|
269
|
|
- "none, none, $GOPATH/src/github.com/gogits/gogs/custom, gogs"
|
270
|
|
- "none, none, /home/git/gogs-repositories, gogsrepos"
|
271
|
|
- "none, none, /home/git/.ssh, gogsssh"
|
272
|
|
- "none, none, /var/lib/tox-bootstrapd, tox"
|
273
|
|
- "/var/www/${MICROBLOG_DOMAIN_NAME}, gnusocial, /root/tempgnusocialdata, gnusocialdata"
|
274
|
|
- "none, none, /var/www/${MICROBLOG_DOMAIN_NAME}/htdocs, gnusocial"
|
275
|
|
- "none, none, /var/lib/syncthing/SyncShared, syncthingshared"
|
276
|
|
- "none, none, /root/.config/syncthing, syncthingconfig"
|
277
|
|
- "/var/www/${HUBZILLA_DOMAIN_NAME}, hubzilla, /root/temphubzilladata, hubzilladata"
|
278
|
|
- "none, none, /var/www/${HUBZILLA_DOMAIN_NAME}/htdocs, hubzilla"
|
279
|
|
- "none, none, /var/www/${FULLBLOG_DOMAIN_NAME}/htdocs, blog"
|
280
|
|
- "none, none, /var/lib/tor, tor"
|
281
|
|
- "none, none, /var/www/${MEDIAGOBLIN_DOMAIN_NAME}/htdocs, mediagoblin"
|
|
258
|
+ "/etc/letsencrypt, letsencrypt"
|
|
259
|
+ "/etc/ssl, ssl"
|
|
260
|
+ "/var/spool/mlmmj, mailinglist"
|
|
261
|
+ "/etc/nginx/sites-available, web"
|
|
262
|
+ "/var/lib/tor, tor"
|
282
|
263
|
)
|
283
|
264
|
|
284
|
265
|
for dr in "${backup_dirs[@]}"
|
285
|
266
|
do
|
286
|
|
- # if this directory exists then backup the given database
|
287
|
|
- required_directory=$(echo $dr | awk -F ',' '{print $1}' | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
|
288
|
|
- database_name=$(echo $dr | awk -F ',' '{print $2}' | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
|
289
|
|
-
|
290
|
|
- if [[ "$database_name" == *"hubzilla"* ]]; then
|
291
|
|
- suspend_site ${HUBZILLA_DOMAIN_NAME}
|
292
|
|
- fi
|
293
|
|
- if [[ "$database_name" == *"gnusocial"* ]]; then
|
294
|
|
- suspend_site ${MICROBLOG_DOMAIN_NAME}
|
295
|
|
- fi
|
296
|
|
- if [[ "$database_name" == *"gogs"* ]]; then
|
297
|
|
- suspend_site ${GIT_DOMAIN_NAME}
|
298
|
|
- fi
|
299
|
|
- if [[ "$database_name" == *"ttrss"* ]]; then
|
300
|
|
- suspend_site ${RSS_READER_DOMAIN_NAME}
|
301
|
|
- fi
|
302
|
|
-
|
303
|
|
- if [[ $required_directory != "none" ]]; then
|
304
|
|
- if [ -d $required_directory ]; then
|
305
|
|
- if [[ $database_name != "none" ]]; then
|
306
|
|
- backup_database_local $database_name
|
307
|
|
- fi
|
308
|
|
- fi
|
309
|
|
- fi
|
310
|
|
-
|
311
|
267
|
# if this directory exists then back it up to the given destination
|
312
|
|
- source_directory=$(echo $dr | awk -F ',' '{print $3}' | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
|
|
268
|
+ source_directory=$(echo $dr | awk -F ',' '{print $1}' | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
|
313
|
269
|
if [ -d $source_directory ]; then
|
314
|
|
- dest_directory=$(echo $dr | awk -F ',' '{print $4}' | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
|
|
270
|
+ dest_directory=$(echo $dr | awk -F ',' '{print $2}' | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
|
315
|
271
|
echo $"Backing up $source_directory to $dest_directory"
|
316
|
272
|
backup_directory_to_usb $source_directory $dest_directory
|
317
|
273
|
fi
|
|
@@ -320,6 +276,25 @@ function backup_directories {
|
320
|
276
|
done
|
321
|
277
|
}
|
322
|
278
|
|
|
279
|
+function backup_apps {
|
|
280
|
+ FILES=/usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-*
|
|
281
|
+
|
|
282
|
+ APPS_COMPLETED=()
|
|
283
|
+
|
|
284
|
+ # for all the app scripts
|
|
285
|
+ for filename in $FILES
|
|
286
|
+ do
|
|
287
|
+ app_name=$(echo "${filename}" | awk -F '-app-' '{print $2}')
|
|
288
|
+ if [[ $(item_in_array ${app_name} ${APPS_COMPLETED[@]}) != 0 ]]; then
|
|
289
|
+ if [[ "$(app_is_installed $a)" == "1" ]]; then
|
|
290
|
+ APPS_COMPLETED+=("${app_name}")
|
|
291
|
+ function_check backup_local_${app_name}
|
|
292
|
+ backup_local_${app_name}
|
|
293
|
+ fi
|
|
294
|
+ fi
|
|
295
|
+ done
|
|
296
|
+}
|
|
297
|
+
|
323
|
298
|
function remove_backup_directory {
|
324
|
299
|
if [ $1 ]; then
|
325
|
300
|
if [[ $1 == "remove" ]]; then
|
|
@@ -382,19 +357,6 @@ function backup_admin_readme {
|
382
|
357
|
fi
|
383
|
358
|
}
|
384
|
359
|
|
385
|
|
-function backup_voip {
|
386
|
|
- if [ -f /etc/mumble-server.ini ]; then
|
387
|
|
- echo $"Backing up VoIP settings"
|
388
|
|
- if [ ! -d /root/tempvoipbackup ]; then
|
389
|
|
- mkdir -p /root/tempvoipbackup
|
390
|
|
- fi
|
391
|
|
- cp -f /etc/mumble-server.ini /root/tempvoipbackup
|
392
|
|
- cp -f /var/lib/mumble-server/mumble-server.sqlite /root/tempvoipbackup
|
393
|
|
- cp -f /etc/sipwitch.conf /root/tempvoipbackup
|
394
|
|
- backup_directory_to_usb /root/tempvoipbackup voip
|
395
|
|
- fi
|
396
|
|
-}
|
397
|
|
-
|
398
|
360
|
function backup_mariadb {
|
399
|
361
|
if [ ${#DATABASE_PASSWORD} -gt 1 ]; then
|
400
|
362
|
if [ ! -d /root/tempmariadb ]; then
|
|
@@ -485,9 +447,9 @@ update_domains
|
485
|
447
|
backup_users
|
486
|
448
|
prepare_directories
|
487
|
449
|
backup_directories
|
|
450
|
+backup_apps
|
488
|
451
|
backup_configuration
|
489
|
452
|
backup_admin_readme
|
490
|
|
-backup_voip
|
491
|
453
|
backup_mariadb
|
492
|
454
|
backup_extra_directories
|
493
|
455
|
backup_unmount_drive $USB_DRIVE $USB_MOUNT
|