diff --git a/site-modules/profile/templates/swh/deploy/loader_opam/opam-manage-shared-state.sh.erb b/site-modules/profile/templates/swh/deploy/loader_opam/opam-manage-shared-state.sh.erb index b4a502f1..f0df2903 100644 --- a/site-modules/profile/templates/swh/deploy/loader_opam/opam-manage-shared-state.sh.erb +++ b/site-modules/profile/templates/swh/deploy/loader_opam/opam-manage-shared-state.sh.erb @@ -1,51 +1,51 @@ #!/usr/bin/env bash # Managed by puppet class profile::swh::deploy::worker::loader_opam # Changes will be overwritten # This script is in charge of bootstraping the opam root folder with the default opam # repository. set -e ROOT_DIR=<%= @opam_root %> CMD=/usr/bin/opam function init_or_update_opam_root () { # Ensure opam root directory exists and references the main opam repository as default # instance. If not, create it from scratch. If properly configured, update the opam # repository instance_name=$1 instance_url=$2 - if $CMD repo --all --root $ROOT_DIR | grep -qx $instance_url; then + if $CMD repo --all --root $ROOT_DIR | grep -q $instance_url; then $CMD update --root $ROOT_DIR else $CMD init --reinit --bare --no-setup --root $ROOT_DIR $instance_name $instance_url fi } function init_or_update_opam_instance () { # Ensure opam root directory exists and references the main opam repository as default # instance. If not, create it from scratch. If properly configured, update the opam # repository. # Note that This assumes that the function init_or_update_opam_root already got called # prior to calling this one. instance_name=$1 instance_url=$2 - if $CMD repo --all --root $ROOT_DIR | grep -qx $instance_url; then + if $CMD repo --all --root $ROOT_DIR | grep -q $instance_url; then $CMD update --root $ROOT_DIR else $CMD repository add --root $ROOT_DIR --all-switches $instance_name $instance_url fi } init_or_update_opam_root <%= @default_instance_name %> <%= @default_instance_url %> <% @other_instances.each do |instance_name, instance_url| %> init_or_update_opam_instance <%= instance_name %> <%= instance_url %> <% end %>