Skip to content

Commit

Permalink
Merge pull request #275 from github/snh/userdata-1110
Browse files Browse the repository at this point in the history
Fix pages backups and restores in GitHub Enterprise 11.10
  • Loading branch information
snh authored Dec 13, 2016
2 parents d36a2b5 + 76df072 commit 094d796
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
6 changes: 5 additions & 1 deletion share/github-backup-utils/ghe-backup-userdata
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ ghe_remote_version_required "$host"

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

# If we have a previous increment and it is not empty, avoid transferring existing files via rsync's
# --link-dest support. This also decreases physical space usage considerably.
Expand Down
7 changes: 6 additions & 1 deletion share/github-backup-utils/ghe-restore-userdata
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,14 @@ ghe_remote_version_required "$GHE_HOSTNAME"
# Transfer data from the latest snapshot to the GitHub instance in a single
# rsync invocation.
if [ -d "$GHE_DATA_DIR/$GHE_RESTORE_SNAPSHOT/$dirname" ]; then
# Create the remote user data directory
if [ "$GHE_VERSION_MAJOR" -ge 2 ]; then
ghe-ssh "$GHE_HOSTNAME" -- "sudo -u git mkdir -p $GHE_REMOTE_DATA_USER_DIR/$dirname"
fi

ghe-rsync -avz --delete \
-e "ghe-ssh -p $(ssh_port_part "$GHE_HOSTNAME")" \
--rsync-path="sudo -u git mkdir -p $GHE_REMOTE_DATA_USER_DIR/$dirname && sudo -u git rsync" \
--rsync-path="sudo -u git rsync" \
"$GHE_DATA_DIR/$GHE_RESTORE_SNAPSHOT/$dirname/" \
"$(ssh_host_part "$GHE_HOSTNAME"):$GHE_REMOTE_DATA_USER_DIR/$dirname" 1>&3
fi
Expand Down

0 comments on commit 094d796

Please sign in to comment.