lib/testlab/provisioners/templates/apt/provision.erb in testlab-1.2.3 vs lib/testlab/provisioners/templates/apt/provision.erb in testlab-1.3.0

- old
+ new

@@ -1,19 +1,24 @@ set -x set -e -[[ -f /.testlab-apt-provision ]] && exit 0 - export DEBIAN_FRONTEND="noninteractive" apt-get -y update + <% if !@apt[:install].nil? -%> -apt-get -y install <%= @apt[:install].flatten.compact.join(' ') %> +<% @apt[:install].flatten.compact.each do |package| -%> +dpkg --status <%= package %> &> /dev/null || apt-get -y install <%= package %> <% end -%> +<% end -%> + <% if !@apt[:remove].nil? -%> -apt-get -y remove <%= @apt[:remove].flatten.compact.join(' ') %> +<% @apt[:remove].flatten.compact.each do |package| -%> +dpkg --status <%= package %> &> /dev/null && apt-get -y remove <%= package %> <% end -%> -<% if !@apt[:purge].nil? -%> -apt-get -y purge <%= @apt[:purge].flatten.compact.join(' ') %> <% end -%> -touch /.testlab-apt-provision +<% if !@apt[:purge].nil? -%> +<% @apt[:purge].flatten.compact.each do |package| -%> +dpkg --status <%= package %> &> /dev/null && apt-get -y purge <%= package %> +<% end -%> +<% end -%>