servod.conf: add support for model

This adds an optional config MODEL= to servod.conf
Having this override allows differentiated servo
config based on model. This is cached, and passed
through as the --model arg to servod.

BUG=chromium:886955
TEST=startup works with and without arg. If present it's passed to servod.

Change-Id: I565382a91d25809ac70cd65f2ad6c132665e878b
Reviewed-on: https://chromium-review.googlesource.com/1288997
Commit-Ready: Nick Sanders <nsanders@chromium.org>
Tested-by: Nick Sanders <nsanders@chromium.org>
Reviewed-by: Justin TerAvest <teravest@chromium.org>
diff --git a/chromeos/servod.conf b/chromeos/servod.conf
index 03e8eb6..21e9785 100644
--- a/chromeos/servod.conf
+++ b/chromeos/servod.conf
@@ -22,12 +22,14 @@
 
 env PORT=9999
 env BOARD=
+env MODEL=
 env SERIAL=
 env CONFIG=
 env CONFIG_FILE_DIR="/var/lib/servod"
 
 import PORT
 import BOARD
+import MODEL
 import SERIAL
 import CONFIG
 
@@ -46,6 +48,7 @@
 
   # We'll want to update the config file with all the args passed in.
   update_config $CONFIG_FILE BOARD $BOARD
+  update_config $CONFIG_FILE MODEL $MODEL
   update_config $CONFIG_FILE SERIAL $SERIAL
   update_config $CONFIG_FILE CONFIG $CONFIG
 
@@ -104,6 +107,12 @@
   BOARD_FLAG="--board ${BOARD}"
   PORT_FLAG="--port ${PORT}"
 
+  if [ ! -z "$MODEL" ]; then
+    MODEL_FLAG="--model ${MODEL}"
+  else
+    MODEL_FLAG=""
+  fi
+
   if [ "$DEBUG" = "1" ]; then
     DEBUG_FLAG="--debug"
   else
@@ -132,7 +141,7 @@
     fi
   fi
 
-  exec servod --host 0.0.0.0 $BOARD_FLAG $SERIAL_FLAG $PORT_FLAG $DEBUG_FLAG $CONFIG_FLAG
+  exec servod --host 0.0.0.0 $BOARD_FLAG $MODEL_FLAG $SERIAL_FLAG $PORT_FLAG $DEBUG_FLAG $CONFIG_FLAG
 end script
 
 post-stop script