Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- read -p "Type domain name (bez wwww, np. example.com):" name
- mkdir -p /home/vagrant/vhost_backup
- mkdir -p /home/vagrant/www/$name
- chmod 777 /home/vagrant/www/$name
- chown -R vagrant:vagrant /home/vagrant/www/$name
- cp /etc/hosts /home/vagrant/vhost_backup/hosts
- printf '127.0.0.1 %s www.%s\n' $name $name >> /etc/hosts
- printf '<VirtualHost *:80>\nServerName %s\nServerAlias www.%s\nServerAdmin admin@localhost\n\nDocumentRoot /home/vagrant/www/%s\n<Directory /home/vagrant/www/%s>\nOptions Indexes FollowSymLinks MultiViews\nAllowOverride All\nRequire all granted\n</Directory>\n\nCustomLog ${APACHE_LOG_DIR}/access.log combined\nErrorLog ${APACHE_LOG_DIR}/error.log\n</VirtualHost>\n\n<VirtualHost *:443>\nServerName %s\nServerAdmin admin@localhost\n\nSSLEngine On\nSSLCertificateFile /etc/apache2/ssl/server.crt\nSSLCertificateKeyFile /etc/apache2/ssl/server.key\n\nDocumentRoot /home/vagrant/www/%s\n<Directory /home/vagrant/www/%s>\nOptions Indexes FollowSymLinks MultiViews\nAllowOverride All\nRequire all granted\n</Directory>\n\nCustomLog ${APACHE_LOG_DIR}/access.log combined\nErrorLog ${APACHE_LOG_DIR}/error.log\n</VirtualHost>\n' $name $name $name $name $name $name $name > /etc/apache2/sites-available/$name.conf
- podloga="_"
- dbname=${name/./$podloga}
- mysql -uroot -pshopware -hlocalhost --execute="CREATE DATABASE $dbname;"
- a2ensite $name.conf
- service apache2 reload
- echo "Install Shopware?"
- select yn in "Yes" "No"; do
- case $yn in
- Yes )
- cd /home/vagrant/www/$name
- git clone https://github.com/shopware/shopware.git .
- cd /home/vagrant/www/$name/build/
- ant write-properties -Dapp.host=$name -Dapp.path=/ -Ddb.name=$dbname -Ddb.host=localhost -Ddb.user=root -Ddb.password=shopware
- ant build-unit
- chown -R vagrant:vagrant /home/vagrant/www/$name
- cd /home/vagrant/www/$name
- wget -O test_images.zip http://releases.s3.shopware.com/test_images.zip
- unzip test_images.zip
- rm -f test_images.zip
- chmod -R 755 /home/vagrant/www/$name/var
- chmod -R 755 /home/vagrant/www/$name/web
- chmod -R 755 /home/vagrant/www/$name/files
- chmod -R 755 /home/vagrant/www/$name/media
- chmod -R 755 /home/vagrant/www/$name/engine/Shopware/Plugins/Community
- break;;
- No ) exit;;
- esac
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement