Advertisement
Guest User

Untitled

a guest
May 26th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.34 KB | None | 0 0
  1. #!/bin/bash
  2. read -p "Type domain name (bez wwww, np. example.com):" name
  3. mkdir -p /home/vagrant/vhost_backup
  4. mkdir -p /home/vagrant/www/$name
  5. chmod 777 /home/vagrant/www/$name
  6. chown -R vagrant:vagrant /home/vagrant/www/$name
  7. cp /etc/hosts /home/vagrant/vhost_backup/hosts
  8. printf '127.0.0.1 %s www.%s\n' $name $name >> /etc/hosts
  9. 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
  10. podloga="_"
  11. dbname=${name/./$podloga}
  12. mysql -uroot -pshopware -hlocalhost --execute="CREATE DATABASE $dbname;"
  13. a2ensite $name.conf
  14. service apache2 reload
  15. echo "Install Shopware?"
  16. select yn in "Yes" "No"; do
  17. case $yn in
  18. Yes )
  19. cd /home/vagrant/www/$name
  20. git clone https://github.com/shopware/shopware.git .
  21. cd /home/vagrant/www/$name/build/
  22. ant write-properties -Dapp.host=$name -Dapp.path=/ -Ddb.name=$dbname -Ddb.host=localhost -Ddb.user=root -Ddb.password=shopware
  23. ant build-unit
  24. chown -R vagrant:vagrant /home/vagrant/www/$name
  25. cd /home/vagrant/www/$name
  26. wget -O test_images.zip http://releases.s3.shopware.com/test_images.zip
  27. unzip test_images.zip
  28. rm -f test_images.zip
  29. chmod -R 755 /home/vagrant/www/$name/var
  30. chmod -R 755 /home/vagrant/www/$name/web
  31. chmod -R 755 /home/vagrant/www/$name/files
  32. chmod -R 755 /home/vagrant/www/$name/media
  33. chmod -R 755 /home/vagrant/www/$name/engine/Shopware/Plugins/Community
  34. break;;
  35. No ) exit;;
  36. esac
  37. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement