Support `--run-image` option for launcher.

Support --run-image option for launcher.

From c786ffcdfb5e85a0a811991040c2f35703a8a856 Mon Sep 17 00:00:00 2001
From: Guo Xiang Tan <tgx_world@hotmail.com>
Date: Mon, 19 Nov 2018 16:31:16 +0800
Subject: [PATCH] Support `--run-image` option for launcher.


diff --git a/launcher b/launcher
index 1383ec8..4c16489 100755
--- a/launcher
+++ b/launcher
@@ -18,12 +18,14 @@ usage () {
   echo "    --skip-prereqs             Don't check launcher prerequisites"
   echo "    --docker-args              Extra arguments to pass when running docker"
   echo "    --skip-mac-address         Don't assign a mac address"
+  echo "    --run-image                Override the image used for running the container"
   exit 1
 }
 
 command=$1
 config=$2
 user_args=""
+user_run_image=""
 
 if [[ $command == "run" ]]; then
   run_command=$3
@@ -44,6 +46,10 @@ while [ ${#} -gt 0 ]; do
     user_args="$2"
     shift
     ;;
+  --run-image)
+    user_run_image="$2"
+    shift
+    ;;
   esac
 
   shift 1
@@ -471,7 +477,9 @@ set_run_image() {
   run_image=`cat $config_file | $docker_path run $user_args --rm -i -a stdin -a stdout $image ruby -e \
     "require 'yaml'; puts YAML.load(STDIN.readlines.join)['run_image']"`
 
-  if [ -z "$run_image" ]; then
+  if [ -n "$user_run_image" ]; then
+    run_image=$user_run_image
+  elif [ -z "$run_image" ]; then
     run_image="$local_discourse/$config"
   fi
 }

GitHub

2 Likes