Guest User

Untitled

a guest
Jun 13th, 2016
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 3.65 KB | None | 0 0
  1. #!/usr/bin/env bash
  2.  
  3. vagrantversion=$(vagrant '-v');
  4. if [ "$vagrantversion"  == "Vagrant 1.8.1" ]
  5. then
  6.     echo "Vagrant 1.8.1 detected...."
  7.     echo "Installing some pre-requisites"
  8.    # vagrant plugin install vagrant-hostmanager
  9.    # vagrant plugin install vagrant-vbguest
  10.  
  11.     rm -rf tmp/;
  12.     mkdir tmp/
  13.     cd tmp/
  14.  
  15.     echo "Created tmp folder"
  16.     echo "Cloning latest hypernode build from byte repository"
  17.     wait;
  18.     git clone https://github.com/ByteInternet/hypernode-vagrant.git
  19.  
  20.     echo "Done.. Setting up stuff for $USER's desktop working-directory called magento_www"
  21.  
  22.     rm -rf $HOME/Desktop/magento_www
  23.  
  24.     mkdir -p $HOME/Desktop/magento_www
  25.     mkdir -p $HOME/Desktop/magento_www/bin/data/web/public
  26.     mkdir -p $HOME/Desktop/magento_www/bin/phar
  27.     mkdir -p $HOME/Desktop/magento_www/docs
  28.     mkdir -p $HOME/Desktop/magento_www/database
  29.  
  30.     cp -r hypernode-vagrant/vagrant $HOME/Desktop/magento_www/bin/vagrant
  31.     cp -r hypernode-vagrant/Vagrantfile $HOME/Desktop/magento_www/bin/Vagrantfile
  32.     cp -r hypernode-vagrant/local.example.yml $HOME/Desktop/magento_www/bin/local.yml
  33.     cp -r hypernode-vagrant/local.example.yml $HOME/Desktop/magento_www/bin/local.example.yml
  34.  
  35.     perl -pi -e 's/5.5/7.0/g' $HOME/Desktop/magento_www/bin/local.yml
  36.  
  37.     echo "    - development.local" >> $HOME/Desktop/magento_www/bin/local.yml
  38.     echo "    - staging.local" >> $HOME/Desktop/magento_www/bin/local.yml
  39.     echo "    - live.local" >> $HOME/Desktop/magento_www/bin/local.yml
  40.  
  41.     cd $HOME/Desktop/magento_www/bin
  42.     ln -s $HOME/Desktop/magento_www/bin/data/web/public $HOME/Desktop/magento_www/public_html
  43.  
  44.     cd $HOME/Desktop/magento_www/bin/data/web/public
  45.     touch index.php
  46.     echo "<html><h1> Hypernode successfully installed</h1></html>" >> index.php
  47.  
  48.     cd $HOME/Desktop/magento_www/bin
  49.  
  50.     vagrant up
  51.     echo "Curling http://development.local/ to test if the webserver is working"
  52.    # curl -a "http://development.local/"
  53.    # echo "Curling http://staging.local/ to test if the hostnames are working"
  54.    # curl -i "http://staging.local/"
  55.  
  56.     cd $HOME/Desktop/magento_www/bin/data/web/public
  57.     rm index.php
  58.     cd $HOME/Desktop/magento_www/bin
  59.  
  60.     echo "setting up magento2"
  61.  
  62.     publickey="cad1a1326e92ad8e01e27e16858ae4ac"
  63.     privatekey="41248e22b6506687ef3a50baac0937fc"
  64.  
  65.  
  66.     echo "It's gonna ask you for a username and password here are the credentials"
  67.     echo "Username : $publickey"
  68.     echo "Password : $privatekey"
  69.  
  70.     ##Setup for auth.JSON
  71.     vagrant ssh --command 'cd /home/vagrant/;' sudo echo '{ "http-basic": { "repo.magento.com": { "username": "cad1a1326e92ad8e01e27e16858ae4ac", "password": "41248e22b6506687ef3a50baac0937fc" } } }' >> auth.json;
  72.     vagrant ssh --command 'cd /home/vagrant/; sudo mv auth.json .composer/auth.json;'
  73.  
  74.     vagrant ssh --command "cd /data/web/public; chmod -R 755 /data/web/public;sudo composer init -n;"
  75.     vagrant ssh --command "cd /data/web/public; sudo composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition tmp/";
  76.     vagrant ssh --command "cd /data/web/public; mv tmp/* ./; rm -rf tmp/"
  77.  
  78.     wait
  79.     vagrant halt
  80.  
  81.     echo "Usage::  in $HOME/Desktop/magento_www/bin/ run vagrant up and go to one of the following urls!"
  82.     echo ""
  83.  
  84.     echo " - development.local";
  85.     echo " - staging.local";
  86.     echo " - live.local";
  87. else
  88.     echo "Vagrant not found..... downloading vagrant"
  89.     mkdir downloads
  90.     cd downloads
  91.     curl -O https://releases.hashicorp.com/vagrant/1.8.1/vagrant_1.8.1.dmg;
  92.     echo "Please navigate to" $(pwd) "and install vagrant_1.8.1.dmg . Then run this script again";
  93. fi
Add Comment
Please, Sign In to add comment