@@ -10,12 +10,12 @@ set -e
10
10
# shellcheck source=share/github-backup-utils/ghe-backup-config
11
11
. " $( dirname " ${BASH_SOURCE[0]} " ) /ghe-backup-config"
12
12
13
- bm_start " $( basename $0 ) "
13
+ bm_start " $( basename " ${0} " ) "
14
14
15
15
# Set up remote host and root backup snapshot directory based on config
16
- port=$( ssh_port_part " $GHE_HOSTNAME " )
17
- host=$( ssh_host_part " $GHE_HOSTNAME " )
18
- backup_dir=" $GHE_SNAPSHOT_DIR /minio"
16
+ port=" $( ssh_port_part " ${ GHE_HOSTNAME} " ) "
17
+ host=" $( ssh_host_part " ${ GHE_HOSTNAME} " ) "
18
+ backup_dir=" ${ GHE_SNAPSHOT_DIR} /minio"
19
19
20
20
# Verify rsync is available.
21
21
if ! command -v rsync 1> /dev/null 2>&1 ; then
@@ -24,26 +24,33 @@ if ! command -v rsync 1> /dev/null 2>&1; then
24
24
fi
25
25
26
26
# Perform a host-check and establish GHE_REMOTE_XXX variables.
27
- ghe_remote_version_required " $host "
27
+ ghe_remote_version_required " ${ host} "
28
28
29
29
# Make sure root backup dir exists if this is the first run
30
- mkdir -p " $backup_dir "
30
+ mkdir -p " ${ backup_dir} "
31
31
32
32
# If we have a previous increment and it is not empty, avoid transferring existing files via rsync's
33
33
# --link-dest support. This also decreases physical space usage considerably.
34
- if [ -d " $GHE_DATA_DIR /current/minio" ] && [ " $( ls -A $GHE_DATA_DIR /current/minio) " ]; then
35
- link_dest=" --link-dest=$GHE_DATA_DIR /current/minio"
34
+ # Hilariously, this HAS to stay unquoted when you call `rsync` further
35
+ # down because when the shell interpolates this out, `rsync` will throw
36
+ # an absolute fit if this variable is quoted. Surprise!
37
+ if [[ -d " ${GHE_DATA_DIR} /current/minio" ]] &&
38
+ [[ " $( ls -A " ${GHE_DATA_DIR} /current/minio" ) " ]]; then
39
+ link_dest=" --link-dest=${GHE_DATA_DIR} /current/minio"
36
40
fi
37
41
38
42
# Transfer all minio data from the user data directory using rsync.
39
- ghe_verbose " * Transferring minio files from $host ..."
43
+ ghe_verbose " * Transferring minio files from ${ host} ..."
40
44
41
- ghe-rsync -avz \
42
- -e " ghe-ssh -p $port " \
45
+ ghe-rsync \
46
+ --archive \
47
+ --verbose \
48
+ --compress \
49
+ --rsh=" ghe-ssh -p ${port} " \
43
50
--rsync-path=' sudo -u minio rsync' \
44
- --exclude " .minio.sys" \
45
- $link_dest \
46
- " $host : $ GHE_REMOTE_DATA_USER_DIR /minio/" \
47
- " $GHE_SNAPSHOT_DIR /minio" 1>&3
51
+ --exclude= " .minio.sys" \
52
+ ${ link_dest} \
53
+ " ${ host} : ${ GHE_REMOTE_DATA_USER_DIR} /minio/" \
54
+ " ${ GHE_SNAPSHOT_DIR} /minio" 1>&3
48
55
49
- bm_end " $( basename $0 ) "
56
+ bm_end " $( basename " ${0} " ) "
0 commit comments