Merge "Add SRIOV and QAT device plugin deploy components" into dev/icn-v0.1.0
[icn.git] / tools / cloud-configs.sh
diff --git a/tools/cloud-configs.sh b/tools/cloud-configs.sh
new file mode 100644 (file)
index 0000000..98ffcd4
--- /dev/null
@@ -0,0 +1,34 @@
+!/bin/bash
+
+# This script is called by cloud-init on worker nodes
+# What does this script do:
+# 1. Copy qat driver tarball and sriov tarball from share folder
+# 2. Extract the tarball and run install.sh to install the drivers
+
+# Need a variable named $SHARE_FOLDER to indicate the share folder location
+
+MODULES_LIST="qat_driver sriov_driver"
+VER="0.1"
+SHARE_FOLDER=${SHARE_FOLDER:-"package"}
+
+for module in $MODULES_LIST; do
+    filename=$module-$VER.tar.gz
+    if [ ! -e $filename ]; then
+        if [ ! -e $SHARE_FOLDER/$filename ]; then
+           echo "Cannot install module $module ..."
+           continue
+       else
+            cp $SHARE_FOLDER/$filename .
+        fi
+    fi
+
+    tar xvzf $filename
+    if [ -d $module ]; then 
+        echo "Installing module $module ..."
+       pushd $module
+        bash ./install.sh
+        popd
+       rm -rf $module
+    fi
+done    
+