allow rebuild of single service

Change-Id: Ia468f81ffe22e9628adb37b3fddbdbe3fb3c8087
diff --git a/common/rebuild.sh b/common/rebuild.sh
index dbca3c8..0033c9a 100755
--- a/common/rebuild.sh
+++ b/common/rebuild.sh
@@ -1,7 +1,7 @@
 #! /bin/bash
 
 display_usage() { 
-    echo -e "\nUsage:\n$0 [xos-listen-port] \n" 
+    echo -e "\nUsage:\n$0 [xos-listen-port] [service-name]\n" 
 } 
 
 if [  $# -lt 1 ] 
@@ -10,12 +10,21 @@
     exit 1
 fi 
 
+if [ $# -eq 2 ]; then
+echo "Sending rebuild request to XOS for service $2"
+STATUS=`curl -X POST -F "service=$2" 0.0.0.0:$1/api/utility/onboarding/xos/rebuild/ 2> /dev/null`
+if [[ "$STATUS" != "true" ]]; then
+    echo "Rebuild request failed"
+    exit -1
+fi
+else
 echo "Sending rebuild request to XOS"
 STATUS=`curl -X POST 0.0.0.0:$1/api/utility/onboarding/xos/rebuild/ 2> /dev/null`
 if [[ "$STATUS" != "true" ]]; then
     echo "Rebuild request failed"
     exit -1
 fi
+fi
 
 echo "Rebuild request accepted"