message: detect if the datadir has been moved, do not try to do it again.
diff: @@ -18,17 +18,20 @@ if [ -n "$(ls /var/solr)" ]; then
  rm -Rf ${datadir}/data || mv ${datadir}/data ${datadir}/data-delete
  fi
  - # the new place for config is in the container, in /opt/solr/server/solr/${corename}
  - mkdir -p /opt/solr/server/solr/${corename}
  + if [ ! -d /opt/solr/server/solr/mycores/${corename} ]; then
  + # the new place for config is in the container, in /opt/solr/server/solr/mycores/${corename}
  + mkdir -p /opt/solr/server/solr/mycores/${corename}
  # construct a core from the persistent volume into the container;
  # there must be a core.properties to be recognized as a core
  # this need not be done when the entire config is properly built into the image.
  - cp -R ${datadir}/conf /opt/solr/server/solr/${corename}/
  - touch /opt/solr/server/solr/${corename}/core.properties
  + cp -R ${datadir}/conf /opt/solr/server/solr/mycores/${corename}/
  + touch /opt/solr/server/solr/mycores/${corename}/core.properties
  # update datadir to point to the persistent volume.
  - sed -ibak 's/<dataDir>.*/<dataDir>\/var\/solr\/${solr.core.name}<\/dataDir>/' /opt/solr/server/solr/${corename}/conf/solrconfig.xml
  + sed -ibak 's/<dataDir>.*/<dataDir>\/var\/solr\/${solr.core.name}<\/dataDir>/' /opt/solr/server/solr/mycores/${corename}/conf/solrconfig.xml
  + fi
  +
  done
  fi
  