Skip to content

Commit 81737a1

Browse files
authored
Merge pull request #237 from github/cat-broken-pipe
Updated instances of 'cat' to redirections
2 parents 1fb5e71 + 1d3688f commit 81737a1

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,14 +129,14 @@ bm_end "$(basename $0) - Generating routes"
129129

130130
bm_start "$(basename $0) - Fetching routes"
131131
ghe-ssh "$GHE_HOSTNAME" -- gzip -c $remote_routes_list | gzip -d > $routes_list
132-
cat $routes_list | ghe_debug
132+
< $routes_list ghe_debug
133133
bm_end "$(basename $0) - Fetching routes"
134134

135135
bm_start "$(basename $0) - Processing routes"
136136
if [ "$GHE_BACKUP_STRATEGY" != "cluster" ]; then
137137
server=$host
138138
fi
139-
cat $routes_list | awk -v tempdir="$tempdir" -v server="$server" '{ for(i=2;i<=NF;i++){ server != "" ? host=server : host=$i; print $1 > (tempdir"/"host".rsync") }}'
139+
< $routes_list awk -v tempdir="$tempdir" -v server="$server" '{ for(i=2;i<=NF;i++){ server != "" ? host=server : host=$i; print $1 > (tempdir"/"host".rsync") }}'
140140
ghe_debug "\n$(find "$tempdir" -maxdepth 1 -name '*.rsync')"
141141
bm_end "$(basename $0) - Processing routes"
142142

@@ -324,7 +324,7 @@ bm_start "$(basename $0) - Repo sync"
324324
for file_list in $tempdir/*.rsync; do
325325
hostname=$(basename $file_list .rsync)
326326

327-
repo_num=$(cat $file_list | wc -l)
327+
repo_num=$(< $file_list wc -l)
328328
ghe_verbose "* Transferring $repo_num repositories from $hostname"
329329

330330
sync_data $hostname $file_list &
@@ -366,7 +366,9 @@ bm_end "$(basename $0) - Special Data Directories Sync"
366366

367367
if [ -z "$GHE_SKIP_ROUTE_VERIFICATION" ]; then
368368
bm_start "$(basename $0) - Verifying Routes"
369-
cat $tempdir/*.rsync | uniq | sort | uniq > $tempdir/source_routes
369+
for file_lst in $tempdir/*.rsync; do
370+
< $file_lst sort | uniq
371+
done |sort|uniq > $tempdir/source_routes
370372
(cd $backup_dir/ && find * -mindepth 5 -maxdepth 6 -type d -name \*.git | fix_paths_for_ghe_version | uniq | sort | uniq) > $tempdir/destination_routes
371373

372374
git --no-pager diff --unified=0 --no-prefix -- $tempdir/source_routes $tempdir/destination_routes || echo "Warning: One or more repository networks and/or gists were not found on the source appliance. Please contact GitHub Enterprise Support for assistance."

0 commit comments

Comments
 (0)