|
9 | 9 | # Bring in the backup configuration
|
10 | 10 | . $( dirname "${BASH_SOURCE[0]}" )/ghe-backup-config
|
11 | 11 |
|
12 |
| -# Split host:port into parts |
13 |
| -port=$(ssh_port_part "$GHE_HOSTNAME") |
14 |
| -host=$(ssh_host_part "$GHE_HOSTNAME") |
15 |
| - |
16 |
| -# Add user / -l option |
17 |
| -user="${host%@*}" |
18 |
| -[ "$user" = "$host" ] && user="admin" |
19 |
| - |
20 |
| -backup_dir="$GHE_SNAPSHOT_DIR/git-hooks" |
21 |
| - |
22 |
| -# Location of last good backup for rsync --link-dest |
23 |
| -backup_current="$GHE_DATA_DIR/current/git-hooks" |
24 |
| - |
25 | 12 | # Verify rsync is available.
|
26 | 13 | if ! rsync --version 1>/dev/null 2>&1; then
|
27 | 14 | echo "Error: rsync not found." 1>&2
|
28 | 15 | exit 1
|
29 | 16 | fi
|
30 | 17 |
|
| 18 | +bm_start "$(basename $0)" |
| 19 | + |
| 20 | +backup_dir="$GHE_SNAPSHOT_DIR/git-hooks" |
| 21 | +# Location of last good backup for rsync --link-dest |
| 22 | +backup_current="$GHE_DATA_DIR/current/git-hooks" |
| 23 | + |
31 | 24 | # Perform a host-check and establish GHE_REMOTE_XXX variables.
|
32 | 25 | ghe_remote_version_required "$host"
|
33 | 26 |
|
34 |
| -# Generate SSH config for forwarding |
| 27 | +# Split host:port into parts |
| 28 | +port=$(ssh_port_part "$GHE_HOSTNAME") |
| 29 | +host=$(ssh_host_part "$GHE_HOSTNAME") |
35 | 30 |
|
| 31 | +# Add user / -l option |
| 32 | +user="${host%@*}" |
| 33 | +[ "$user" = "$host" ] && user="admin" |
| 34 | + |
| 35 | +# Generate SSH config for forwarding |
36 | 36 | config=""
|
37 | 37 |
|
38 | 38 | # git server hostnames
|
@@ -102,6 +102,16 @@ rsync_git_hooks_data () {
|
102 | 102 | }
|
103 | 103 |
|
104 | 104 | hostname=$(echo $hostnames | awk '{ print $1; }')
|
105 |
| -ghe-ssh -F $config_file "$hostname:122" -- "sudo -u git [ -d '$GHE_REMOTE_DATA_USER_DIR/git-hooks' ]" || exit 0 |
106 |
| -rsync_git_hooks_data $hostname:122 environments/tarballs |
107 |
| -rsync_git_hooks_data $hostname:122 repos |
| 105 | +if ghe-ssh -F $config_file "$hostname:122" -- "sudo -u git [ -d '$GHE_REMOTE_DATA_USER_DIR/git-hooks/environments/tarballs' ]"; then |
| 106 | + rsync_git_hooks_data $hostname:122 environments/tarballs |
| 107 | +else |
| 108 | + ghe_verbose "git-hooks environment tarballs not found. Skipping ..." |
| 109 | +fi |
| 110 | + |
| 111 | +if ghe-ssh -F $config_file "$hostname:122" -- "sudo -u git [ -d '$GHE_REMOTE_DATA_USER_DIR/git-hooks/repos' ]"; then |
| 112 | + rsync_git_hooks_data $hostname:122 repos |
| 113 | +else |
| 114 | + ghe_verbose "git-hooks repositories not found. Skipping ..." |
| 115 | +fi |
| 116 | + |
| 117 | +bm_end "$(basename $0)" |
0 commit comments