File tree Expand file tree Collapse file tree 2 files changed +39
-20
lines changed Expand file tree Collapse file tree 2 files changed +39
-20
lines changed Original file line number Diff line number Diff line change @@ -91,28 +91,9 @@ if [ "$GHE_BACKUP_STRATEGY" = "tarball" ]; then
91
91
fi
92
92
93
93
echo " Backing up GitHub settings ..."
94
- ghe-ssh " $host " -- ' ghe-export- settings' > settings.json ||
94
+ ghe-backup- settings ||
95
95
failures=" $failures settings"
96
96
97
- # transfer license file
98
- ghe-ssh " $host " -- " cat '$GHE_REMOTE_LICENSE_FILE '" > enterprise.ghl ||
99
- failures=" $failures license"
100
-
101
- # transfer enterprise manage password hash if running against a v2.x instance.
102
- if [ " $GHE_VERSION_MAJOR " -ge 2 ]; then
103
- manage_password_file=" $GHE_REMOTE_DATA_USER_DIR /common/manage-password"
104
- if echo " sudo cat '$manage_password_file ' 2>/dev/null || true" |
105
- ghe-ssh " $host " -- /bin/sh > manage-password+
106
- then
107
- if [ -n " $( cat manage-password+) " ]; then
108
- mv manage-password+ manage-password
109
- fi
110
- else
111
- unlink manage-password+
112
- failures=" $failures manage-password"
113
- fi
114
- fi
115
-
116
97
echo " Backing up SSH authorized keys ..."
117
98
ghe-ssh " $host " -- ' ghe-export-authorized-keys' > authorized-keys.json ||
118
99
failures=" $failures authorized-keys"
Original file line number Diff line number Diff line change
1
+ #! /bin/sh
2
+ # / Usage: ghe-backup-settings
3
+ # / Restore settings from a snapshot to the given <host>.
4
+ set -e
5
+
6
+ # Bring in the backup configuration
7
+ cd $( dirname " $0 " ) /..
8
+ . libexec/ghe-backup-config
9
+
10
+ # Perform a host-check and establish GHE_REMOTE_XXX variables.
11
+ ghe_remote_version_required " $host "
12
+
13
+ # Grab the host
14
+ host=" $GHE_HOSTNAME "
15
+
16
+ # Create the snapshot directory if needed and change into it.
17
+ mkdir -p " $GHE_SNAPSHOT_DIR "
18
+ cd " $GHE_SNAPSHOT_DIR "
19
+
20
+ echo " * Transferring settings data ..." 1>&3
21
+ ghe-ssh " $host " -- ' ghe-export-settings' > settings.json
22
+
23
+ echo " * Transferring license data ..." 1>&3
24
+ ghe-ssh " $host " -- " cat '$GHE_REMOTE_LICENSE_FILE '" > enterprise.ghl
25
+
26
+ if [ " $GHE_VERSION_MAJOR " -ge 2 ]; then
27
+ echo " * Transferring management console password ..." 1>&3
28
+ manage_password_file=" $GHE_REMOTE_DATA_USER_DIR /common/manage-password"
29
+ if echo " sudo cat '$manage_password_file ' 2>/dev/null || true" |
30
+ ghe-ssh " $host " -- /bin/sh > manage-password+
31
+ then
32
+ if [ -n " $( cat manage-password+) " ]; then
33
+ mv manage-password+ manage-password
34
+ fi
35
+ else
36
+ unlink manage-password+
37
+ fi
38
+ fi
You can’t perform that action at this time.
0 commit comments