-
Notifications
You must be signed in to change notification settings - Fork 0
/
dbackL
executable file
·1558 lines (1340 loc) · 39.5 KB
/
dbackL
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#! /bin/bash
#
# dbackL backup script.
# Execute this shell script without arguments for help.
#
###############################################################################
# Tuning
# ------
# This is your personal list of files to exclude from backup, in a format
# recognized by rsync(1). If your backup source and destination are the same
# machine, then you should exclude your destination directory from any backups.
rsync_excludes="$(mktemp -t dbackLXXX)"
cat <<EOF >"$rsync_excludes" || exit 1
/backups
EOF
# Path to the local rsync program
RSYNC="/usr/bin/rsync"
RSYNC_SUB="v3_0_9_rsync_sub"
# End of Tuning Section
# ---------------------
# Other Global Variables
# ----------------------
dbackL_Version="dbackL 1.26"
logfile=""
lockfile=""
acls="yes"
xattrs="yes"
compatible="no"
multifilesystems="no"
checksum="no"
trapfile_base=".dbackL.inprogress"
trapfile=""
trap cleanup EXIT
# These exclusions apply to all backups
cat <<EOF >> "$rsync_excludes" || exit 1
/nfs
/proc
/run
/sys
/dev
/tmp
/mnt
/media
/var/tmp
.gvfs
/lost+found
EOF
# In addition, these exclusions apply to restores
restore_excludes="$(mktemp -t dbackLXXX)"
cat <<EOF > "$restore_excludes" || exit 1
/crypto_keyfile.bin
/boot
/etc/crypttab
/etc/default/grub
/etc/fstab
/etc/lvm
/etc/openswap.conf
/var/initramfs-tools
/var/shim-signed
/initrd.img
/initrd.img.old
/vmlinuz
/vmlinuz.old
EOF
###############################################################################
function main
# arg [...]
{
local -a array
local arg1
local action
# Extract global options
while [ $# -gt 0 ]
do
arg1="$1"
shift
case "$arg1" in
-no-acls)
acls="no"
;;
-no-xattrs)
xattrs="no"
;;
-compatible)
compatible="yes"
;;
-multi-file-systems)
multifilesystems="yes"
;;
-checksum)
checksum="yes"
;;
-*)
echo "Unrecognized option \"${arg1}\""
dbackL_usage
exit 1
;;
*)
array=("${array[@]}" "${arg1}")
;;
esac
done
# Parse regular arguments next
dispatcher "${array[@]}"
}
###############################################################################
function dispatcher
# action [...]
{
local action
# Parse regular arguments
if [ $# -eq 0 ]
then
action="help"
else
action="$1"
shift
fi
case "$action" in
backup)
dbackL_backup "$@"
;;
restore)
dbackL_restore "$@"
;;
trash)
dbackL_trash "$@"
;;
empty)
dbackL_empty "$@"
;;
copy)
dbackL_copy "$@"
;;
help) :
dbackL_usage
;;
version) :
dbackL_version "$@"
;;
userguide) :
dbackL_userguide "$@"
;;
*) :
dbackL_usage
exit 1
;;
esac
}
# end function dispatcher
###############################################################################
function dbackL_usage
# (<no arguments>)
{
cat <<EOF
Backup and restore methods for Linux, based on rsync.
Usage:
dbackL [-no-acls] [-no-xattrs] [-compatible] command arg arg arg ...
command is one of:
help version userguide backup restore trash empty copy
Type
dbackL [command] help
for help with individual commands.
Options:
-no-acls : suppresses recording of access control lists (ACLs).
-no-xattrs : suppresses recording of extended attributes.
-compatible: suppress some options not available in rsync 2.x
Use the above options only if necessary.
-multi-file-systems : allow backup/restore of multiple file systems.
-checksum : compute checksum to determine if file needs updating.
EOF
}
# End function dbackL_usage
###############################################################################
function dbackL_version
# (<no arguments>)
{
# Take care of help or improper usage
case $# in
0)
;;
1)
dbackL_version_usage
if [ "$1" == "help" ]
then
exit 0
else
exit 1
fi
;;
*)
dbackL_version_usage
exit 1
;;
esac
echo "$dbackL_Version"
echo 'configured to use this verion of rsync:'
"$RSYNC" --version
}
# End function dbackL_version
###############################################################################
function dbackL_version_usage
# ([help])
{
cat <<EOF
Discloses version information for dbackL and rsync.
Usage: dbackL version [help]
EOF
}
# End function dbackL_version_usage
###############################################################################
function dbackL_backup
# (help) or (source destination)
{
local source
local destination
local datestring
local middle
local new
local latestlink
local inprogresslink
local linkdest
local count
local -a array
# Take care of help or improper usage
case $# in
0)
dbackL_backup_usage
exit 1
;;
1)
dbackL_backup_usage
if [ "$1" == "help" ]
then
exit 0
else
exit 1
fi
;;
2)
source="$1"
destination="$2"
;;
*)
dbackL_backup_usage
exit 1
;;
esac
# Need privilege to really do work
su_check
# Locations and files to be used
latestlink="Latest"
inprogresslink="inProgress"
# All work takes place within the destination
if [ ! -e "${destination}" ]
then
echo "ERROR: Destination \"${destination}\" does not exist"
exit 1
fi
cd "${destination}"
if [ \( ! -e "${latestlink}" \) -a \( ! -e "${inprogresslink}" \) ]
then
count=$(ls -a | wc -l)
if [ $count -gt 2 ]
then
echo "ERROR: Destination \"${destination}\" is corrupted"
exit 1
fi
fi
trapfile="${PWD}/${trapfile_base}"
# Three types of backup are possible
# ----------------------------------
if [ -e "${inprogresslink}" ]
then
# Recovery backup
middle="$(readlink "${inprogresslink}")"
if [ $? -ne 0 ]
then
inprogresslink_fail "${destination}" "${inprogresslink}"
fi
new="${middle/.inProgress/}"
datestring="$(basename "${new}")"
logfile="${new}.log"
logfile=$(realpath "$logfile")
touch "${logfile}" || exit 1
chmod a+r "${logfile}" || exit 1
# Start building argument array
array=("${source}" "${middle}" "--stats")
if [ -e "${latestlink}" ]
then
linkdest="$(readlink "${latestlink}")"
link_test "${latestlink}"
if [ $? -ne 0 ]
then
latestlink_fail "${destination}" "${destination}/${latestlink}"
fi
array=("${array[@]}" "--link-dest=../${linkdest}")
fi
lock_on . $$
echo_heading "Resuming backup to ${destination}/${middle}"
dbackL_rsync_backup "${array[@]}"
if [ -e "${trapfile}" ]
then
lock_off
echo_date "Backup not complete"
date_exit 99
fi
mv "${middle}" "${new}" || date_exit 1
rm "${inprogresslink}" || date_exit 1
rm -f Latest || date_exit 1
ln -s "${new}" Latest || date_exit 1
echo_log ""
echo_date \
"Created backup set \"${new}\" in destination \"${destination}\""
lock_off
elif [ -e "${latestlink}" ]
then
# Normal, incremental backup
datestring="$(date '+%Y-%m-%d-%H%M%S')"
middle="${datestring}.inProgress"
new="${datestring}"
logfile="${new}.log"
logfile=$(realpath "$logfile")
touch "${logfile}" || exit 1
chmod a+r "${logfile}" || exit 1
lock_on . $$
echo_heading "Begin delta rsync to ${destination}/${middle}"
mkdir "${middle}" || date_exit 1
link_test "${latestlink}"
if [ $? -ne 0 ]
then
lock_off
latestlink_fail "${destination}" "${destination}/${latestlink}"
fi
linkdest="$(readlink "${latestlink}")"
ln -s "${middle}" "${inprogresslink}" || exit 1
dbackL_rsync_backup \
"${source}" "$middle" \
--stats \
--link-dest="../${linkdest}"
if [ -e "${trapfile}" ]
then
lock_off
echo_date "Backup not complete"
date_exit 99
fi
mv "$middle" "${new}" || date_exit 1
rm "${latestlink}" || date_exit 1
rm -f Latest || date_exit 1
ln -s "${datestring}" Latest || date_exit 1
rm "${inprogresslink}" || date_exit 1
echo_log ""
echo_date \
"Created backup set \"${new}\" in destination \"${destination}\""
lock_off
else
# Initial backup, no previous deltas.
datestring="$(date '+%Y-%m-%d-%H%M%S')"
middle="${datestring}.inProgress"
new="${datestring}"
mkdir -p "${middle}" || date_exit 1
logfile="${new}.log"
logfile=$(realpath "$logfile")
touch "${logfile}" || exit 1
chmod a+r "${logfile}" || exit 1
ln -s "${datestring}.inProgress" "${inprogresslink}" || exit 1
lock_on . $$
echo_heading "Begin initial rsync to ${destination}/${middle}"
dbackL_rsync_backup \
"${source}" "${middle}" \
--stats
if [ -e "${trapfile}" ]
then
lock_off
echo_date "Backup not complete"
date_exit 99
fi
mv "${middle}" "${new}" || date_exit 1
ln -s "${datestring}" Latest
rm "${inprogresslink}" || date_exit 1
echo_log ""
echo_date \
"Created backup set \"${new}\" in destination \"${destination}\""
lock_off
fi
echo_heading "End dbackL"
date_exit 0
}
# End function dbackL_backup
###############################################################################
function dbackL_backup_usage
# (<no arguments>)
{
cat <<EOF
Performs a full backup of a disk directory.
Usage: dbackL <options> backup sourcedir destdir
sourcedir is the directory to backup. To backup a remote host, use the
rsync(1) syntax:
user@host:/dir/...
destdir is the backup media directory. It must exist on the local machine.
An explanation of <options> can be obtained from the following command:
dbackL help
Example:
sudo dbackL remhost:/ /my_usb_drive/snapshots/remhost
EOF
}
# End function dbackL_backup_usage
###############################################################################
function dbackL_restore
# (help) or (source destination)
{
local source
local destination
local folder
local systemfile
local datestring
local source_dir
local oldloc
# Take care of help or improper usage
case $# in
0)
dbackL_restore_usage
exit 1
;;
1)
dbackL_restore_usage
if [ "$1" == "help" ]
then
exit 0
else
exit 1
fi
;;
2)
;;
*)
dbackL_restore_usage
exit 1
;;
esac
source="$1"
destination="$2"
# Need privilege to really do work
su_check
# Sanity check
if [ ! -e "${source}" ]
then
echo "ERROR: \"${source}\" does not exist"
exit 1
fi
# Get true location of backup source. Needed to write logfile and trapfile
oldloc="$PWD"
cd "$(dirname "${source}")" || exit 1
source_dir="$PWD"
cd "$oldloc" || exit 1
datestring="$(date '+%Y-%m-%d-%H%M%S')"
logfile="${source_dir}/dbackL_restore_${datestring}.log"
logfile=$(realpath "$logfile")
touch "$logfile" || exit 1
chmod a+r "${logfile}" || exit 1
trapfile="${source_dir}/${trapfile_base}"
echo_heading "Begin restore from ${source} to ${destination}"
cd "$source" || exit 1
dbackL_rsync_restore \
. "${destination}" \
--stats
if [ -e "${trapfile}" ]
then
echo_date "Restore not complete"
date_exit 99
fi
echo_heading "End dbackL"
date_exit 0
}
# End function dbackL_restore
###############################################################################
function dbackL_restore_usage
# (<no arguments>)
{
cat <<EOF
Performs a full restore of a Linux directory
Usage: dbackL <options> restore sourcedir destdir
sourcedir is the root of the backup media. It will have the form
<whatever>/<date>
No trailing slashes please!
destdir is the volume to restore to. To restore to a remote host, use
rsync(1) syntax:
user@host:/dir/...
An explanation of <options> can be obtained from the following command:
dbackL help
Example:
sudo dbackL restore \\
'my_usb_drive/snapshots/2013-01-17-233228' \\
'root@machine_to_restore:/'
EOF
}
# End function dbackL_restore_usage
###############################################################################
function dbackL_trash
# (help) or (dir dir dir ... )
{
local dir
local destination
local trash
local latestlink
local linkdest
# Take care of help or improper usage
case $# in
0)
dbackL_trash_usage
exit 1
;;
1)
if [ "$1" == "help" ]
then
dbackL_trash_usage
exit 0
fi
;;
esac
# Need privilege to really do work
su_check
for dir in "$@"
do
destination="$(dirname "$dir")"
if [ "x${destination}" == "x" ]
then
destination="."
fi
# Don't remove Latest backup
latestlink="${destination}/Latest"
linkdest="${destination}/$(readlink "${latestlink}")"
if [ "$linkdest" == "$(basename "$dir")" ]
then
echo "WARNING: input"
echo " \"${dir}\""
echo " is Latest in its series. Skipped."
lock_off
continue
fi
lock_on "$destination" $$
# Create the ".Trash" directory if necessary
trash="${destination}/.Trash"
if [ ! -e "$trash" ]
then
echo "Creating trashcan "
echo " \"${trash}\""
mkdir "$trash" || exit 1
fi
# Finally, do the deed.
mv "$dir" "$trash"
if [ $? -ne 0 ]
then
echo "WARNING: input"
echo " \"${dir}\" skipped."
lock_off
continue
fi
if [ -e "${dir}.log" ]
then
mv "${dir}.log" "$trash"
fi
lock_off
done
}
# End function dbackL_trash
###############################################################################
function dbackL_trash_usage
# ([help])
{
cat <<EOF
Sends one or more backup sets to a trashcan.
Usage:
dbackL trash dir dir dir ...
dbackL trash [help]
Example:
sudo dbackL trash \\
'my_usb_drive/snapshots/2013-01-17-233228/'
EOF
}
# End function dbackL_trash_usage
###############################################################################
function dbackL_empty
# (destination) or (help)
{
local dir
local destination
local trash
# Take care of help or improper usage
case $# in
1)
if [ "$1" == "help" ]
then
dbackL_empty_usage
exit 0
fi
;;
*)
dbackL_empty_usage
exit 1
;;
esac
# Need privilege to really do work
su_check
destination="${1}"
if [ "x${destination}" == "x" ]
then
destination="."
fi
cd "${destination}" || exit 1
lock_on . $$
trash="./.Trash"
if [ ! -e "${trash}" ]
then
return
fi
cd "$trash" || exit 1
for file in *
do
if [ "${file}" == '*' ]
then
continue
fi
echo rm -rf "$file"
trap '(exit 1)' 2
rm -rf "$file"
done
lock_off
}
# End function dbackL_empty
###############################################################################
function dbackL_empty_usage
# ([help])
{
cat <<EOF
Empties a dbackL trashcan.
Usage:
dbackL empty destination
dbackL empty [help]
Note: this command will only empty a trashcan associated with the host
computer.
Example:
sudo dbackL empty 'my_usb_drive/snapshots'
EOF
}
# End function dbackL_empty_usage
###############################################################################
function dbackL_copy
# (<arbitrary rsync arguments>) or (help)
{
local -a array
local psource
local pdestination
local limit
local index
local index2
# Take care of help or improper usage
case $# in
0)
dbackL_copy_usage
exit 1
;;
1)
if [ "$1" == "help" ]
then
dbackL_copy_usage
exit 0
else
dbackL_copy_usage
exit 1
fi
;;
esac
# Separate last two arguments
limit=$(($# - 1))
index=1
while [ $index -lt $limit ]
do
array[$index]="$1"
shift
let index++
done
psource="$1"
shift
pdestination="$1"
trapfile="/tmp/${trapfile_base}"
# Call through to appropriate rsync
$RSYNC_SUB "$psource" "$pdestination" "no" "${array[@]}"
if [ -e "${trapfile}" ]
then
lock_off
echo_date "Copy not complete"
date_exit 99
fi
}
# End function dbackL_copy
###############################################################################
function dbackL_copy_usage
# ([help])
{
cat <<EOF
Calls through to rsync, using options that preserve file attributes,
and applying recursion.
Usage:
dbackL <options> copy rsync_arg1 rsync_arg2 ...
dbackL copy [help]
An explanation of <options> can be obtained from the following command:
dbackL help
Unlike other dbackL commands,
- No error checking
- No checking for root privilege (super user)
- No log file
- No --exclude options calling rsync
- No --delete options calling rsync
Example:
dbackL copy -v /tmp/whatever '/media/Scratch Disk/tmp'
EOF
}
# End function dbackL_empty_usage
###############################################################################
function dbackL_rsync_backup
# (source destination [options...])
{
local oldloc
local source
local bare_source
local bare_client
local destination
local linkto
local -a array
source="$1"
shift
destination="$1"
shift
# Split source into host and path
echo "$source" | grep -l '::'
if [ $? -eq 0 ]
then
echo "ERROR: cannot work with rsync daemon (:: notation)"
exit 1
fi
echo "$source" | grep -l ':'
if [ $? -eq 0 ]
then
bare_source="${source##*:}"
bare_client="${source%%:*}:"
else
bare_source="${source}"
bare_client=""
fi
if [ "x${bare_source}" == "x" ]
then
echo "ERROR: cannot handle empty path in backup source \"${source}\""
exit 1
fi
if [[ "${bare_source:0:1}" == '.' ]]
then
echo "ERROR: cannot handle relative path in backup source \"${source}\""
exit 1
fi
# Programming note: switching to symbolic links is probably unnecessary
# here. It makes the {logfile} more informative, but only by a little.
linkto="$(readlink "$destination")"
if [ "x${linkto}" == "x" ]
then
linkto="$destination"
fi
# Begin argument array
array=(no --delete --delete-after --delete-excluded --ignore-errors \
--exclude-from="$rsync_excludes" --force "$@")
# Handle remote versus local rsync
linkto=$(realpath "$linkto")
oldloc="$PWD"
if [ "x${bare_client}" == "x" ]
then
array=("." "${linkto}" "${array[@]}")
cd "$bare_source" || exit 1
else
array=("${bare_client}." "${linkto}" "${array[@]}" \
--rsync-path="cd \"${bare_source}\" ; sudo rsync")
fi
$RSYNC_SUB "${array[@]}" 2>&1 | tee -a "${logfile}"
cd "$oldloc" || exit 1
}
# End function dbackL_rsync_backup
###############################################################################
function dbackL_rsync_restore
# (source destination [options...])
{
local source
local destination
local linkfrom
local oldloc
local bare_client
local -a array
source="$1"
shift
destination="$1"
shift
# Split destination into host and path
echo "$destination" | grep -l '::'
if [ $? -eq 0 ]
then
echo "ERROR: cannot work with rsync daemon (:: notation)"
exit 1
fi
echo "$destination" | grep -l ':'
if [ $? -eq 0 ]
then
bare_destination="${destination##:}"
bare_client="${source%%:*}:"
else
bare_destination="${source}"
bare_client=""
fi
if [ "x${bare_destination}" == "x" ]
then
echo "ERROR: cannot handle empty path in restore destination \"${destination}\""
exit 1
fi
# Programming note: switching to symbolic links is probably unnecessary
# here. It makes the {logfile} more informative, but only by a little.
linkfrom="$(readlink "$source")"
if [ "x${linkfrom}" == "x" ]
then
linkfrom="$source"
fi
# Begin argument array
array=("yes" --delete --delete-after --force --ignore-errors \
--exclude-from="$rsync_excludes" --exclude-from="$restore_excludes" \
"$@")
# Handle remote versus local rsync
if [ "x${bare_client}" == "x" ]
then
array=("${linkfrom}" "${destination}" "${array[@]}")
else
array=("${linkfrom}" "${destination}" "${array[@]}" \
--rsync-path="sudo rsync")
fi
# Programming note: when the {source} is a dbackL backup, the
# --exclude-from used here has no practical effect. However, if the
# {source} is (for example) some bootable volume, then these exclusions
# improve reliability.
$RSYNC_SUB "${array[@]}" 2>&1 | tee -a "${logfile}"
}
# End function dbackL_rsync_restore
###############################################################################
function v3_0_9_rsync_sub
# (source destination strict [options ...])
{
# Programming note: this function uses syntax of rsync version 3.0.9.
# The syntax has been stable for several releases.
local source
local destination
local strict
local status
local -a array
source="$1"
shift
destination="$1"
shift
strict="$1"
shift
# Build argument array
array=( -z -rlptgo --numeric-ids -S -H -D)
if [ "$acls" == "yes" ]