Help language development. Donate to The Perl Foundation

Magento cpan:SACOMO last updated on 2018-06-07

scripts/magento-post-configuration
#!/bin/bash

source xt/env;

# Wait until mysql available
docker exec -it -e SCRIPT="$(cat scripts/mysql-running-test)" perl6-magento_db_1 /bin/bash -c " 
    echo \"\$SCRIPT\" > mysql-running-test; 
    chmod +x mysql-running-test; 
    ./mysql-running-test;";

# Wait until composer initialized
while [[ "$variable" -ne "0" ]];do
    echo "Cannot connect to db";
    variable=$(docker exec -i -t perl6-magento_web_1 /bin/bash -c 'file /var/www/html/var/composer_home; echo $?')
    sleep 0.1 
done 

# Setup Magento
docker exec -it -u 0 -e SCRIPT="$(cat scripts/install-magento)" perl6-magento_web_1 /bin/bash -c " 
    echo \"\$SCRIPT\" > install-magento; 
    chmod +x install-magento; 
    ./install-magento;";

# Magento sample data
docker exec -it -e SCRIPT="$(cat scripts/install-sampledata)" perl6-magento_web_1 /bin/bash -c " 
    echo \"\$SCRIPT\" > install-sampledata; 
    chmod +x install-sampledata; 
    ./install-sampledata;";

# Add test user
docker exec -it -e CUSTOMERSQL="$(cat xt/sql/customer-entity.sql)" perl6-magento_db_1 /bin/bash -c "
    echo \"\$CUSTOMERSQL\" > /tmp/customer.sql;
    mysql -u root -p${MYSQL_ROOT_PASSWORD} -h db magento  < /tmp/customer.sql";