From 652bc2f75e7619d4da0d49bb042aeca1beda171a Mon Sep 17 00:00:00 2001 From: Ignasi Barrera Date: Sat, 3 Nov 2012 00:10:55 +0100 Subject: [PATCH] Improved setupPublicCurl script With this changes, apt and yum helper functions can be used to install many packages at one as follows: ensure_cmd_or_install_package_apt git git-core build-essentials <...> --- compute/src/test/resources/initscript_with_java.sh | 6 ++++-- compute/src/test/resources/initscript_with_jetty.sh | 6 ++++-- compute/src/test/resources/runscript.sh | 6 ++++-- .../src/main/resources/functions/setupPublicCurl.sh | 6 ++++-- .../src/test/resources/test_install_git_scriptbuilder.sh | 6 ++++-- .../src/test/resources/test_install_jdk_scriptbuilder.sh | 6 ++++-- 6 files changed, 24 insertions(+), 12 deletions(-) diff --git a/compute/src/test/resources/initscript_with_java.sh b/compute/src/test/resources/initscript_with_java.sh index 4d60764c85..17982edb18 100644 --- a/compute/src/test/resources/initscript_with_java.sh +++ b/compute/src/test/resources/initscript_with_java.sh @@ -89,14 +89,16 @@ alias yum-install="yum --quiet --nogpgcheck -y install" function ensure_cmd_or_install_package_apt(){ local cmd=$1 - local pkg=$2 + shift + local pkg=$* hash $cmd 2>/dev/null || ( apt-get-update && apt-get-install $pkg ) } function ensure_cmd_or_install_package_yum(){ local cmd=$1 - local pkg=$2 + shift + local pkg=$* hash $cmd 2>/dev/null || yum-install $pkg } diff --git a/compute/src/test/resources/initscript_with_jetty.sh b/compute/src/test/resources/initscript_with_jetty.sh index 7881e9e76f..741ec9458e 100644 --- a/compute/src/test/resources/initscript_with_jetty.sh +++ b/compute/src/test/resources/initscript_with_jetty.sh @@ -89,14 +89,16 @@ alias yum-install="yum --quiet --nogpgcheck -y install" function ensure_cmd_or_install_package_apt(){ local cmd=$1 - local pkg=$2 + shift + local pkg=$* hash $cmd 2>/dev/null || ( apt-get-update && apt-get-install $pkg ) } function ensure_cmd_or_install_package_yum(){ local cmd=$1 - local pkg=$2 + shift + local pkg=$* hash $cmd 2>/dev/null || yum-install $pkg } diff --git a/compute/src/test/resources/runscript.sh b/compute/src/test/resources/runscript.sh index 52f622d1ab..652feded31 100644 --- a/compute/src/test/resources/runscript.sh +++ b/compute/src/test/resources/runscript.sh @@ -89,14 +89,16 @@ alias yum-install="yum --quiet --nogpgcheck -y install" function ensure_cmd_or_install_package_apt(){ local cmd=$1 - local pkg=$2 + shift + local pkg=$* hash $cmd 2>/dev/null || ( apt-get-update && apt-get-install $pkg ) } function ensure_cmd_or_install_package_yum(){ local cmd=$1 - local pkg=$2 + shift + local pkg=$* hash $cmd 2>/dev/null || yum-install $pkg } diff --git a/scriptbuilder/src/main/resources/functions/setupPublicCurl.sh b/scriptbuilder/src/main/resources/functions/setupPublicCurl.sh index b299200af6..eb7cdd9861 100644 --- a/scriptbuilder/src/main/resources/functions/setupPublicCurl.sh +++ b/scriptbuilder/src/main/resources/functions/setupPublicCurl.sh @@ -4,14 +4,16 @@ alias yum-install="yum --quiet --nogpgcheck -y install" function ensure_cmd_or_install_package_apt(){ local cmd=$1 - local pkg=$2 + shift + local pkg=$* hash $cmd 2>/dev/null || ( apt-get-update && apt-get-install $pkg ) } function ensure_cmd_or_install_package_yum(){ local cmd=$1 - local pkg=$2 + shift + local pkg=$* hash $cmd 2>/dev/null || yum-install $pkg } diff --git a/scriptbuilder/src/test/resources/test_install_git_scriptbuilder.sh b/scriptbuilder/src/test/resources/test_install_git_scriptbuilder.sh index 7539de4e91..b876867c6c 100644 --- a/scriptbuilder/src/test/resources/test_install_git_scriptbuilder.sh +++ b/scriptbuilder/src/test/resources/test_install_git_scriptbuilder.sh @@ -89,14 +89,16 @@ alias yum-install="yum --quiet --nogpgcheck -y install" function ensure_cmd_or_install_package_apt(){ local cmd=$1 - local pkg=$2 + shift + local pkg=$* hash $cmd 2>/dev/null || ( apt-get-update && apt-get-install $pkg ) } function ensure_cmd_or_install_package_yum(){ local cmd=$1 - local pkg=$2 + shift + local pkg=$* hash $cmd 2>/dev/null || yum-install $pkg } diff --git a/scriptbuilder/src/test/resources/test_install_jdk_scriptbuilder.sh b/scriptbuilder/src/test/resources/test_install_jdk_scriptbuilder.sh index b9dae5e263..905aef3de4 100644 --- a/scriptbuilder/src/test/resources/test_install_jdk_scriptbuilder.sh +++ b/scriptbuilder/src/test/resources/test_install_jdk_scriptbuilder.sh @@ -89,14 +89,16 @@ alias yum-install="yum --quiet --nogpgcheck -y install" function ensure_cmd_or_install_package_apt(){ local cmd=$1 - local pkg=$2 + shift + local pkg=$* hash $cmd 2>/dev/null || ( apt-get-update && apt-get-install $pkg ) } function ensure_cmd_or_install_package_yum(){ local cmd=$1 - local pkg=$2 + shift + local pkg=$* hash $cmd 2>/dev/null || yum-install $pkg }