Removes "RPC not enabled" error message when no backend is needed

When no service needing a RPC backend is activated, no error message
should appear if a RPC backend is not installed. A simple check is
done on the services installation files to see which services need to
initialize a RPC backend at some point; if none of these services
are in ENABLED_SERVICES then the error message is skipped.

Change-Id: I4e47e0c675c74775b4ea53a00848ac1d777f0125
Fixes: bug #1167338
diff --git a/lib/rpc_backend b/lib/rpc_backend
index 1edea15..3c485e4 100644
--- a/lib/rpc_backend
+++ b/lib/rpc_backend
@@ -21,9 +21,22 @@
 # Functions
 # ---------
 
+
 # Make sure we only have one rpc backend enabled.
 # Also check the specified rpc backend is available on your platform.
 function check_rpc_backend() {
+    local rpc_needed=1
+    # We rely on the fact that filenames in lib/* match the service names
+    # that can be passed as arguments to is_service_enabled.
+    # We check for a call to iniset_rpc_backend in these files, meaning
+    # the service needs a backend.
+    rpc_candidates=$(grep -rl iniset_rpc_backend . | awk -F/ '{print $NF}')
+    for c in ${rpc_candidates}; do
+        if is_service_enabled $c; then
+            rpc_needed=0
+            break
+        fi
+    done
     local rpc_backend_cnt=0
     for svc in qpid zeromq rabbit; do
         is_service_enabled $svc &&
@@ -33,7 +46,7 @@
         echo "ERROR: only one rpc backend may be enabled,"
         echo "       set only one of 'rabbit', 'qpid', 'zeromq'"
         echo "       via ENABLED_SERVICES."
-    elif [ "$rpc_backend_cnt" == 0 ]; then
+    elif [ "$rpc_backend_cnt" == 0 ] && [ "$rpc_needed" == 0 ]; then
         echo "ERROR: at least one rpc backend must be enabled,"
         echo "       set one of 'rabbit', 'qpid', 'zeromq'"
         echo "       via ENABLED_SERVICES."