Skip to content

Commit 094d796

Browse files
authored
Merge pull request #275 from github/snh/userdata-1110
Fix pages backups and restores in GitHub Enterprise 11.10
2 parents d36a2b5 + 76df072 commit 094d796

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

share/github-backup-utils/ghe-backup-userdata

+5-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,11 @@ ghe_remote_version_required "$host"
2525

2626
# Verify that the user data directory exists. Bail out if not, which may be due
2727
# to an older version of GHE or no data has been added to this directory yet.
28-
ghe-ssh "$host" -- "sudo -u git [ -d '$GHE_REMOTE_DATA_USER_DIR/$dirname' ]" || exit 0
28+
if [ "$GHE_VERSION_MAJOR" -ge 2 ]; then
29+
ghe-ssh "$host" -- "sudo -u git [ -d '$GHE_REMOTE_DATA_USER_DIR/$dirname' ]" || exit 0
30+
else
31+
ghe-ssh "$host" -- "[ -d '$GHE_REMOTE_DATA_USER_DIR/$dirname' ]" || exit 0
32+
fi
2933

3034
# If we have a previous increment and it is not empty, avoid transferring existing files via rsync's
3135
# --link-dest support. This also decreases physical space usage considerably.

share/github-backup-utils/ghe-restore-userdata

+6-1
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,14 @@ ghe_remote_version_required "$GHE_HOSTNAME"
3333
# Transfer data from the latest snapshot to the GitHub instance in a single
3434
# rsync invocation.
3535
if [ -d "$GHE_DATA_DIR/$GHE_RESTORE_SNAPSHOT/$dirname" ]; then
36+
# Create the remote user data directory
37+
if [ "$GHE_VERSION_MAJOR" -ge 2 ]; then
38+
ghe-ssh "$GHE_HOSTNAME" -- "sudo -u git mkdir -p $GHE_REMOTE_DATA_USER_DIR/$dirname"
39+
fi
40+
3641
ghe-rsync -avz --delete \
3742
-e "ghe-ssh -p $(ssh_port_part "$GHE_HOSTNAME")" \
38-
--rsync-path="sudo -u git mkdir -p $GHE_REMOTE_DATA_USER_DIR/$dirname && sudo -u git rsync" \
43+
--rsync-path="sudo -u git rsync" \
3944
"$GHE_DATA_DIR/$GHE_RESTORE_SNAPSHOT/$dirname/" \
4045
"$(ssh_host_part "$GHE_HOSTNAME"):$GHE_REMOTE_DATA_USER_DIR/$dirname" 1>&3
4146
fi

0 commit comments

Comments
 (0)