apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ include "mysql.fullname" . }}-scripts
  labels:
    {{- include "mysql.labels" . | nindent 4 }}
data:
  init.sh: |
    #!/bin/sh
    echo "Start initialization"
    if [ -d /extrascripts ]; then
      echo "Copy extra scripts"
      cp /extrascripts/* /scripts
    fi
    if [ -d /customscripts ]; then
      echo "Copy custom scripts"
      cp /customscripts/* /scripts
    fi
    if [ -d /extraconfigs ]; then
      echo "Copy extra configs"
      cp /extraconfigs/* /configs
    fi
    if [ -d /customconfig ]; then
      echo "Copy custom config"
      cp /customconfig/* /configs
    fi
    echo "Initialization done."
