Skip to content

Commit 45005d5

Browse files
committed
Only create the directory on 2 and above
1 parent 1843d04 commit 45005d5

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,17 @@ ghe_remote_version_required "$GHE_HOSTNAME"
3030
# us run this script directly.
3131
: ${GHE_RESTORE_SNAPSHOT:=current}
3232

33+
# Create the remote user data directory
34+
if [ "$GHE_VERSION_MAJOR" -ge 2 ]; then
35+
ghe-ssh "$host" -- "sudo -u git mkdir -p $GHE_REMOTE_DATA_USER_DIR/$dirname"
36+
fi
37+
3338
# Transfer data from the latest snapshot to the GitHub instance in a single
3439
# rsync invocation.
3540
if [ -d "$GHE_DATA_DIR/$GHE_RESTORE_SNAPSHOT/$dirname" ]; then
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)