Support `--run-image` option for launcher.
authorGuo Xiang Tan <tgx_world@hotmail.com>
Mon, 19 Nov 2018 08:31:16 +0000 (16:31 +0800)
committerGuo Xiang Tan <tgx_world@hotmail.com>
Mon, 19 Nov 2018 08:34:30 +0000 (16:34 +0800)
launcher

index 1383ec85561f030b7ff7a5b4c9e410d769dc254a..4c1648970ea84b4ae586716a664d39f81efdb71e 100755 (executable)
--- 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
 }