Skip to content

Commit 63b4e29

Browse files
committed
Add GHE_RSYNC_COMPRESSION_ENABLED option
1 parent a8e8e9e commit 63b4e29

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

backup.config-example

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ GHE_NUM_SNAPSHOTS=10
5858
#
5959
#GHE_EXTRA_RSYNC_OPTS=""
6060

61+
# If set to 'yes', rsync will be set to use compression during backups and restores transfers. Defaults to 'no'.
62+
#
63+
#GHE_RSYNC_COMPRESSION_ENABLED=yes
64+
6165
# If enabled and set to 'no', rsync warning message during backups will be suppressed.
6266
#RSYNC_WARNING=no
6367

share/github-backup-utils/ghe-rsync

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,13 @@ if [ "$($( dirname "${BASH_SOURCE[0]}" )/ghe-rsync-feature-checker --trust-sende
2929
parameters=("--trust-sender" "${parameters[@]}")
3030
fi
3131

32+
# This adds `--compress` to the parameters if supported by the current version of rsync
33+
# shellcheck source=share/github-backup-utils/ghe-rsync-feature-checker
34+
# shellcheck disable=SC2046
35+
if [ "$($( dirname "${BASH_SOURCE[0]}" )/ghe-rsync-feature-checker --compress)" == "true" ] && [ "$GHE_RSYNC_COMPRESSION_ENABLED" = "yes" ]; then
36+
parameters+=("--compress")
37+
fi
38+
3239
# This loads the $GHE_EXTRA_RSYNC_OPTS from the config file if available then adds them
3340
# to the parameters and skip adding if already present in the parameters
3441
# shellcheck source=share/github-backup-utils/ghe-rsync-feature-checker
@@ -41,7 +48,7 @@ if [ -n "$GHE_EXTRA_RSYNC_OPTS" ]; then
4148
done
4249
fi
4350

44-
51+
echo "Running rsync with parameters: ${parameters[*]}"
4552
ignore_out='^(file has vanished: |rsync warning: some files vanished before they could be transferred)'
4653
rsync_version_check=$(rsync --version | grep -E "version 3.[0-9]*.[0-9]*")
4754
if [ -n "$rsync_version_check" ]; then

0 commit comments

Comments
 (0)