-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathdev-install.sh
executable file
·118 lines (99 loc) · 3.59 KB
/
dev-install.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
#!/bin/sh
NOCOLOR='\033[0m'
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
echo "Setting up the riftshadow development environment"
# If you would like to do some extra provisioning you may
# add any commands you wish to this file and they will
# be run after the Homestead machine is provisioned.
#
# If you have user-specific configurations you would like
# to apply, you may also create user-customizations.sh,
# which will be run after this script.
# If you're not quite ready for Node 12.x
# Uncomment these lines to roll back to
# v11.x or v10.x
# Remove Node.js v12.x:
#sudo apt-get -y purge nodejs
#sudo rm -rf /usr/lib/node_modules/npm/lib
#sudo rm -rf //etc/apt/sources.list.d/nodesource.list
# Install Node.js v11.x
#curl -sL https://deb.nodesource.com/setup_11.x | sudo -E bash -
#sudo apt-get install -y nodejs
# Install Node.js v10.x
#curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
#sudo apt-get install -y nodejs
# Get a copy of the signing key for cmake's developer
echo "Installing the CMake signing key"
{
sudo wget -O /etc/apt/trusted.gpg.d/kitware.asc https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null
echo "${GREEN}CMake key installed${NOCOLOR}\n"
} || {
echo "${RED}Failed to install CMake signing key. Aborting.${NOCOLOR}"
exit
}
# Add the cmake repo to sources list
echo "Adding CMake Repo"
{
sudo apt-add-repository 'deb https://apt.kitware.com/ubuntu bionic main'
echo "${GREEN}CMake Repo Added${NOCOLOR}\n"
} || {
echo "${RED}Failed to add the CMake repo. Aborting.${NOCOLOR}"
exit
}
# Add another repo to sources list for gcc-9, g++-9, and update
#sudo apt-add-repository ppa:ubuntu-toolchain-r/test
echo "${NOCOLOR}Updating APT${NOCOLOR}"
sudo apt-get update
echo "${GREEN}Update Complete${NOCOLOR}\n"
# Install deps
echo "Installing dependencies"
sudo apt-get install -y ninja-build make cmake gcc g++
echo "${GREEN}Finished installing${NOCOLOR}\n"
echo "Checking environment for a MySQL distribution"
mySqlPresent=$(type mysql >/dev/null 2>&1 && echo true || echo false)
if $mySqlPresent; then
echo "${GREEN}A MySQL distribution found!${NOCOLOR}"
echo "${GREEN}You are currently using: ${NOCOLOR}$(mysqld --version)\n"
{
sudo service mariadb start
sudo service mariadb status
} || {
sudo service mysql start
sudo service mysql status
}
else
echo "${YELLOW}No MySQL distribution found, installing MariaDB now.\n${NOCOLOR}"
sudo apt-get install -y libmariadb-dev libmariadb-dev-compat mariadb-client mariadb-server
echo "${GREEN}Finished installing MariaDB server and client.${NOCOLOR}"
echo "Starting MariaDB"
{
sudo service mariadb start
sudo service mariadb status
} || {
echo "${RED}Failed to start MariaDB, please check your service settings.${NOCOLOR}"
exit
}
fi
# Update alternatives
#sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 60 --slave /usr/bin/g++ g++ /usr/bin/g++-9
# Setup Database
echo "${NOCOLOR}Running database scaffolding\n"
{
if [ -e ./db/setup.sql ]; then
sudo mysql -v mysql < ./db/setup.sql
sudo mysql -v rift_core < ./db/rift_core.sql >/dev/null 2>&1
sudo mysql -v rift < ./db/rift.sql >/dev/null 2>&1
elif [ -e ~/code/db/setup.sql ]; then
sudo mysql -v mysql < ~/code/db/setup.sql
sudo mysql -v rift_core < ~/code/db/rift_core.sql >/dev/null 2>&1
sudo mysql -v rift < ~/code/db/rift.sql >/dev/null 2>&1
~/code/admin/artisan migrate
fi
} ||
{ # log that there was an error and to check the MySQL settings
echo "${RED}There was a problem running setup.sql on your local server. Inspect the error above${NOCOLOR}"
exit
}
echo "${GREEN}Database scaffolding successful! Huzzah!${NOCOLOR}"