Skip to content

Commit b479902

Browse files
committed
Work around issue importing settings with invalid storage mode
1 parent f205f40 commit b479902

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,15 @@ ghe_remote_version_required "$GHE_HOSTNAME"
2424
GHE_RESTORE_SNAPSHOT_PATH="$GHE_DATA_DIR/$GHE_RESTORE_SNAPSHOT"
2525

2626
echo "Restoring settings ..."
27-
ghe-ssh "$GHE_HOSTNAME" -- 'ghe-import-settings' < "$GHE_RESTORE_SNAPSHOT_PATH/settings.json" 1>&3
27+
if [ "$GHE_VERSION_MAJOR" -ge 2 ]; then
28+
# work around issue importing settings with bad storage mode values
29+
cat "$GHE_RESTORE_SNAPSHOT_PATH/settings.json" |
30+
sed 's/"storage_mode": "device"/"storage_mode": "rootfs"/' |
31+
ghe-ssh "$GHE_HOSTNAME" -- 'ghe-import-settings' 1>&3
32+
else
33+
cat "$GHE_RESTORE_SNAPSHOT_PATH/settings.json" |
34+
ghe-ssh "$GHE_HOSTNAME" -- 'ghe-import-settings' 1>&3
35+
fi
2836

2937
# Bail out if we're restoring against a pre-2.x appliance. Everything below is
3038
# supported by v2.0 appliances only.

0 commit comments

Comments
 (0)