seed-data 545 B

1234567891011121314151617181920212223242526
  1. #!/bin/bash
  2. set -e -x
  3. SCRIPTS_DIR=$(dirname ${0})
  4. BASE_DIR=${1}
  5. CLOUD_DATA=${2}
  6. IFS=',' read -ra FILES <<< "${3}"
  7. if [ -z ${BASE_DIR} ]; then
  8. echo "Need base directory to place files" 1>&2
  9. exit 1
  10. fi
  11. mkdir -p ${BASE_DIR}/var/lib/rancher/conf/cloud-config.d
  12. if [ "${CLOUD_DATA}" != "${SCRIPTS_DIR}/conf/empty.yml" ]; then
  13. cp ${CLOUD_DATA} ${BASE_DIR}/var/lib/rancher/conf/cloud-config.d/
  14. fi
  15. for f in ${FILES[@]}; do
  16. IFS=":" read s d <<< "${f}"
  17. mkdir -p $(dirname ${BASE_DIR}/${d})
  18. cp -a -T ${s} ${BASE_DIR}/${d}
  19. done