setup.sh 3.67 KB
Newer Older
1
## Vagrantfile variables
2
3
4
5
VGHOSTNAME='wcms-vagrant'
VGIP='192.168.101.20'
VGSITE='fdsu'
VGSERVER='d'
6
7
VGPHPDRUPAL7='5.6'
VGPHPDRUPAL8='7.1'
8

9
## Version of PHP needed for Drupal 7 (to match our servers)
10
11
## Need to remove the "update-alternatives" line when we go to 7.0 since it isn't needed.
VGPHPVERSION='5.6'
12
## Check to make sure we will not clobber an existing vm config.
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
if [ -e Vagrantfile ]
  then
    echo "Vagrantfile exists"
    echo "If you want a new environment first run vagrant destroy to ensure everything is cleaned up."
    echo ""
    echo "Then run ./clean.sh to clean everything out."
    echo ""
    echo "** THE ABOVE STEPS WILL DELETE EVERYTHING SO MAKE SURE ALL WORK IS COMMITTED AND PUSHED **"
    exit
fi
echo "
********************************************************************************
First we will ask you a few questions to identify this host. Defaults are enclosed in single square
brackets, pressing enter will choose the default setting.
********************************************************************************
"
read -p "hostname [${VGHOSTNAME}]: " vgrthostname
30
export vgrthostname=${vgrthostname:-$VGHOSTNAME}
31
echo ""
32
33
34
## set the IP address for the Virtual Machine it has to start 192.168.101.xx
unset vgrtip
while [[ ! ${vgrtip} =~ ^192\.168\.101\.[0-9]{1,3}$ ]]; do
35
read -p "IP address (it has to start 192.168.101.xx) [${VGIP}]: " vgrtip
36
37
38
39
40
41
42
43
44
vgrtip=${vgrtip:-$VGIP}
  if [[ ! ${vgrtip} =~ ^192\.168\.101\.[0-9]{1,3}$ ]] ; then
    echo 'You entered' ${vgrtip} 'The ip address has to start 192.168.101.xx'
  else
    echo "You enterd a valid IP address."
    export vgrtip=${vgrtip:-$VGIP}
  fi
done

45
echo ""
46
47
## read -p "site preface (make sure it doesn't contain . or $ or *) [$VGSITE]": vgrtsite
## vgrtsite=${vgrtsite:-$VGSITE}
48
export vgrtsite=$VGSITE
49
read -p "Set what you want the URL to be (https://<server>7/) for ther servers. Such as d or www (make sure it doesn't contain . or $ or *) [$VGSERVER]: " vgrtserver
50
export vgrtserver=${vgrtserver:-$VGSERVER}
51
echo ""
52
53
unset vgrtdefaultphp
while [[ ! ${vgrtdefaultphp} ]]; do
54
55
echo "You must decide which version of PHP you want to use. Drupal 7 requires 5.6 and Drupal 8 requires 7.1"
read -p "which version of php are you going to use? 1)$VGPHPDRUPAL7 2)$VGPHPDRUPAL8: " vgrtdefaultphp
56
  case $vgrtdefaultphp in
57
58
    1) echo "You chose $VGPHPDRUPAL7"
       export vgrtdefaultphp=$VGPHPDRUPAL7;;
59
       2) echo "You chose $VGPHPDRUPAL8"
60
      export vgrtdefaultphp=$VGPHPDRUPAL8;;
61
62
63
      *) echo "Sorry, invalid entry";;
  esac
done
64
## break
65
66
67
echo ""
export vgrtphpdrupal7=$VGPHPDRUPAL7
export vgrtphpdrupal8=$VGPHPDRUPAL8
68
echo ""
69
unset vgrtwatiamid
70
while [[ ! ${vgrtwatiamid} =~ ^[a-z0-9_-]{1,8}$ ]]; do
71
72
73
  read -p "Please enter your WATIAM ID so it can be set in the .gitconfig. " vgrtwatiamid
  export vgrtwatiamid
done
74
echo ""
75
76
77
78
79
unset vgrtemail
while [[ ! ${vgrtemail} =~ ^[a-z0-9]+(\.[a-z0-9]+)*@([a-z0-9]([a-z0-9-]*[a-z0-9])?\.)+([a-z0-9-]*[a-z0-9])$ ]]; do
  read -p "Please enter your uwaterloo email address so it can be set in the .gitconfig. " vgrtemail
  export vgrtemail
done
80
echo ""
81
echo 'Create the Variable file'
82
83
. ./variables/var.sh
chmod a+x ./manifests/variable.sh
84
echo ''
85
echo 'Variable file created.'
86
echo ''
87
echo 'Create the Vagrant file.'
88
. ./variables/vagrantfile.sh
89
echo 'Vagrant file created.'
90
91
92
echo ''
echo 'Create PHPStorm setting files.'
cd $(dirname $0)
93
. ./variables/phpstorm.sh
94
95
96
97
98
99
100
101
echo ''
echo "
********************************************************************************
You should now be ready to initialize your vagrant instance

This is done via

      vagrant up
102

103
104
105
106
The default user is vagrant and the default password is vagrant.

********************************************************************************
"
107
## $SHELL