Skip to content

Commit 11453ba

Browse files
authored
Merge branch 'develop' into add/srv/vvv
2 parents 13b5a0f + bfb3e98 commit 11453ba

File tree

15 files changed

+139
-74
lines changed

15 files changed

+139
-74
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ permalink: /docs/en-US/changelog/
1818
* SHDocs added to core provisioners
1919
* A new `/srv/vvv` folder for files created inside the VM related to provisioning ( #2328 )
2020
* Improved PHP configuration file installation
21+
* Adds a `vagrant` command inside the virtual machine to tell users they are still inside the VM and need to exit
2122

2223
### Bug Fixes
2324

config/homebin/vagrant

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/usr/bin/env bash
2+
3+
set -eo pipefail
4+
source /srv/provision/provision-helpers.sh
5+
6+
echo -e "${CRESET}"
7+
echo -e "${YELLOW} ? ▄▀▀▀▄▄▄▄▄▄▄▀▀▀▄ ? ${CRESET}"
8+
echo -e "${YELLOW} ✧█▒▒░░░░░░░░░▒▒█ ${CRESET}"
9+
echo -e "${YELLOW} ? █░░█░░░░░█░░█ ? ${CRESET}"
10+
echo -e "${YELLOW} █▄░▀█▀░░░░█ ? ${CRESET}"
11+
echo -e "${YELLOW} █░░█░░░░░░▄▀ ${CRESET}"
12+
echo -e "${YELLOW}──────────────────────${CRESET}"
13+
echo ""
14+
echo -e "${PURPLE} ! You're still SSH'd into the VVV virtual machine!${CRESET}"
15+
echo -e "${PURPLE} Run exit and try again${CRESET}"

provision/core/deprecated.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
# @noargs
66
function deprecated_distro() {
77
local command_exist
8-
command_exist="$(which lsb_release)"
9-
if [ -z "${command_exist}" ]; then
10-
return;
8+
if ! command -v lsb_release &> /dev/null; then
9+
return 0
1110
fi
11+
vvv_info " * checking Ubuntu version"
1212
codename=$(lsb_release --codename | cut -f2)
1313
if [[ $codename == "trusty" ]]; then
1414
r="\e[0;32m"

provision/core/env.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ set -eo pipefail
55
# @noargs
66
function setup_vvv_env() {
77
# fix no tty warnings in provisioner logs
8-
sudo sed -i '/tty/!s/mesg n/tty -s \\&\\& mesg n/' /root/.profile
8+
sed -i '/tty/!s/mesg n/tty -s \\&\\& mesg n/' /root/.profile
99

1010
# add homebin to secure_path setting for sudo, clean first and then append at the end
1111
sed -i -E \
@@ -107,7 +107,9 @@ function profile_setup() {
107107
vvv_info " * Copying /srv/config/sshd_config to /etc/ssh/sshd_config"
108108
cp -f /srv/config/sshd_config /etc/ssh/sshd_config
109109
vvv_info " * Reloading SSH Daemon"
110-
systemctl reload ssh
110+
if [ "${VVV_DOCKER}" != 1 ]; then
111+
systemctl reload ssh
112+
fi
111113
fi
112114
}
113115

provision/core/git/provision.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ function git_register_packages() {
77
if ! vvv_src_list_has "git-core/ppa"; then
88
# Add ppa repo.
99
vvv_info " * Adding ppa:git-core/ppa repository"
10-
sudo add-apt-repository -y ppa:git-core/ppa &>/dev/null
10+
add-apt-repository -y ppa:git-core/ppa
1111
vvv_success " * git-core/ppa added"
1212
else
1313
vvv_info " * git-core/ppa already present, skipping"

provision/core/mailhog/provision.sh

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,21 @@ function mailhog_setup() {
2828
fi
2929

3030
# Start on reboot
31-
vvv_info " * Enabling MailHog Service"
32-
systemctl enable mailhog
31+
if [ "${VVV_DOCKER}" != 1 ]; then
32+
vvv_info " * Enabling MailHog Service"
33+
systemctl enable mailhog
3334

34-
vvv_info " * Starting MailHog Service"
35-
systemctl start mailhog
35+
vvv_info " * Starting MailHog Service"
36+
systemctl start mailhog
37+
fi
3638
}
3739
export -f mailhog_setup
3840

3941
vvv_add_hook after_packages mailhog_setup
4042

41-
vvv_add_hook services_restart "service mailhog restart"
43+
if [ "${VVV_DOCKER}" != 1 ]; then
44+
vvv_add_hook services_restart "service mailhog restart"
45+
fi
4246

4347
function mailhog_php_finalize() {
4448
# Enable PHP MailHog sendmail settings by default

provision/core/mariadb/provision.sh

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,9 @@ SQL
8181

8282
function mysql_setup() {
8383
# If MariaDB/MySQL is installed, go through the various imports and service tasks.
84-
local exists_mysql
85-
86-
exists_mysql="$(service mysql status)"
87-
if [[ "mysql: unrecognized service" == "${exists_mysql}" ]]; then
84+
if ! command -v mysql &> /dev/null; then
8885
vvv_error " ! MySQL is not installed. No databases imported."
89-
return
86+
return 1
9087
fi
9188
vvv_info " * Setting up database configuration file links..."
9289

@@ -98,19 +95,20 @@ function mysql_setup() {
9895
chmod 0644 "/home/vagrant/.my.cnf"
9996
vvv_info " * Copied /srv/config/mysql-config/root-my.cnf to /home/vagrant/.my.cnf"
10097

101-
check_mysql_root_password
98+
if [ "${VVV_DOCKER}" != 1 ]; then
99+
check_mysql_root_password
100+
fi
102101

103102
# MySQL gives us an error if we restart a non running service, which
104103
# happens after a `vagrant halt`. Check to see if it's running before
105104
# deciding whether to start or restart.
106-
if [[ "mysql stop/waiting" == "${exists_mysql}" ]]; then
105+
if [ $(service mysql status|grep 'mysql start/running' | wc -l) -ne 1 ]; then
107106
vvv_info " * Starting the mysql service"
108107
service mysql start
109108
else
110109
vvv_info " * Restarting mysql service"
111110
service mysql restart
112111
fi
113-
114112
# IMPORT SQL
115113
#
116114
# Create the databases (unique to system) that will be imported with
@@ -134,4 +132,6 @@ function mysql_setup() {
134132
}
135133
export -f mysql_setup
136134

137-
vvv_add_hook after_packages mysql_setup 30
135+
if [ "${VVV_DOCKER}" != 1 ]; then
136+
vvv_add_hook after_packages mysql_setup 30
137+
fi

provision/core/nginx/provision.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,9 @@ export -f nginx_setup
8282

8383
vvv_add_hook after_packages nginx_setup 40
8484

85-
vvv_add_hook services_restart "service nginx restart"
85+
if [ "${VVV_DOCKER}" != 1 ]; then
86+
vvv_add_hook services_restart "service nginx restart"
87+
fi
8688

8789
function nginx_cleanup() {
8890
vvv_info " * Cleaning up Nginx configs"

provision/core/nodejs/provision.sh

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@
33
set -eo pipefail
44

55
function nodejs_register_packages() {
6-
if ! vvv_src_list_has "nodesource"; then
7-
cp -f "/srv/provision/core/nodejs/sources.list" "/etc/apt/sources.list.d/vvv-nodejs-sources.list"
8-
fi
6+
cp -f "/srv/provision/core/nodejs/sources.list" "/etc/apt/sources.list.d/vvv-nodejs-sources.list"
97

108
if ! vvv_apt_keys_has 'NodeSource'; then
119
# Retrieve the NodeJS signing key from nodesource.com
@@ -21,21 +19,28 @@ function nodejs_register_packages() {
2119
}
2220
vvv_add_hook before_packages nodejs_register_packages
2321

22+
function reinstall_node() {
23+
vvv_info " * Purging NodeJS package."
24+
apt-get purge nodejs -y
25+
vvv_info " * Cleaning apt."
26+
apt-get clean -y
27+
vvv_info " * Apt autoremove."
28+
apt-get autoremove -y
29+
vvv_info " * Installing Node 14 LTS."
30+
apt-get install -y --allow-downgrades --allow-remove-essential --allow-change-held-packages -o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confnew install --fix-missing --fix-broken nodejs
31+
vvv_success " ✓ Reinstalled Node, if you need another version use the nvm utility"
32+
}
33+
2434
function node_setup() {
25-
if [[ $(nodejs -v | sed -ne 's/[^0-9]*\(\([0-9]\.\)\{0,4\}[0-9][^.]\).*/\1/p') != '10' ]]; then
26-
vvv_info " * Downgrading to Node v10."
27-
apt remove nodejs -y
28-
apt install -y --allow-downgrades --allow-remove-essential --allow-change-held-packages -o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confnew install --fix-missing --fix-broken nodejs
35+
if [[ $(nodejs -v | sed -ne 's/[^0-9]*\(\([0-9]\.\)\{0,4\}[0-9][^.]\).*/\1/p') != '14' ]]; then
36+
vvv_info " * Migrating to Node v14."
37+
reinstall_node
38+
fi
39+
if [[ ! -f "/usr/bin/npm" ]]; then
40+
vvv_warn " ! npm is missing in /usr/bin, reinstalling Node"
41+
reinstall_node
2942
fi
30-
31-
# npm
32-
#
33-
# Make sure we have the latest npm version and the update checker module
34-
vvv_info " * Installing/updating npm..."
35-
npm_config_loglevel=error npm install -g npm
36-
vvv_info " * Installing/updating npm-check-updates..."
37-
npm_config_loglevel=error npm install -g npm-check-updates
3843
}
3944
export -f node_setup
4045

41-
vvv_add_hook after_packages node_setup
46+
vvv_add_hook after_packages node_setup

provision/core/nodejs/sources.list

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# Provides Node.js
2-
deb https://deb.nodesource.com/node_10.x bionic main
3-
deb-src https://deb.nodesource.com/node_10.x bionic main
2+
deb https://deb.nodesource.com/node_14.x bionic main
3+
deb-src https://deb.nodesource.com/node_14.x bionic main

0 commit comments

Comments
 (0)