Skip to content

Commit b4b0007

Browse files
Fix a few bugs in the rsync function
Make the switch to use files-from or -z option based on file extension.
1 parent e7fdba4 commit b4b0007

File tree

1 file changed

+25
-11
lines changed

1 file changed

+25
-11
lines changed

share/github-backup-utils/ghe-backup-repositories-cluster-ng

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -147,17 +147,31 @@ fi
147147
rsync_repository_data () {
148148
port=$(ssh_port_part "$1")
149149
host=$(ssh_host_part "$1")
150-
file_list="$2"
151-
shift
152-
shift
153-
ghe-rsync -avr \
154-
-e "ssh -q $opts -p $port -F $config_file -l $user" \
155-
$link_dest "$@" \
156-
--rsync-path='sudo -u git rsync' \
157-
--include-from=- --exclude=\* \
158-
--files-from="$file_list" \
159-
"$host:$GHE_REMOTE_DATA_USER_DIR/repositories/" \
160-
"$backup_dir" 1>&3
150+
151+
#check if we are syncing from a given file list
152+
if [[ "$2" == *".rsync" ]]; then
153+
files_list="$2"
154+
shift
155+
shift
156+
ghe-rsync -avr \
157+
-e "ssh -q $opts -p $port -F $config_file -l $user" \
158+
$link_dest "$@" \
159+
--rsync-path='sudo -u git rsync' \
160+
--include-from=- --exclude=\* \
161+
--files-from="$files_list" \
162+
"$host:$GHE_REMOTE_DATA_USER_DIR/repositories/" \
163+
"$backup_dir" 1>&3
164+
else
165+
shift
166+
ghe-rsync -avr \
167+
-e "ssh -q $opts -p $port -F $config_file -l $user" \
168+
$link_dest "$@" \
169+
--rsync-path='sudo -u git rsync' \
170+
--include-from=- --exclude=\* \
171+
"$host:$GHE_REMOTE_DATA_USER_DIR/repositories/" \
172+
"$backup_dir" 1>&3
173+
fi
174+
161175
}
162176

163177
sync_data (){

0 commit comments

Comments
 (0)