Skip to content

Commit 5c791fc

Browse files
committed
ghe-service-ensure-* commands are >= 2.x only
I'd like to move these directly into the import-XXX commands on the VM instead of having to maintain all these conditionals.
1 parent e256619 commit 5c791fc

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

bin/ghe-restore

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,18 +78,24 @@ echo "Restoring GitHub Pages ..."
7878
ghe-restore-pages-${GHE_BACKUP_STRATEGY} "$host" 1>&3
7979

8080
echo "Restoring MySQL database ..."
81-
ghe-ssh "$host" -- 'sudo ghe-service-ensure-mysql' 1>&3
81+
if [ "$GHE_VERSION_MAJOR" -gt 1 ]; then
82+
ghe-ssh "$host" -- 'sudo ghe-service-ensure-mysql' 1>&3
83+
fi
8284
gzip -dc "$GHE_RESTORE_SNAPSHOT_PATH/mysql.sql.gz" | ghe-ssh "$host" -- 'ghe-import-mysql' 1>&3
8385

8486
echo "Restoring Redis database ..."
85-
ghe-ssh "$host" -- 'sudo ghe-service-ensure-redis' 1>&3
87+
if [ "$GHE_VERSION_MAJOR" -gt 1 ]; then
88+
ghe-ssh "$host" -- 'sudo ghe-service-ensure-redis' 1>&3
89+
fi
8690
ghe-ssh "$host" -- 'ghe-import-redis' < "$GHE_RESTORE_SNAPSHOT_PATH/redis.rdb" 1>&3
8791

8892
echo "Restoring SSH authorized keys ..."
8993
ghe-ssh "$host" -- 'ghe-import-authorized-keys' < "$GHE_RESTORE_SNAPSHOT_PATH/authorized-keys.json" 1>&3
9094

9195
echo "Restoring Elasticsearch indices ..."
92-
ghe-ssh "$host" -- 'sudo ghe-service-ensure-elasticsearch' 1>&3
96+
if [ "$GHE_VERSION_MAJOR" -gt 1 ]; then
97+
ghe-ssh "$host" -- 'sudo ghe-service-ensure-elasticsearch' 1>&3
98+
fi
9399
ghe-restore-es-${GHE_BACKUP_STRATEGY} "$host" 1>&3
94100

95101
echo "Restoring SSH host keys ..."

0 commit comments

Comments
 (0)