handle >1 plugins to be installed with dependencies
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
diff --git a/Dockerfile b/Dockerfile
index 20a6d54..3617254 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -62,4 +62,4 @@
# from a derived Dockerfile, can use `RUN plugins.sh active.txt` to setup /usr/share/jenkins/ref/plugins from a support bundle
COPY plugins.sh /usr/local/bin/plugins.sh
-COPY install-plugin.sh /usr/local/bin/install-plugin.sh
+COPY install-plugins.sh /usr/local/bin/install-plugins.sh
diff --git a/install-plugin.sh b/install-plugins.sh
similarity index 71%
rename from install-plugin.sh
rename to install-plugins.sh
index aa39ca9..750eb5c 100755
--- a/install-plugin.sh
+++ b/install-plugins.sh
@@ -1,4 +1,4 @@
-#! /bin/sh
+#! /bin/bash
function download() {
plugin=$1
@@ -23,9 +23,16 @@
function resolveDependencies() {
plugin=$1
- dependencies=`jrunscript -e 'java.lang.System.out.println(new java.util.jar.JarFile("'${plugin}.hpi'").getManifest().getMainAttributes().getValue("Plugin-Dependencies"));'`
+ dependencies=`jrunscript -e '\
+ java.lang.System.out.println(\
+ new java.util.jar.JarFile("'${plugin}.hpi'")\
+ .getManifest()\
+ .getMainAttributes()\
+ .getValue("Plugin-Dependencies")\
+ );'`
if [[ "$dependencies" == "null" ]]; then
+ echo " > plugin has no dependencies"
return
fi
@@ -46,4 +53,8 @@
}
-download $1
+shift
+for plugin in "$@"
+do
+ download $plugin
+done